@cloudcannon/configuration-types 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +25 -0
- package/package.json +44 -0
- package/src/icon.d.ts +2124 -0
- package/src/index.d.ts +952 -0
- package/src/mime-type.d.ts +434 -0
- package/src/syntax.d.ts +172 -0
- package/src/theme.d.ts +39 -0
- package/src/timezone.d.ts +596 -0
package/src/index.d.ts
ADDED
|
@@ -0,0 +1,952 @@
|
|
|
1
|
+
import type { Icon } from './icon';
|
|
2
|
+
import type { Timezone } from './timezone';
|
|
3
|
+
import type { MimeType } from './mime-type';
|
|
4
|
+
import type { Theme } from './theme';
|
|
5
|
+
import type { Syntax } from './syntax';
|
|
6
|
+
|
|
7
|
+
export type { Icon, Timezone, MimeType, Theme, Syntax };
|
|
8
|
+
|
|
9
|
+
export type InstanceValue = 'UUID' | 'NOW';
|
|
10
|
+
|
|
11
|
+
export type EditorKey = 'visual' | 'content' | 'data';
|
|
12
|
+
|
|
13
|
+
export type SortOrder = 'ascending' | 'descending' | 'asc' | 'desc';
|
|
14
|
+
|
|
15
|
+
interface ImageResizeable {
|
|
16
|
+
/**
|
|
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.
|
|
18
|
+
*/
|
|
19
|
+
mime_type?: 'image/jpeg' | 'image/png';
|
|
20
|
+
/**
|
|
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.
|
|
22
|
+
* @default true
|
|
23
|
+
*/
|
|
24
|
+
correct_orientation?: boolean;
|
|
25
|
+
/**
|
|
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.
|
|
27
|
+
* @default 'contain'
|
|
28
|
+
*/
|
|
29
|
+
resize_style?: 'cover' | 'contain' | 'stretch';
|
|
30
|
+
/**
|
|
31
|
+
* Defines the width of the bounding box used in the image resizing process defined with resize_style.
|
|
32
|
+
*/
|
|
33
|
+
width?: number;
|
|
34
|
+
/**
|
|
35
|
+
* Defines the height of the bounding box used in the image resizing process defined with resize_style.
|
|
36
|
+
*/
|
|
37
|
+
height?: number;
|
|
38
|
+
/**
|
|
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.
|
|
40
|
+
* @default false
|
|
41
|
+
*/
|
|
42
|
+
expandable?: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Instructs the editor to save `width` and `height` attributes on the image elements. This can prevent pop-in as a page loads.
|
|
45
|
+
* @default true
|
|
46
|
+
*/
|
|
47
|
+
image_size_attributes?: boolean;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export interface Editables {
|
|
51
|
+
/**
|
|
52
|
+
* Contains input options for the Content Editor.
|
|
53
|
+
*/
|
|
54
|
+
content?: BlockEditable;
|
|
55
|
+
/**
|
|
56
|
+
* Contains input options for block Editable Regions.
|
|
57
|
+
*/
|
|
58
|
+
block?: BlockEditable;
|
|
59
|
+
/**
|
|
60
|
+
* Contains input options for link Editable Regions.
|
|
61
|
+
*/
|
|
62
|
+
link?: LinkEditable;
|
|
63
|
+
/**
|
|
64
|
+
* Contains input options for image Editable Regions.
|
|
65
|
+
*/
|
|
66
|
+
image?: ImageEditable;
|
|
67
|
+
/**
|
|
68
|
+
* Contains input options for text Editable Regions.
|
|
69
|
+
*/
|
|
70
|
+
text?: TextEditable;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export interface BlockEditable extends ImageResizeable, TextEditable {
|
|
74
|
+
/**
|
|
75
|
+
* Enables a control to wrap blocks of text in block quotes.
|
|
76
|
+
*/
|
|
77
|
+
blockquote?: boolean;
|
|
78
|
+
/**
|
|
79
|
+
* Enables a control to insert an unordered list, or to convert selected blocks of text into a unordered list.
|
|
80
|
+
*/
|
|
81
|
+
bulletedlist?: boolean;
|
|
82
|
+
/**
|
|
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.
|
|
84
|
+
*/
|
|
85
|
+
center?: string;
|
|
86
|
+
/**
|
|
87
|
+
* Enables a control to set selected text to inline code, and unselected blocks of text to code blocks.
|
|
88
|
+
*/
|
|
89
|
+
code?: boolean;
|
|
90
|
+
/**
|
|
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.
|
|
92
|
+
*/
|
|
93
|
+
embed?: boolean;
|
|
94
|
+
/**
|
|
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").
|
|
96
|
+
*/
|
|
97
|
+
format?: string;
|
|
98
|
+
/**
|
|
99
|
+
* Enables a control to insert a horizontal rule.
|
|
100
|
+
*/
|
|
101
|
+
horizontalrule?: boolean;
|
|
102
|
+
/**
|
|
103
|
+
* Enables a control to insert an image. The image can be uploaded, existing or an external link.
|
|
104
|
+
*/
|
|
105
|
+
image?: boolean;
|
|
106
|
+
/**
|
|
107
|
+
* Enables a control to increase indentation for numbered and unordered lists.
|
|
108
|
+
*/
|
|
109
|
+
indent?: boolean;
|
|
110
|
+
/**
|
|
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.
|
|
112
|
+
*/
|
|
113
|
+
justify?: string;
|
|
114
|
+
/**
|
|
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.
|
|
116
|
+
*/
|
|
117
|
+
left?: string;
|
|
118
|
+
/**
|
|
119
|
+
* Enables a control to insert a numbered list, or to convert selected blocks of text into a numbered list.
|
|
120
|
+
*/
|
|
121
|
+
numberedlist?: boolean;
|
|
122
|
+
/**
|
|
123
|
+
* Enables a control to reduce indentation for numbered and unordered lists.
|
|
124
|
+
*/
|
|
125
|
+
outdent?: boolean;
|
|
126
|
+
/**
|
|
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.
|
|
128
|
+
*/
|
|
129
|
+
right?: string;
|
|
130
|
+
/**
|
|
131
|
+
* Enables a control to insert snippets, if any are available.
|
|
132
|
+
*/
|
|
133
|
+
snippet?: boolean;
|
|
134
|
+
/**
|
|
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.
|
|
136
|
+
*/
|
|
137
|
+
styles?: string;
|
|
138
|
+
/**
|
|
139
|
+
* Enables a control to insert a table. Further options for table cells are available in the context menu for cells within the editor.
|
|
140
|
+
*/
|
|
141
|
+
table?: boolean;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
interface WithReducedPaths {
|
|
145
|
+
/**
|
|
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`.
|
|
147
|
+
*/
|
|
148
|
+
paths?: ReducedPaths;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
export interface ImageEditable extends ImageResizeable, WithReducedPaths {}
|
|
152
|
+
|
|
153
|
+
export interface LinkEditable extends WithReducedPaths {}
|
|
154
|
+
|
|
155
|
+
export interface TextEditable extends WithReducedPaths {
|
|
156
|
+
/**
|
|
157
|
+
* Enables a control to set selected text to bold.
|
|
158
|
+
*/
|
|
159
|
+
bold?: boolean;
|
|
160
|
+
/**
|
|
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.
|
|
162
|
+
*/
|
|
163
|
+
copyformatting?: boolean;
|
|
164
|
+
/**
|
|
165
|
+
* Enables a control to italicize selected text.
|
|
166
|
+
*/
|
|
167
|
+
italic?: boolean;
|
|
168
|
+
/**
|
|
169
|
+
* Enables a control to create hyperlinks around selected text.
|
|
170
|
+
*/
|
|
171
|
+
link?: boolean;
|
|
172
|
+
/**
|
|
173
|
+
* Enables a control to redo recent edits undone with undo. Redo is always enabled through standard OS-specific keyboard shortcuts.
|
|
174
|
+
*/
|
|
175
|
+
redo?: boolean;
|
|
176
|
+
/**
|
|
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.
|
|
178
|
+
*/
|
|
179
|
+
removeformat?: boolean;
|
|
180
|
+
/**
|
|
181
|
+
* Enables a control to strike selected text.
|
|
182
|
+
*/
|
|
183
|
+
strike?: boolean;
|
|
184
|
+
/**
|
|
185
|
+
* Enables a control to set selected text to subscript.
|
|
186
|
+
*/
|
|
187
|
+
subscript?: boolean;
|
|
188
|
+
/**
|
|
189
|
+
* Enables a control to set selected text to superscript.
|
|
190
|
+
*/
|
|
191
|
+
superscript?: boolean;
|
|
192
|
+
/**
|
|
193
|
+
* Enables a control to underline selected text.
|
|
194
|
+
*/
|
|
195
|
+
underline?: boolean;
|
|
196
|
+
/**
|
|
197
|
+
* Enables a control to undo recent edits. Undo is always enabled through standard OS-specific keyboard shortcuts.
|
|
198
|
+
*/
|
|
199
|
+
undo?: boolean;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
export interface ReducedCascade {
|
|
203
|
+
/**
|
|
204
|
+
* Controls the behavior and appearance of your inputs in all data editing interfaces.
|
|
205
|
+
*/
|
|
206
|
+
_inputs?: Record<string, Input>;
|
|
207
|
+
/**
|
|
208
|
+
* Fixed datasets that can be referenced by the *Values* configuration for *Select* and *Multiselect* inputs.
|
|
209
|
+
*/
|
|
210
|
+
_select_data?: Record<string, SelectValues>;
|
|
211
|
+
/**
|
|
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.
|
|
213
|
+
*/
|
|
214
|
+
_structures?: Record<string, Structure>;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
export interface Cascade extends ReducedCascade {
|
|
218
|
+
/**
|
|
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.
|
|
220
|
+
*/
|
|
221
|
+
_enabled_editors?: Array<EditorKey>;
|
|
222
|
+
/**
|
|
223
|
+
* Contains input options for Editable Regions and the Content Editor.
|
|
224
|
+
*/
|
|
225
|
+
_editables?: Editables;
|
|
226
|
+
|
|
227
|
+
_array_structures?: Record<string, unknown>; // Legacy
|
|
228
|
+
_comments?: Record<string, string>; // Legacy
|
|
229
|
+
_options?: Record<string, Record<string, unknown>>; // Legacy
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
export type InputType =
|
|
233
|
+
| 'text'
|
|
234
|
+
| 'textarea'
|
|
235
|
+
| 'email'
|
|
236
|
+
| 'disabled'
|
|
237
|
+
| 'pinterest'
|
|
238
|
+
| 'facebook'
|
|
239
|
+
| 'twitter'
|
|
240
|
+
| 'github'
|
|
241
|
+
| 'instagram'
|
|
242
|
+
| 'code'
|
|
243
|
+
| 'checkbox'
|
|
244
|
+
| 'switch'
|
|
245
|
+
| 'color'
|
|
246
|
+
| 'number'
|
|
247
|
+
| 'range'
|
|
248
|
+
| 'url'
|
|
249
|
+
| 'html'
|
|
250
|
+
| 'markdown'
|
|
251
|
+
| 'date'
|
|
252
|
+
| 'datetime'
|
|
253
|
+
| 'time'
|
|
254
|
+
| 'file'
|
|
255
|
+
| 'image'
|
|
256
|
+
| 'document'
|
|
257
|
+
| 'select'
|
|
258
|
+
| 'multiselect'
|
|
259
|
+
| 'choice'
|
|
260
|
+
| 'multichoice'
|
|
261
|
+
| 'object'
|
|
262
|
+
| 'array';
|
|
263
|
+
|
|
264
|
+
export type EmptyTypeText = 'null' | 'string';
|
|
265
|
+
export type EmptyTypeNumber = 'null' | 'number';
|
|
266
|
+
export type EmptyTypeArray = 'null' | 'array';
|
|
267
|
+
export type EmptyTypeObject = 'null' | 'object';
|
|
268
|
+
|
|
269
|
+
export interface BaseInputOptions<EmptyType = EmptyTypeText> {
|
|
270
|
+
/**
|
|
271
|
+
* Set how an ‘empty’ value will be saved. Does not apply to existing empty values.
|
|
272
|
+
*/
|
|
273
|
+
empty_type?: EmptyType;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
export interface BaseInput<InputOptions = BaseInputOptions> {
|
|
277
|
+
/**
|
|
278
|
+
* Controls the type of input, changing how it is displayed and interacted with.
|
|
279
|
+
*/
|
|
280
|
+
type?: InputType;
|
|
281
|
+
/**
|
|
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.
|
|
283
|
+
*/
|
|
284
|
+
comment?: string;
|
|
285
|
+
/**
|
|
286
|
+
* Optionally changes the text above this input.
|
|
287
|
+
*/
|
|
288
|
+
label?: string;
|
|
289
|
+
/**
|
|
290
|
+
* Toggles the visibility of this input.
|
|
291
|
+
* @default false
|
|
292
|
+
*/
|
|
293
|
+
hidden?: boolean | string;
|
|
294
|
+
/**
|
|
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.
|
|
296
|
+
*/
|
|
297
|
+
instance_value?: InstanceValue;
|
|
298
|
+
/**
|
|
299
|
+
* Specifies whether or not this input configuration should be merged with any matching, less specific configuration.
|
|
300
|
+
* @default true
|
|
301
|
+
*/
|
|
302
|
+
cascade?: boolean;
|
|
303
|
+
/**
|
|
304
|
+
* Options that are specific to this `type` of input.
|
|
305
|
+
*/
|
|
306
|
+
options?: InputOptions;
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
export interface TextInputOptions extends BaseInputOptions {
|
|
310
|
+
/**
|
|
311
|
+
* Text shown when this input has no value.
|
|
312
|
+
*/
|
|
313
|
+
placeholder?: string;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
export interface TextInput extends BaseInput<TextInputOptions> {
|
|
317
|
+
type:
|
|
318
|
+
| 'text'
|
|
319
|
+
| 'textarea'
|
|
320
|
+
| 'email'
|
|
321
|
+
| 'disabled'
|
|
322
|
+
| 'pinterest'
|
|
323
|
+
| 'facebook'
|
|
324
|
+
| 'twitter'
|
|
325
|
+
| 'github'
|
|
326
|
+
| 'instagram';
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
export interface CodeInputOptions extends BaseInputOptions, SourceEditor {
|
|
330
|
+
/**
|
|
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.
|
|
332
|
+
* @default 30
|
|
333
|
+
*/
|
|
334
|
+
max_visible_lines?: number;
|
|
335
|
+
/**
|
|
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`.
|
|
337
|
+
* @default 10
|
|
338
|
+
*/
|
|
339
|
+
min_visible_lines?: number;
|
|
340
|
+
/**
|
|
341
|
+
* Changes how the editor parses your content for syntax highlighting. Should be set to the language of the code going into the input.
|
|
342
|
+
*/
|
|
343
|
+
syntax?: Syntax;
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
export interface CodeInput extends BaseInput<CodeInputOptions> {
|
|
347
|
+
type: 'code';
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
export interface ColorInputOptions extends BaseInputOptions {
|
|
351
|
+
/**
|
|
352
|
+
* Sets what format the color value is saved as. Defaults to the naming convention, or HEX if that is unset.
|
|
353
|
+
*/
|
|
354
|
+
format?: 'rgb' | 'hex' | 'hsl' | 'hsv';
|
|
355
|
+
/**
|
|
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".
|
|
357
|
+
*/
|
|
358
|
+
alpha?: boolean;
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
export interface ColorInput extends BaseInput<ColorInputOptions> {
|
|
362
|
+
type: 'color';
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
export interface NumberInputOptions extends BaseInputOptions<EmptyTypeNumber> {
|
|
366
|
+
/**
|
|
367
|
+
* The lowest value in the range of permitted values.
|
|
368
|
+
*/
|
|
369
|
+
min?: number;
|
|
370
|
+
/**
|
|
371
|
+
* The greatest value in the range of permitted values.
|
|
372
|
+
*/
|
|
373
|
+
max?: number;
|
|
374
|
+
/**
|
|
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`.
|
|
376
|
+
*/
|
|
377
|
+
step?: number;
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
export interface NumberInput extends BaseInput<NumberInputOptions> {
|
|
381
|
+
type: 'number';
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
export interface RangeInputOptions extends NumberInputOptions {
|
|
385
|
+
min: number;
|
|
386
|
+
max: number;
|
|
387
|
+
step: number;
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
export interface RangeInput extends BaseInput<RangeInputOptions> {
|
|
391
|
+
type: 'range';
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
export interface UrlInputOptions extends BaseInputOptions, WithReducedPaths {}
|
|
395
|
+
|
|
396
|
+
export interface UrlInput extends BaseInput<UrlInputOptions> {
|
|
397
|
+
type: 'range';
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
export interface RichTextInputOptions extends BaseInputOptions, ImageResizeable, BlockEditable {
|
|
401
|
+
/**
|
|
402
|
+
* Shows or hides the resize handler to vertically resize the input.
|
|
403
|
+
*/
|
|
404
|
+
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
|
+
/**
|
|
410
|
+
* Defines the initial height of this input in pixels (px).
|
|
411
|
+
*/
|
|
412
|
+
initial_height?: number;
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
export interface RichTextInput extends BaseInput<RichTextInputOptions> {
|
|
416
|
+
type: 'html' | 'markdown';
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
export interface DateInputOptions extends BaseInputOptions {
|
|
420
|
+
/**
|
|
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`.
|
|
422
|
+
*/
|
|
423
|
+
timezone?: Timezone;
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
export interface DateInput extends BaseInput<DateInputOptions> {
|
|
427
|
+
type: 'date' | 'datetime';
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
export interface FileInputOptions extends BaseInputOptions, WithReducedPaths {
|
|
431
|
+
/**
|
|
432
|
+
* Restricts which file types are available to select or upload to this input.
|
|
433
|
+
*/
|
|
434
|
+
accepts_mime_types?: MimeType[] | '*';
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
export interface FileInput extends BaseInput<FileInputOptions> {
|
|
438
|
+
type: 'file' | 'document';
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
export interface ImageInputOptions extends FileInputOptions, ImageResizeable {}
|
|
442
|
+
|
|
443
|
+
export interface ImageInput extends BaseInput<ImageInputOptions> {
|
|
444
|
+
type: 'image';
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
export interface SelectInputOptions<EmptyType = EmptyTypeText> extends BaseInputOptions<EmptyType> {
|
|
448
|
+
/**
|
|
449
|
+
* Allows new text values to be created at edit time.
|
|
450
|
+
* @default false
|
|
451
|
+
*/
|
|
452
|
+
allow_create?: boolean;
|
|
453
|
+
/**
|
|
454
|
+
* Provides an empty option alongside the options provided by values.
|
|
455
|
+
* @default true
|
|
456
|
+
*/
|
|
457
|
+
allow_empty?: boolean;
|
|
458
|
+
/**
|
|
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).
|
|
460
|
+
*/
|
|
461
|
+
values: SelectValues;
|
|
462
|
+
/**
|
|
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.
|
|
464
|
+
*/
|
|
465
|
+
value_key: string;
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
export interface SelectInput extends BaseInput<SelectInputOptions> {
|
|
469
|
+
type: 'select';
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
export interface MultiselectInputOptions extends SelectInputOptions<EmptyTypeArray> {}
|
|
473
|
+
|
|
474
|
+
export interface MultiselectInput extends BaseInput<MultiselectInputOptions> {
|
|
475
|
+
type: 'multiselect';
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
export interface ChoiceInputOptions<EmptyType = EmptyTypeText>
|
|
479
|
+
extends Omit<SelectInputOptions<EmptyType>, 'allow_create'> {
|
|
480
|
+
/**
|
|
481
|
+
* The preview definition for changing the way selected and available options are displayed.
|
|
482
|
+
*/
|
|
483
|
+
preview: SelectPreview;
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
export interface ChoiceInput extends BaseInput<ChoiceInputOptions> {
|
|
487
|
+
type: 'choice';
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
export interface MultichoiceInputOptions extends ChoiceInputOptions<EmptyTypeArray> {}
|
|
491
|
+
|
|
492
|
+
export interface MultichoiceInput extends BaseInput<MultichoiceInputOptions> {
|
|
493
|
+
type: 'multichoice';
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
export interface ObjectInputOptions extends BaseInputOptions<EmptyTypeObject> {
|
|
497
|
+
/**
|
|
498
|
+
* Changes the appearance and behavior of the input.
|
|
499
|
+
*/
|
|
500
|
+
subtype?: 'object' | 'mutable';
|
|
501
|
+
/**
|
|
502
|
+
* Contains options for the "mutable" subtype.
|
|
503
|
+
*/
|
|
504
|
+
entries?: {
|
|
505
|
+
/**
|
|
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.
|
|
507
|
+
*/
|
|
508
|
+
allowed_keys?: string[];
|
|
509
|
+
/**
|
|
510
|
+
* Limits available structures to specified keys.
|
|
511
|
+
*/
|
|
512
|
+
assigned_structures?: Record<string, string[]>;
|
|
513
|
+
/**
|
|
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.
|
|
515
|
+
*/
|
|
516
|
+
structures?: string | Structure;
|
|
517
|
+
};
|
|
518
|
+
/**
|
|
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.
|
|
520
|
+
*/
|
|
521
|
+
preview?: ObjectPreview;
|
|
522
|
+
/**
|
|
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.
|
|
524
|
+
*/
|
|
525
|
+
structures?: string | Structure;
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
export interface ObjectInput extends BaseInput<ObjectInputOptions> {
|
|
529
|
+
type: 'object';
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
export interface ArrayInputOptions extends BaseInputOptions<EmptyTypeArray> {
|
|
533
|
+
/**
|
|
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.
|
|
535
|
+
*/
|
|
536
|
+
preview?: ObjectPreview;
|
|
537
|
+
/**
|
|
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.
|
|
539
|
+
*/
|
|
540
|
+
structures?: string | Structure;
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
export interface ArrayInput extends BaseInput<ArrayInputOptions> {
|
|
544
|
+
type: 'array';
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
export type Input =
|
|
548
|
+
| BaseInput
|
|
549
|
+
| TextInput
|
|
550
|
+
| CodeInput
|
|
551
|
+
| ColorInput
|
|
552
|
+
| NumberInput
|
|
553
|
+
| RangeInput
|
|
554
|
+
| UrlInput
|
|
555
|
+
| RichTextInput
|
|
556
|
+
| DateInput
|
|
557
|
+
| FileInput
|
|
558
|
+
| ImageInput
|
|
559
|
+
| SelectInput
|
|
560
|
+
| MultiselectInput
|
|
561
|
+
| ChoiceInput
|
|
562
|
+
| MultichoiceInput
|
|
563
|
+
| ObjectInput
|
|
564
|
+
| ArrayInput;
|
|
565
|
+
|
|
566
|
+
export interface ReducedPaths {
|
|
567
|
+
/**
|
|
568
|
+
* Default location of newly uploaded site files.
|
|
569
|
+
* @default 'uploads'
|
|
570
|
+
*/
|
|
571
|
+
uploads?: string;
|
|
572
|
+
/**
|
|
573
|
+
* Filename template for newly uploaded site files.
|
|
574
|
+
*/
|
|
575
|
+
uploads_filename?: string;
|
|
576
|
+
/**
|
|
577
|
+
* Default location of newly uploaded DAM files.
|
|
578
|
+
* @default ''
|
|
579
|
+
*/
|
|
580
|
+
dam_uploads?: string;
|
|
581
|
+
/**
|
|
582
|
+
* Filename template for newly uploaded DAM files.
|
|
583
|
+
*/
|
|
584
|
+
dam_uploads_filename?: string;
|
|
585
|
+
/**
|
|
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.
|
|
587
|
+
* @default ''
|
|
588
|
+
*/
|
|
589
|
+
dam_static?: string;
|
|
590
|
+
}
|
|
591
|
+
|
|
592
|
+
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
|
+
/**
|
|
598
|
+
* Parent folder of all collections.
|
|
599
|
+
* @default ''
|
|
600
|
+
*/
|
|
601
|
+
collections?: string;
|
|
602
|
+
/**
|
|
603
|
+
* Parent folder of all site data files.
|
|
604
|
+
*/
|
|
605
|
+
data?: string;
|
|
606
|
+
/**
|
|
607
|
+
* Parent folder of all site layout files. *Only applies to Jekyll, Hugo, and Eleventy sites*.
|
|
608
|
+
*/
|
|
609
|
+
layouts?: string;
|
|
610
|
+
/**
|
|
611
|
+
* Parent folder of all includes, partials, or shortcode files. *Only applies to Jekyll, Hugo, and Eleventy sites*.
|
|
612
|
+
*/
|
|
613
|
+
includes?: string;
|
|
614
|
+
}
|
|
615
|
+
|
|
616
|
+
export type FilterBase = 'none' | 'all' | 'strict';
|
|
617
|
+
|
|
618
|
+
export interface Filter {
|
|
619
|
+
/**
|
|
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.
|
|
621
|
+
*/
|
|
622
|
+
base?: FilterBase;
|
|
623
|
+
/**
|
|
624
|
+
* Add to the visible files set with `base`. Paths must be relative to the containing collection `path`.
|
|
625
|
+
*/
|
|
626
|
+
include?: string[];
|
|
627
|
+
/**
|
|
628
|
+
* Remove from the visible files set with `base`. Paths must be relative to the containing collection `path`.
|
|
629
|
+
*/
|
|
630
|
+
exclude?: string[];
|
|
631
|
+
}
|
|
632
|
+
|
|
633
|
+
export interface Documentation {
|
|
634
|
+
/**
|
|
635
|
+
* The "href" value of the link.
|
|
636
|
+
*/
|
|
637
|
+
url: string;
|
|
638
|
+
/**
|
|
639
|
+
* The visible text used in the link.
|
|
640
|
+
*/
|
|
641
|
+
text?: string;
|
|
642
|
+
/**
|
|
643
|
+
* The icon displayed next to the link.
|
|
644
|
+
*/
|
|
645
|
+
icon?: Icon;
|
|
646
|
+
}
|
|
647
|
+
|
|
648
|
+
interface PreviewKeyEntry {
|
|
649
|
+
/**
|
|
650
|
+
* The key used to access the value used for the preview.
|
|
651
|
+
*/
|
|
652
|
+
key: string;
|
|
653
|
+
}
|
|
654
|
+
|
|
655
|
+
type PreviewEntry = Array<PreviewKeyEntry | string | boolean> | string | boolean;
|
|
656
|
+
|
|
657
|
+
interface TextPreviewable {
|
|
658
|
+
/**
|
|
659
|
+
* Controls the main text shown per item.
|
|
660
|
+
*/
|
|
661
|
+
text?: PreviewEntry;
|
|
662
|
+
}
|
|
663
|
+
|
|
664
|
+
interface ImagePreviewable {
|
|
665
|
+
/**
|
|
666
|
+
* Controls the image shown per item.
|
|
667
|
+
*/
|
|
668
|
+
image?: PreviewEntry;
|
|
669
|
+
}
|
|
670
|
+
|
|
671
|
+
interface SubtextPreviewable {
|
|
672
|
+
/**
|
|
673
|
+
* Controls the supporting text shown per item.
|
|
674
|
+
*/
|
|
675
|
+
subtext?: PreviewEntry;
|
|
676
|
+
}
|
|
677
|
+
|
|
678
|
+
interface IconPreviewable {
|
|
679
|
+
/**
|
|
680
|
+
* Controls the icon shown per item. Must result in a Material Icon name.
|
|
681
|
+
*/
|
|
682
|
+
icon?: PreviewEntry;
|
|
683
|
+
}
|
|
684
|
+
|
|
685
|
+
interface IconColorPreviewable {
|
|
686
|
+
/**
|
|
687
|
+
* Controls the color of the icon.
|
|
688
|
+
*/
|
|
689
|
+
icon_color?: string;
|
|
690
|
+
}
|
|
691
|
+
|
|
692
|
+
export interface PreviewGallery
|
|
693
|
+
extends TextPreviewable,
|
|
694
|
+
ImagePreviewable,
|
|
695
|
+
IconPreviewable,
|
|
696
|
+
IconColorPreviewable {
|
|
697
|
+
/**
|
|
698
|
+
* Controls how the gallery image is positioned within the gallery.
|
|
699
|
+
*/
|
|
700
|
+
fit?: 'padded' | 'cover' | 'contain' | 'cover-top';
|
|
701
|
+
}
|
|
702
|
+
|
|
703
|
+
export interface PreviewMetadata
|
|
704
|
+
extends TextPreviewable,
|
|
705
|
+
ImagePreviewable,
|
|
706
|
+
IconPreviewable,
|
|
707
|
+
IconColorPreviewable {}
|
|
708
|
+
|
|
709
|
+
export interface ObjectPreview
|
|
710
|
+
extends TextPreviewable,
|
|
711
|
+
ImagePreviewable,
|
|
712
|
+
IconPreviewable,
|
|
713
|
+
SubtextPreviewable {}
|
|
714
|
+
|
|
715
|
+
export interface SelectPreview extends TextPreviewable, IconPreviewable {}
|
|
716
|
+
|
|
717
|
+
export interface Preview
|
|
718
|
+
extends TextPreviewable,
|
|
719
|
+
ImagePreviewable,
|
|
720
|
+
IconPreviewable,
|
|
721
|
+
IconColorPreviewable,
|
|
722
|
+
SubtextPreviewable {
|
|
723
|
+
/**
|
|
724
|
+
* Defines a list of items that can contain an image, icon, and text.
|
|
725
|
+
*/
|
|
726
|
+
metadata?: PreviewMetadata[];
|
|
727
|
+
/**
|
|
728
|
+
* Details for large image/icon preview per item.
|
|
729
|
+
*/
|
|
730
|
+
gallery?: PreviewGallery;
|
|
731
|
+
}
|
|
732
|
+
|
|
733
|
+
export interface AddOption {
|
|
734
|
+
/**
|
|
735
|
+
* The text displayed for the menu item. Defaults to using name from the matching schema if set.
|
|
736
|
+
*/
|
|
737
|
+
name?: string;
|
|
738
|
+
/**
|
|
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.
|
|
740
|
+
*/
|
|
741
|
+
icon?: Icon;
|
|
742
|
+
/**
|
|
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.
|
|
744
|
+
*/
|
|
745
|
+
editor?: EditorKey;
|
|
746
|
+
/**
|
|
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.
|
|
748
|
+
*/
|
|
749
|
+
base_path?: string;
|
|
750
|
+
/**
|
|
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.
|
|
752
|
+
*/
|
|
753
|
+
collection?: string;
|
|
754
|
+
/**
|
|
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.
|
|
756
|
+
*/
|
|
757
|
+
schema?: string;
|
|
758
|
+
/**
|
|
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.
|
|
760
|
+
*/
|
|
761
|
+
default_content_file?: string;
|
|
762
|
+
}
|
|
763
|
+
|
|
764
|
+
interface Previewable {
|
|
765
|
+
/**
|
|
766
|
+
* Changes the way items are previewed in the CMS.
|
|
767
|
+
*/
|
|
768
|
+
preview?: Preview;
|
|
769
|
+
}
|
|
770
|
+
|
|
771
|
+
export interface Schema extends Cascade, Previewable, Schemalike {
|
|
772
|
+
/**
|
|
773
|
+
* The path to the schema file. Relative to the root folder of the site.
|
|
774
|
+
*/
|
|
775
|
+
path: string;
|
|
776
|
+
/**
|
|
777
|
+
* Displayed in the add menu when creating new files. Defaults to a formatted version of the key.
|
|
778
|
+
*/
|
|
779
|
+
name?: string;
|
|
780
|
+
/**
|
|
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"
|
|
783
|
+
*/
|
|
784
|
+
icon?: Icon;
|
|
785
|
+
/**
|
|
786
|
+
* Controls where new files are saved.
|
|
787
|
+
*/
|
|
788
|
+
create?: Create;
|
|
789
|
+
/**
|
|
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.
|
|
791
|
+
*/
|
|
792
|
+
new_preview_url?: string;
|
|
793
|
+
}
|
|
794
|
+
|
|
795
|
+
export interface Sort {
|
|
796
|
+
key: string;
|
|
797
|
+
order?: SortOrder;
|
|
798
|
+
}
|
|
799
|
+
|
|
800
|
+
export interface SortOption extends Sort {
|
|
801
|
+
label?: string;
|
|
802
|
+
}
|
|
803
|
+
|
|
804
|
+
export interface Create extends ReducedCascade {
|
|
805
|
+
path: string;
|
|
806
|
+
extra_data?: Record<string, string>;
|
|
807
|
+
publish_to?: string;
|
|
808
|
+
}
|
|
809
|
+
|
|
810
|
+
export interface CollectionConfig extends Cascade, Previewable {
|
|
811
|
+
path?: string;
|
|
812
|
+
output?: boolean;
|
|
813
|
+
url?: string;
|
|
814
|
+
filter?: Filter | FilterBase;
|
|
815
|
+
name?: string;
|
|
816
|
+
description?: string;
|
|
817
|
+
icon?: Icon;
|
|
818
|
+
documentation?: Documentation;
|
|
819
|
+
sort?: Sort;
|
|
820
|
+
sort_options?: SortOption[];
|
|
821
|
+
singular_name?: string;
|
|
822
|
+
singular_key?: string;
|
|
823
|
+
/**
|
|
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.
|
|
825
|
+
*/
|
|
826
|
+
add_options?: AddOption[];
|
|
827
|
+
create?: Create;
|
|
828
|
+
disable_add?: boolean;
|
|
829
|
+
disable_add_folder?: boolean;
|
|
830
|
+
disable_file_actions?: boolean;
|
|
831
|
+
new_preview_url?: string;
|
|
832
|
+
schemas?: Record<string, Schema>;
|
|
833
|
+
schema_key?: string;
|
|
834
|
+
}
|
|
835
|
+
|
|
836
|
+
export interface CollectionGroup {
|
|
837
|
+
heading: string;
|
|
838
|
+
collections: string[];
|
|
839
|
+
}
|
|
840
|
+
|
|
841
|
+
interface Schemalike {
|
|
842
|
+
/**
|
|
843
|
+
* If true, inputs are sorted to match when editing. Extra inputs are ordered after expected inputs, unless `remove_extra_inputs` is true.
|
|
844
|
+
* @default true
|
|
845
|
+
*/
|
|
846
|
+
reorder_inputs?: boolean;
|
|
847
|
+
/**
|
|
848
|
+
* Hides unexpected inputs when editing. Has no effect if `remove_extra_inputs` is true.
|
|
849
|
+
* @default false
|
|
850
|
+
*/
|
|
851
|
+
hide_extra_inputs?: boolean;
|
|
852
|
+
/**
|
|
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.
|
|
854
|
+
* @default false
|
|
855
|
+
*/
|
|
856
|
+
remove_empty_inputs?: boolean;
|
|
857
|
+
/**
|
|
858
|
+
* If checked, extra inputs are removed when editing.
|
|
859
|
+
* @default true
|
|
860
|
+
*/
|
|
861
|
+
remove_extra_inputs?: boolean;
|
|
862
|
+
}
|
|
863
|
+
|
|
864
|
+
export interface Structure extends Schemalike {
|
|
865
|
+
values: Array<StructureValue>;
|
|
866
|
+
id_key?: string;
|
|
867
|
+
style?: 'select' | 'modal';
|
|
868
|
+
}
|
|
869
|
+
|
|
870
|
+
export interface StructureValue extends Previewable, Schemalike {
|
|
871
|
+
id?: string;
|
|
872
|
+
default?: boolean;
|
|
873
|
+
description?: string;
|
|
874
|
+
icon?: Icon;
|
|
875
|
+
image?: string;
|
|
876
|
+
label?: string;
|
|
877
|
+
picker_preview?: Preview;
|
|
878
|
+
tags?: string[];
|
|
879
|
+
value: any;
|
|
880
|
+
}
|
|
881
|
+
|
|
882
|
+
export type SelectValues =
|
|
883
|
+
| Array<string>
|
|
884
|
+
| Record<string, string>
|
|
885
|
+
| Record<string, Record<string, any>>;
|
|
886
|
+
|
|
887
|
+
export interface DataConfigEntry {
|
|
888
|
+
path: string;
|
|
889
|
+
parser?: 'csv' | 'front-matter' | 'json' | 'properties' | 'toml' | 'yaml';
|
|
890
|
+
}
|
|
891
|
+
|
|
892
|
+
export interface Editor {
|
|
893
|
+
default_path: string;
|
|
894
|
+
}
|
|
895
|
+
|
|
896
|
+
export interface SourceEditor {
|
|
897
|
+
/**
|
|
898
|
+
* Defines how many spaces lines are auto indented by, and/or how many spaces tabs are shown as.
|
|
899
|
+
* @default 2
|
|
900
|
+
*/
|
|
901
|
+
tab_size?: number;
|
|
902
|
+
/**
|
|
903
|
+
* Changes the color scheme for syntax highlighting in the editor.
|
|
904
|
+
* @default monokai
|
|
905
|
+
*/
|
|
906
|
+
theme?: string;
|
|
907
|
+
/**
|
|
908
|
+
* Toggles displaying line numbers and code folding controls in the editor.
|
|
909
|
+
* @default true
|
|
910
|
+
*/
|
|
911
|
+
show_gutter?: boolean;
|
|
912
|
+
}
|
|
913
|
+
|
|
914
|
+
export interface DefaultConfiguration extends Cascade {
|
|
915
|
+
source?: string;
|
|
916
|
+
output?: string;
|
|
917
|
+
paths?: Paths;
|
|
918
|
+
collections_config?: Record<string, CollectionConfig>;
|
|
919
|
+
collection_groups?: Array<CollectionGroup>;
|
|
920
|
+
base_url?: string;
|
|
921
|
+
data_config?: Record<string, DataConfigEntry>;
|
|
922
|
+
editor?: Editor;
|
|
923
|
+
source_editor?: SourceEditor;
|
|
924
|
+
/**
|
|
925
|
+
* @default Etc/UTC
|
|
926
|
+
*/
|
|
927
|
+
timezone?: Timezone;
|
|
928
|
+
}
|
|
929
|
+
|
|
930
|
+
export interface HugoCollectionConfig extends CollectionConfig {
|
|
931
|
+
parse_branch_index?: boolean;
|
|
932
|
+
}
|
|
933
|
+
|
|
934
|
+
export interface HugoConfiguration extends Omit<DefaultConfiguration, 'output' | 'data_config'> {
|
|
935
|
+
collections_config?: Record<string, HugoCollectionConfig>;
|
|
936
|
+
data_config?: Record<string, boolean>;
|
|
937
|
+
}
|
|
938
|
+
|
|
939
|
+
export interface JekyllConfiguration extends Omit<DefaultConfiguration, 'output' | 'data_config'> {
|
|
940
|
+
data_config?: Record<string, boolean>;
|
|
941
|
+
}
|
|
942
|
+
|
|
943
|
+
export interface EleventyConfiguration
|
|
944
|
+
extends Omit<DefaultConfiguration, 'output' | 'data_config'> {
|
|
945
|
+
data_config?: Record<string, boolean>;
|
|
946
|
+
}
|
|
947
|
+
|
|
948
|
+
export type Configuration =
|
|
949
|
+
| DefaultConfiguration
|
|
950
|
+
| HugoConfiguration
|
|
951
|
+
| JekyllConfiguration
|
|
952
|
+
| EleventyConfiguration;
|