@cloudcannon/configuration-types 0.0.36 → 0.0.38
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/dist/cloudcannon-config.latest.schema.json +9352 -10975
- package/dist/cloudcannon-config.legacy-eleventy.schema.json +9476 -11093
- package/dist/cloudcannon-config.legacy-hugo.schema.json +9424 -11046
- package/dist/cloudcannon-config.legacy-jekyll.schema.json +9476 -11093
- package/dist/cloudcannon-config.legacy-reader.schema.json +5882 -7507
- package/package.json +19 -21
- package/src/build-coupled.ts +295 -0
- package/src/cascade.ts +38 -0
- package/src/configuration.ts +421 -0
- package/src/documentation.ts +22 -0
- package/src/editables.ts +243 -0
- package/src/icon.ts +3597 -0
- package/src/image-options.ts +72 -0
- package/src/index.ts +40 -0
- package/src/inputs.ts +993 -0
- package/src/markdown.ts +97 -0
- package/src/mimetype.ts +445 -0
- package/src/paths.ts +43 -0
- package/src/preview.ts +125 -0
- package/src/select-values.ts +26 -0
- package/src/snippets.ts +113 -0
- package/src/source-editor.ts +68 -0
- package/src/structures.ts +120 -0
- package/src/syntax.ts +183 -0
- package/src/timezone.ts +607 -0
- package/src/build-coupled.d.ts +0 -315
- package/src/cascade.d.ts +0 -37
- package/src/cloudcannon-config.schema.json +0 -79
- package/src/configuration.d.ts +0 -750
- package/src/documentation.d.ts +0 -18
- package/src/editables.d.ts +0 -252
- package/src/icon.d.ts +0 -3585
- package/src/image-resizeable.d.ts +0 -65
- package/src/index.d.ts +0 -36
- package/src/inputs.d.ts +0 -1648
- package/src/javascript-api.d.ts +0 -204
- package/src/markdown.d.ts +0 -103
- package/src/paths.d.ts +0 -44
- package/src/preview.d.ts +0 -110
- package/src/select-values.d.ts +0 -6
- package/src/snippets.d.ts +0 -227
- package/src/source-editor.d.ts +0 -92
- package/src/structures.d.ts +0 -113
- package/src/timezone.d.ts +0 -596
package/src/inputs.ts
ADDED
|
@@ -0,0 +1,993 @@
|
|
|
1
|
+
import * as z from 'zod';
|
|
2
|
+
import { DocumentationSchema } from './documentation';
|
|
3
|
+
import { BlockEditableSchema } from './editables';
|
|
4
|
+
import { IconSchema } from './icon';
|
|
5
|
+
import { ImageOptionsSchema } from './image-options';
|
|
6
|
+
import { MimeTypeSchema } from './mimetype';
|
|
7
|
+
import { PathsSchema } from './paths';
|
|
8
|
+
import {
|
|
9
|
+
IconBackgroundColorSchema,
|
|
10
|
+
IconColorSchema,
|
|
11
|
+
PickerPreviewSchema,
|
|
12
|
+
PreviewSchema,
|
|
13
|
+
} from './preview';
|
|
14
|
+
import { SelectDataValuesSchema } from './select-values';
|
|
15
|
+
import { SourceEditorSchema } from './source-editor';
|
|
16
|
+
import { StructureSchema } from './structures';
|
|
17
|
+
import { SyntaxSchema } from './syntax';
|
|
18
|
+
import { TimezoneSchema } from './timezone';
|
|
19
|
+
|
|
20
|
+
export const InputTypeSchema = z
|
|
21
|
+
.enum([
|
|
22
|
+
'text',
|
|
23
|
+
'textarea',
|
|
24
|
+
'email',
|
|
25
|
+
'disabled',
|
|
26
|
+
'pinterest',
|
|
27
|
+
'facebook',
|
|
28
|
+
'twitter',
|
|
29
|
+
'github',
|
|
30
|
+
'instagram',
|
|
31
|
+
'code',
|
|
32
|
+
'checkbox',
|
|
33
|
+
'switch',
|
|
34
|
+
'color',
|
|
35
|
+
'number',
|
|
36
|
+
'range',
|
|
37
|
+
'url',
|
|
38
|
+
'html',
|
|
39
|
+
'markdown',
|
|
40
|
+
'date',
|
|
41
|
+
'datetime',
|
|
42
|
+
'time',
|
|
43
|
+
'file',
|
|
44
|
+
'image',
|
|
45
|
+
'document',
|
|
46
|
+
'select',
|
|
47
|
+
'multiselect',
|
|
48
|
+
'choice',
|
|
49
|
+
'multichoice',
|
|
50
|
+
'object',
|
|
51
|
+
'array',
|
|
52
|
+
'auto',
|
|
53
|
+
])
|
|
54
|
+
.meta({
|
|
55
|
+
title: 'Input Type',
|
|
56
|
+
description: 'The available input types.',
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
const typeMeta = {
|
|
60
|
+
title: 'Type',
|
|
61
|
+
description: 'Sets an input type, which controls how this input appears and behaves.',
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
const RequiredValidationSchema = z.object({
|
|
65
|
+
required: z.boolean().default(false).optional().meta({
|
|
66
|
+
id: 'required',
|
|
67
|
+
description:
|
|
68
|
+
'This key toggles whether CloudCannon requires this Input to have a value. If set to true, CloudCannon will require you to enter a value to save your changes, or discard your unsaved changes.',
|
|
69
|
+
}),
|
|
70
|
+
required_message: z.string().optional().meta({
|
|
71
|
+
id: 'required_message',
|
|
72
|
+
description:
|
|
73
|
+
'This key defines the message that explains why an Input is required. This key requires you to define `options.required`.',
|
|
74
|
+
}),
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
const TextValidationSchema = z.object({
|
|
78
|
+
max_length: z.number().optional().meta({
|
|
79
|
+
id: 'max_length',
|
|
80
|
+
description:
|
|
81
|
+
'This key defines the maximum string length, in characters, that CloudCannon will allow in an Input. When configured, CloudCannon will warn you when an Input value is too long. If the Input already contains a longer value, CloudCannon will require you to remove characters until the Input contains a valid string to save your changes, or discard your unsaved changes.',
|
|
82
|
+
}),
|
|
83
|
+
max_length_message: z.string().optional().meta({
|
|
84
|
+
id: 'max_length_message',
|
|
85
|
+
description:
|
|
86
|
+
'This key defines the message that explains which maximum string length an Input will accept. This key requires you to define `options.max_length`.',
|
|
87
|
+
}),
|
|
88
|
+
min_length: z.number().optional().meta({
|
|
89
|
+
id: 'min_length',
|
|
90
|
+
description:
|
|
91
|
+
'This key defines the minimum string length, in characters, that CloudCannon will allow in an Input. When configured, CloudCannon will warn you when an Input value is too short. If the Input already contains a shorter value, CloudCannon will require you to add characters until the Input contains a valid string to save your changes, or discard your unsaved changes.',
|
|
92
|
+
}),
|
|
93
|
+
min_length_message: z.string().optional().meta({
|
|
94
|
+
id: 'min_length_message',
|
|
95
|
+
description:
|
|
96
|
+
'This key defines the message that explains which minimum string length an Input will accept. This key requires you to define `options.min_length`.',
|
|
97
|
+
}),
|
|
98
|
+
pattern: z.string().optional().meta({
|
|
99
|
+
id: 'pattern',
|
|
100
|
+
description:
|
|
101
|
+
'This key defines a regular expression that the Input value must match. When configured, CloudCannon will require you to enter a value that matches the REGEX pattern. If the Input already contains an invalid value, CloudCannon will require you to enter a valid string to save your changes, or discard your unsaved changes.',
|
|
102
|
+
}),
|
|
103
|
+
pattern_message: z.string().optional().meta({
|
|
104
|
+
id: 'pattern_message',
|
|
105
|
+
description:
|
|
106
|
+
'This key defines the message that explains which regular expression an Input will accept. This key requires you to define `options.pattern`.',
|
|
107
|
+
}),
|
|
108
|
+
pattern_flags: z
|
|
109
|
+
.object({
|
|
110
|
+
global: z.boolean().optional().meta({
|
|
111
|
+
description: '`g` - Search globally.',
|
|
112
|
+
}),
|
|
113
|
+
ignore_case: z.boolean().optional().meta({
|
|
114
|
+
description: '`i` - Case-insensitive.',
|
|
115
|
+
}),
|
|
116
|
+
multiline: z.boolean().optional().meta({
|
|
117
|
+
description:
|
|
118
|
+
'`m` - `^` and `$` match the start and end of each line rather than the entire string.',
|
|
119
|
+
}),
|
|
120
|
+
dot_all: z.boolean().optional().meta({
|
|
121
|
+
description: '`s` - `.` matches newline characters.',
|
|
122
|
+
}),
|
|
123
|
+
unicode: z.boolean().optional().meta({
|
|
124
|
+
description: '`u` - Pattern is treated as a sequence of Unicode code points.',
|
|
125
|
+
}),
|
|
126
|
+
unicode_sets: z.boolean().optional().meta({
|
|
127
|
+
description: '`v` - Extended `unicode` mode.',
|
|
128
|
+
}),
|
|
129
|
+
})
|
|
130
|
+
.optional()
|
|
131
|
+
.meta({
|
|
132
|
+
id: 'pattern_flags',
|
|
133
|
+
description:
|
|
134
|
+
'This key defines the flags (e.g. case-insensitive searching) for the regular expression set in `options.pattern`.',
|
|
135
|
+
}),
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
const ArrayValidationSchema = z.object({
|
|
139
|
+
max_items: z.number().optional().meta({
|
|
140
|
+
id: 'max_items',
|
|
141
|
+
description:
|
|
142
|
+
'This key defines the maximum number of items CloudCannon will allow in an Input. When configured, CloudCannon will prevent you from adding more items to this Input. If the Input already contains more items, CloudCannon will require you to remove items until the Input contains a valid number to save your changes, or discard your unsaved changes.',
|
|
143
|
+
}),
|
|
144
|
+
max_items_message: z.string().optional().meta({
|
|
145
|
+
id: 'max_items_message',
|
|
146
|
+
description:
|
|
147
|
+
'This key defines the message that explains why an Input needs to have a maximum number of items. This key requires you to define `options.max_items`.',
|
|
148
|
+
}),
|
|
149
|
+
min_items: z.number().optional().meta({
|
|
150
|
+
id: 'min_items',
|
|
151
|
+
description:
|
|
152
|
+
'This key defines the minimum number of items CloudCannon will allow in an Input. When configured, CloudCannon will prevent you from removing items from this Input below this value. If the Input already contains fewer items, CloudCannon will require you to add items until the Input contains a valid number to save your changes, or discard your unsaved changes.',
|
|
153
|
+
}),
|
|
154
|
+
min_items_message: z.string().optional().meta({
|
|
155
|
+
id: 'min_items_message',
|
|
156
|
+
description:
|
|
157
|
+
'This key defines the message that explains why an Input needs to have a minimum number of items. This key requires you to define `options.min_items`.',
|
|
158
|
+
}),
|
|
159
|
+
unique_on: z.string().optional().meta({
|
|
160
|
+
id: 'unique_on',
|
|
161
|
+
description:
|
|
162
|
+
'This key defines the JSON Path selector that CloudCannon should use to determine if the value of an Input is unique. When configured, CloudCannon will require the value of the Input to be unique compared to the value defined on the JSON Path. If the Input already contains a non-unique value, CloudCannon will require you to change it to a valid value to save your changes, or discard your unsaved changes.',
|
|
163
|
+
}),
|
|
164
|
+
unique_on_message: z.string().optional().meta({
|
|
165
|
+
id: 'unique_on_message',
|
|
166
|
+
description:
|
|
167
|
+
'This key defines the message that explains why an Input needs to be unique. This key requires you to define `options.unique_on`.',
|
|
168
|
+
}),
|
|
169
|
+
});
|
|
170
|
+
|
|
171
|
+
const ArrayControlOptionsSchema = z.object({
|
|
172
|
+
disable_add: z.boolean().default(false).meta({
|
|
173
|
+
id: 'ArrayInput.disable_add',
|
|
174
|
+
description:
|
|
175
|
+
'Hides the add button, and context menu actions on each item for adding new items to this Input.',
|
|
176
|
+
}),
|
|
177
|
+
disable_remove: z.boolean().default(false).meta({
|
|
178
|
+
id: 'disable_remove',
|
|
179
|
+
description: 'Hides the context menu actions on each item for removing them.',
|
|
180
|
+
}),
|
|
181
|
+
disable_reorder: z.boolean().default(false).meta({
|
|
182
|
+
id: 'disable_reorder',
|
|
183
|
+
description: 'Hides the controls on each item for moving them.',
|
|
184
|
+
}),
|
|
185
|
+
});
|
|
186
|
+
|
|
187
|
+
const EmptyTypeTextSchema = z.enum(['null', 'string']).default('null').meta({
|
|
188
|
+
id: 'empty_type_text',
|
|
189
|
+
description: 'Set how an ‘empty’ value will be saved. Does not apply to existing empty values.',
|
|
190
|
+
});
|
|
191
|
+
|
|
192
|
+
const EmptyTypeNumberSchema = z.enum(['null', 'number']).default('null').meta({
|
|
193
|
+
id: 'empty_type_number',
|
|
194
|
+
description: 'Set how an ‘empty’ value will be saved. Does not apply to existing empty values.',
|
|
195
|
+
});
|
|
196
|
+
|
|
197
|
+
const EmptyTypeObjectSchema = z.enum(['null', 'object']).default('null').meta({
|
|
198
|
+
id: 'empty_type_object',
|
|
199
|
+
description: 'Set how an ‘empty’ value will be saved. Does not apply to existing empty values.',
|
|
200
|
+
});
|
|
201
|
+
|
|
202
|
+
const EmptyTypeArraySchema = z.enum(['null', 'array']).default('null').meta({
|
|
203
|
+
id: 'empty_type_array',
|
|
204
|
+
description: 'Set how an ‘empty’ value will be saved. Does not apply to existing empty values.',
|
|
205
|
+
});
|
|
206
|
+
|
|
207
|
+
export const ContextSchema = z
|
|
208
|
+
.object({
|
|
209
|
+
content: z.string().optional().meta({
|
|
210
|
+
description: 'The rich text content shown when opened. Supports a limited set of Markdown.',
|
|
211
|
+
}),
|
|
212
|
+
open: z.boolean().default(false).optional().meta({
|
|
213
|
+
description: 'Makes the content visible initially.',
|
|
214
|
+
}),
|
|
215
|
+
title: z.string().optional().meta({
|
|
216
|
+
description: 'The text shown when not open. Defaults to "Context" if unset.',
|
|
217
|
+
}),
|
|
218
|
+
icon: IconSchema.optional().meta({
|
|
219
|
+
description: 'The icon shown when not open. Defaults to "auto_stories" if unset.',
|
|
220
|
+
}),
|
|
221
|
+
})
|
|
222
|
+
.meta({
|
|
223
|
+
id: 'context',
|
|
224
|
+
description: 'Adds an expandable section of rich text below the input.',
|
|
225
|
+
});
|
|
226
|
+
|
|
227
|
+
export const BaseInputSchema = z.object({
|
|
228
|
+
comment: z.string().optional().meta({
|
|
229
|
+
id: 'comment',
|
|
230
|
+
description:
|
|
231
|
+
'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.',
|
|
232
|
+
}),
|
|
233
|
+
context: ContextSchema.optional(),
|
|
234
|
+
documentation: DocumentationSchema.optional().meta({
|
|
235
|
+
description: 'Provides a custom link for documentation for editors shown above input.',
|
|
236
|
+
}),
|
|
237
|
+
label: z.string().optional().meta({
|
|
238
|
+
id: 'label',
|
|
239
|
+
description: 'Optionally changes the text above this input.',
|
|
240
|
+
}),
|
|
241
|
+
hidden: z.boolean().default(false).optional().meta({
|
|
242
|
+
id: 'hidden',
|
|
243
|
+
description: 'Toggles the visibility of this input.',
|
|
244
|
+
}),
|
|
245
|
+
disabled: z.boolean().default(false).optional().meta({
|
|
246
|
+
id: 'disabled',
|
|
247
|
+
description: 'Toggles if this input can be edited.',
|
|
248
|
+
}),
|
|
249
|
+
instance_value: z.enum(['UUID', 'NOW']).optional().meta({
|
|
250
|
+
id: 'instance_value',
|
|
251
|
+
title: 'Instance Value',
|
|
252
|
+
description:
|
|
253
|
+
'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.',
|
|
254
|
+
}),
|
|
255
|
+
disable_instance_value_rehydration: z.boolean().default(false).optional().meta({
|
|
256
|
+
id: 'disable_instance_value_rehydration',
|
|
257
|
+
description:
|
|
258
|
+
'Prevents the default where inputs configured with an `instance_value` are rehydrated with a new value when duplicated in the CMS.',
|
|
259
|
+
}),
|
|
260
|
+
cascade: z.boolean().default(false).optional().meta({
|
|
261
|
+
id: 'cascade',
|
|
262
|
+
description:
|
|
263
|
+
'Specifies whether or not this input configuration should be merged with any matching, less specific configuration.',
|
|
264
|
+
}),
|
|
265
|
+
});
|
|
266
|
+
|
|
267
|
+
export const TextInputOptionsSchema = z
|
|
268
|
+
.object({
|
|
269
|
+
...TextValidationSchema.shape,
|
|
270
|
+
...RequiredValidationSchema.shape,
|
|
271
|
+
empty_type: EmptyTypeTextSchema.optional(),
|
|
272
|
+
placeholder: z.string().optional().meta({
|
|
273
|
+
description: 'Text shown when this input has no value.',
|
|
274
|
+
}),
|
|
275
|
+
icon: IconSchema.optional().meta({
|
|
276
|
+
description: 'Icon shown beside the input.',
|
|
277
|
+
}),
|
|
278
|
+
icon_color: IconColorSchema.optional(),
|
|
279
|
+
icon_background_color: IconBackgroundColorSchema.optional(),
|
|
280
|
+
})
|
|
281
|
+
.meta({
|
|
282
|
+
description: 'Options that are specific to Text Inputs.',
|
|
283
|
+
});
|
|
284
|
+
|
|
285
|
+
export const TextInputSchema = z
|
|
286
|
+
.object({
|
|
287
|
+
...BaseInputSchema.shape,
|
|
288
|
+
type: z
|
|
289
|
+
.literal([
|
|
290
|
+
'text',
|
|
291
|
+
'email',
|
|
292
|
+
'disabled',
|
|
293
|
+
'pinterest',
|
|
294
|
+
'facebook',
|
|
295
|
+
'twitter',
|
|
296
|
+
'github',
|
|
297
|
+
'instagram',
|
|
298
|
+
])
|
|
299
|
+
.meta(typeMeta),
|
|
300
|
+
options: TextInputOptionsSchema.optional(),
|
|
301
|
+
})
|
|
302
|
+
.meta({
|
|
303
|
+
id: 'TextInput',
|
|
304
|
+
});
|
|
305
|
+
|
|
306
|
+
export const TextareaInputOptionsSchema = z
|
|
307
|
+
.object({
|
|
308
|
+
...TextValidationSchema.shape,
|
|
309
|
+
...RequiredValidationSchema.shape,
|
|
310
|
+
empty_type: EmptyTypeTextSchema.optional(),
|
|
311
|
+
placeholder: z.string().optional().meta({
|
|
312
|
+
description: 'Text shown when this input has no value.',
|
|
313
|
+
}),
|
|
314
|
+
show_count: z.boolean().default(false).optional().meta({
|
|
315
|
+
description: 'Shows a character counter below the input if enabled.',
|
|
316
|
+
}),
|
|
317
|
+
})
|
|
318
|
+
.meta({
|
|
319
|
+
description: 'Options that are specific to Textarea Inputs.',
|
|
320
|
+
});
|
|
321
|
+
|
|
322
|
+
export const TextareaInputSchema = z
|
|
323
|
+
.object({
|
|
324
|
+
...BaseInputSchema.shape,
|
|
325
|
+
type: z.literal('textarea').meta(typeMeta),
|
|
326
|
+
options: TextareaInputOptionsSchema.optional(),
|
|
327
|
+
})
|
|
328
|
+
.meta({
|
|
329
|
+
id: 'TextareaInput',
|
|
330
|
+
});
|
|
331
|
+
|
|
332
|
+
export const CodeInputOptionsSchema = z
|
|
333
|
+
.object({
|
|
334
|
+
...SourceEditorSchema.shape,
|
|
335
|
+
...TextValidationSchema.shape,
|
|
336
|
+
...RequiredValidationSchema.shape,
|
|
337
|
+
empty_type: EmptyTypeTextSchema.optional(),
|
|
338
|
+
max_visible_lines: z.number().optional().meta({
|
|
339
|
+
description:
|
|
340
|
+
'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.',
|
|
341
|
+
}),
|
|
342
|
+
min_visible_lines: z.number().optional().meta({
|
|
343
|
+
description:
|
|
344
|
+
'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`.',
|
|
345
|
+
}),
|
|
346
|
+
syntax: SyntaxSchema.optional().meta({
|
|
347
|
+
description:
|
|
348
|
+
'Changes how the editor parses your content for syntax highlighting. Should be set to the language of the code going into the input.',
|
|
349
|
+
}),
|
|
350
|
+
})
|
|
351
|
+
.meta({
|
|
352
|
+
description: 'Options that are specific to Code Inputs.',
|
|
353
|
+
});
|
|
354
|
+
|
|
355
|
+
export const CodeInputSchema = z
|
|
356
|
+
.object({
|
|
357
|
+
...BaseInputSchema.shape,
|
|
358
|
+
type: z.literal('code').meta(typeMeta),
|
|
359
|
+
options: CodeInputOptionsSchema.optional(),
|
|
360
|
+
})
|
|
361
|
+
.meta({
|
|
362
|
+
id: 'CodeInput',
|
|
363
|
+
});
|
|
364
|
+
|
|
365
|
+
export const ColorInputOptionsSchema = z
|
|
366
|
+
.object({
|
|
367
|
+
...TextValidationSchema.shape,
|
|
368
|
+
...RequiredValidationSchema.shape,
|
|
369
|
+
empty_type: EmptyTypeTextSchema.optional(),
|
|
370
|
+
format: z.enum(['rgb', 'hex', 'hsl', 'hsv']).optional().meta({
|
|
371
|
+
description:
|
|
372
|
+
'Sets what format the color value is saved as. Defaults to the naming convention, or HEX if that is unset.',
|
|
373
|
+
}),
|
|
374
|
+
alpha: z.boolean().optional().meta({
|
|
375
|
+
description:
|
|
376
|
+
'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".',
|
|
377
|
+
}),
|
|
378
|
+
})
|
|
379
|
+
.meta({
|
|
380
|
+
description: 'Options that are specific to Color Inputs.',
|
|
381
|
+
});
|
|
382
|
+
|
|
383
|
+
export const ColorInputSchema = z
|
|
384
|
+
.object({
|
|
385
|
+
...BaseInputSchema.shape,
|
|
386
|
+
type: z.literal('color').meta(typeMeta),
|
|
387
|
+
options: ColorInputOptionsSchema.optional(),
|
|
388
|
+
})
|
|
389
|
+
.meta({
|
|
390
|
+
id: 'ColorInput',
|
|
391
|
+
});
|
|
392
|
+
|
|
393
|
+
export const BooleanInputSchema = z
|
|
394
|
+
.object({
|
|
395
|
+
...BaseInputSchema.shape,
|
|
396
|
+
type: z.literal('checkbox').meta(typeMeta),
|
|
397
|
+
})
|
|
398
|
+
.meta({
|
|
399
|
+
id: 'BooleanInput',
|
|
400
|
+
});
|
|
401
|
+
|
|
402
|
+
const MinSchema = z.number().meta({
|
|
403
|
+
id: 'min',
|
|
404
|
+
description:
|
|
405
|
+
'This key defines the minimum numerical value CloudCannon will allow in an Input. When configured, CloudCannon will prevent you from entering a lesser numerical value. If the Input already contains a lesser numerical value, CloudCannon will require you to enter a valid value to save your changes, or discard your unsaved changes.',
|
|
406
|
+
});
|
|
407
|
+
|
|
408
|
+
const MaxSchema = z.number().meta({
|
|
409
|
+
id: 'max',
|
|
410
|
+
description:
|
|
411
|
+
'This key defines the maximum numerical value CloudCannon will allow in an Input. When configured, CloudCannon will prevent you from entering a greater numerical value. If the Input already contains a greater numerical value, CloudCannon will require you to enter a valid value to save your changes, or discard your unsaved changes.',
|
|
412
|
+
});
|
|
413
|
+
|
|
414
|
+
export const NumberInputOptionsSchema = z
|
|
415
|
+
.object({
|
|
416
|
+
...RequiredValidationSchema.shape,
|
|
417
|
+
empty_type: EmptyTypeNumberSchema.optional(),
|
|
418
|
+
min: MinSchema.optional(),
|
|
419
|
+
max: MaxSchema.optional(),
|
|
420
|
+
step: z.number().optional().meta({
|
|
421
|
+
id: 'step',
|
|
422
|
+
description:
|
|
423
|
+
'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`.',
|
|
424
|
+
}),
|
|
425
|
+
min_message: z.string().optional().meta({
|
|
426
|
+
id: 'min_message',
|
|
427
|
+
description:
|
|
428
|
+
'This key defines the message that explains why an Input needs to have a minimum numerical value. This key requires you to define `options.min`.',
|
|
429
|
+
}),
|
|
430
|
+
max_message: z.string().optional().meta({
|
|
431
|
+
id: 'max_message',
|
|
432
|
+
description:
|
|
433
|
+
'This key defines the message that explains why an Input needs to have a maximum numerical value. This key requires you to define `options.max`.',
|
|
434
|
+
}),
|
|
435
|
+
})
|
|
436
|
+
.meta({
|
|
437
|
+
description: 'Options that are specific to Number Inputs.',
|
|
438
|
+
});
|
|
439
|
+
|
|
440
|
+
export const NumberInputSchema = z
|
|
441
|
+
.object({
|
|
442
|
+
...BaseInputSchema.shape,
|
|
443
|
+
type: z.literal('number').meta(typeMeta),
|
|
444
|
+
options: NumberInputOptionsSchema.optional(),
|
|
445
|
+
})
|
|
446
|
+
.meta({
|
|
447
|
+
id: 'NumberInput',
|
|
448
|
+
});
|
|
449
|
+
|
|
450
|
+
export const RangeInputOptionsSchema = z
|
|
451
|
+
.object({
|
|
452
|
+
...NumberInputOptionsSchema.shape,
|
|
453
|
+
min: MinSchema,
|
|
454
|
+
max: MaxSchema,
|
|
455
|
+
})
|
|
456
|
+
.meta({
|
|
457
|
+
description: 'Options that are specific to Range Inputs.',
|
|
458
|
+
});
|
|
459
|
+
|
|
460
|
+
export const RangeInputSchema = z
|
|
461
|
+
.object({
|
|
462
|
+
...BaseInputSchema.shape,
|
|
463
|
+
type: z.literal('range').meta(typeMeta),
|
|
464
|
+
options: RangeInputOptionsSchema.optional(),
|
|
465
|
+
})
|
|
466
|
+
.meta({
|
|
467
|
+
id: 'RangeInput',
|
|
468
|
+
});
|
|
469
|
+
|
|
470
|
+
export const RichTextInputOptionsSchema = z
|
|
471
|
+
.object({
|
|
472
|
+
...ImageOptionsSchema.shape,
|
|
473
|
+
...BlockEditableSchema.shape,
|
|
474
|
+
...TextValidationSchema.shape,
|
|
475
|
+
...RequiredValidationSchema.shape,
|
|
476
|
+
empty_type: EmptyTypeTextSchema.optional(),
|
|
477
|
+
allow_resize: z.boolean().default(false).optional().meta({
|
|
478
|
+
description: 'Shows or hides the resize handler to vertically resize the input.',
|
|
479
|
+
}),
|
|
480
|
+
initial_height: z.number().optional().meta({
|
|
481
|
+
description: 'Defines the initial height of this input in pixels (px).',
|
|
482
|
+
}),
|
|
483
|
+
})
|
|
484
|
+
.meta({
|
|
485
|
+
description: 'Options that are specific to Rich Text Inputs.',
|
|
486
|
+
});
|
|
487
|
+
|
|
488
|
+
export const RichTextInputSchema = z
|
|
489
|
+
.object({
|
|
490
|
+
...BaseInputSchema.shape,
|
|
491
|
+
type: z.literal(['html', 'markdown']).meta(typeMeta),
|
|
492
|
+
options: RichTextInputOptionsSchema.optional(),
|
|
493
|
+
})
|
|
494
|
+
.meta({
|
|
495
|
+
id: 'RichTextInput',
|
|
496
|
+
});
|
|
497
|
+
|
|
498
|
+
export const DateInputOptionsSchema = z
|
|
499
|
+
.object({
|
|
500
|
+
...RequiredValidationSchema.shape,
|
|
501
|
+
empty_type: EmptyTypeTextSchema.optional(),
|
|
502
|
+
timezone: TimezoneSchema.optional().default('Etc/UTC').meta({
|
|
503
|
+
description:
|
|
504
|
+
'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`.',
|
|
505
|
+
}),
|
|
506
|
+
start_from: z
|
|
507
|
+
.union([
|
|
508
|
+
z.iso.datetime({ offset: true, local: true }),
|
|
509
|
+
z.coerce.string().meta({ isJsonSchemaAny: true }),
|
|
510
|
+
])
|
|
511
|
+
.optional()
|
|
512
|
+
.meta({
|
|
513
|
+
description:
|
|
514
|
+
'This key defines the earliest date and time, inclusive, that CloudCannon will allow in an Input. When configured, CloudCannon will prevent you from selecting an earlier date and time. If the Input already contains an earlier date and time, CloudCannon will require you to change it to a valid value to save your changes, or discard your unsaved changes. Value must be in ISO8601 format. If `options.end_before` is also configured, this key cannot be a later date and time.',
|
|
515
|
+
}),
|
|
516
|
+
start_from_message: z.string().optional().meta({
|
|
517
|
+
description:
|
|
518
|
+
'This key defines the message that explains why an Input needs to have a start date. This key requires you to define `options.start_from`.',
|
|
519
|
+
}),
|
|
520
|
+
end_before: z
|
|
521
|
+
.union([
|
|
522
|
+
z.iso.datetime({ offset: true, local: true }),
|
|
523
|
+
z.coerce.string().meta({ isJsonSchemaAny: true }),
|
|
524
|
+
])
|
|
525
|
+
.optional()
|
|
526
|
+
.meta({
|
|
527
|
+
description:
|
|
528
|
+
'This key defines the date and time, exclusive, that CloudCannon will allow in an Input. When configured, CloudCannon will prevent you from selecting a later date and time. If the Input already contains a later date and time, CloudCannon will require you to change it to a valid value to save your changes, or discard your unsaved changes. Value must be in ISO8601 format. If options.start_from is also configured, this key cannot be an earlier date and time. This key has no default.',
|
|
529
|
+
}),
|
|
530
|
+
end_before_message: z.string().optional().meta({
|
|
531
|
+
description:
|
|
532
|
+
'This key defines the message that explains why an Input needs to have an end date. This key requires you to define `options.end_before`. This key has no default.',
|
|
533
|
+
}),
|
|
534
|
+
})
|
|
535
|
+
.meta({
|
|
536
|
+
description: 'Options that are specific to Date Inputs.',
|
|
537
|
+
});
|
|
538
|
+
|
|
539
|
+
export const DateInputSchema = z
|
|
540
|
+
.object({
|
|
541
|
+
...BaseInputSchema.shape,
|
|
542
|
+
type: z.literal(['date', 'datetime']).meta(typeMeta),
|
|
543
|
+
options: DateInputOptionsSchema.optional(),
|
|
544
|
+
})
|
|
545
|
+
.meta({
|
|
546
|
+
id: 'DateInput',
|
|
547
|
+
});
|
|
548
|
+
|
|
549
|
+
export const TimeInputOptionsSchema = z
|
|
550
|
+
.object({
|
|
551
|
+
...RequiredValidationSchema.shape,
|
|
552
|
+
empty_type: EmptyTypeTextSchema.optional(),
|
|
553
|
+
})
|
|
554
|
+
.meta({
|
|
555
|
+
description: 'Options that are specific to Time Inputs.',
|
|
556
|
+
});
|
|
557
|
+
|
|
558
|
+
export const TimeInputSchema = z
|
|
559
|
+
.object({
|
|
560
|
+
...BaseInputSchema.shape,
|
|
561
|
+
type: z.literal('time').meta(typeMeta),
|
|
562
|
+
options: TimeInputOptionsSchema.optional(),
|
|
563
|
+
})
|
|
564
|
+
.meta({
|
|
565
|
+
id: 'TimeInput',
|
|
566
|
+
});
|
|
567
|
+
|
|
568
|
+
export const FileInputOptionsSchema = z
|
|
569
|
+
.object({
|
|
570
|
+
...ImageOptionsSchema.shape,
|
|
571
|
+
...TextValidationSchema.shape,
|
|
572
|
+
...RequiredValidationSchema.shape,
|
|
573
|
+
empty_type: EmptyTypeTextSchema.optional(),
|
|
574
|
+
paths: PathsSchema.optional(),
|
|
575
|
+
accepts_mime_types: z
|
|
576
|
+
.union([z.string(), z.array(MimeTypeSchema)])
|
|
577
|
+
.optional()
|
|
578
|
+
.meta({
|
|
579
|
+
id: 'accepts_mime_types',
|
|
580
|
+
description:
|
|
581
|
+
'Restricts which file types are available to select or upload to this input. Accepted format is an array or comma-separated string of MIME types. The special value "*" means any type is accepted.',
|
|
582
|
+
}),
|
|
583
|
+
max_file_size: z.number().optional().meta({
|
|
584
|
+
id: 'max_file_size',
|
|
585
|
+
description:
|
|
586
|
+
'This key defines the maximum file size, in kilobytes, that CloudCannon will allow in an Input. When configured, CloudCannon will prevent you from uploading a file larger than the specified size. If the Input already contains a file larger than the specified size, CloudCannon will require you to change it to a valid value to save your changes, or discard your unsaved changes. Value can be any positive integer.',
|
|
587
|
+
}),
|
|
588
|
+
max_file_size_message: z.string().optional().meta({
|
|
589
|
+
id: 'max_file_size_message',
|
|
590
|
+
description:
|
|
591
|
+
'This key defines the message that explains why an Input needs to have a maximum file size. This key requires you to define `options.max_file_size`. This key has no default.',
|
|
592
|
+
}),
|
|
593
|
+
disable_upload_file: z.boolean().default(false).optional().meta({
|
|
594
|
+
id: 'disable_upload_file',
|
|
595
|
+
description: 'Disables the context menu option and the drop area for uploading files.',
|
|
596
|
+
}),
|
|
597
|
+
disable_direct_input: z.boolean().default(false).optional().meta({
|
|
598
|
+
id: 'disable_direct_input',
|
|
599
|
+
description:
|
|
600
|
+
'Prevents typing into the text input, while still allowing context menu options to change the value.',
|
|
601
|
+
}),
|
|
602
|
+
disable_upload_file_in_file_browser: z.boolean().default(false).optional().meta({
|
|
603
|
+
id: 'disable_upload_file_in_file_browser',
|
|
604
|
+
description:
|
|
605
|
+
'Prevents file uploads inside the "Select existing file/image" file browser modal window.',
|
|
606
|
+
}),
|
|
607
|
+
})
|
|
608
|
+
.meta({
|
|
609
|
+
description: 'Options that are specific to File Inputs.',
|
|
610
|
+
});
|
|
611
|
+
|
|
612
|
+
export const FileInputSchema = z
|
|
613
|
+
.object({
|
|
614
|
+
...BaseInputSchema.shape,
|
|
615
|
+
type: z.literal(['file', 'document', 'image']).meta(typeMeta),
|
|
616
|
+
options: FileInputOptionsSchema.optional(),
|
|
617
|
+
})
|
|
618
|
+
.meta({
|
|
619
|
+
id: 'FileInput',
|
|
620
|
+
});
|
|
621
|
+
|
|
622
|
+
export const UrlInputOptionsSchema = z
|
|
623
|
+
.object({
|
|
624
|
+
...FileInputOptionsSchema.shape,
|
|
625
|
+
hide_link_to_file: z.boolean().default(false).optional().meta({
|
|
626
|
+
description:
|
|
627
|
+
'Hides the options to link to an existing file, and upload a new file. This does not prevent typing a file path in the input.',
|
|
628
|
+
}),
|
|
629
|
+
hide_link_to_page: z.boolean().default(false).optional().meta({
|
|
630
|
+
description:
|
|
631
|
+
"Hides the option to link to a page. This does not prevent typing a file's output URL in the input.",
|
|
632
|
+
}),
|
|
633
|
+
hide_link_to_email_address: z.boolean().default(false).optional().meta({
|
|
634
|
+
description:
|
|
635
|
+
'Hides the option to link to an email address. This does not prevent typing a `mailto:` link in the input.',
|
|
636
|
+
}),
|
|
637
|
+
hide_link_to_telephone: z.boolean().default(false).optional().meta({
|
|
638
|
+
description:
|
|
639
|
+
'Hides the option to link to a telephone number. This does not prevent typing a `tel:` link in the input.',
|
|
640
|
+
}),
|
|
641
|
+
})
|
|
642
|
+
.meta({
|
|
643
|
+
description: 'Options that are specific to URL Inputs.',
|
|
644
|
+
});
|
|
645
|
+
|
|
646
|
+
export const UrlInputSchema = z
|
|
647
|
+
.object({
|
|
648
|
+
...BaseInputSchema.shape,
|
|
649
|
+
type: z.literal('url').meta(typeMeta),
|
|
650
|
+
options: UrlInputOptionsSchema.optional(),
|
|
651
|
+
})
|
|
652
|
+
.meta({
|
|
653
|
+
id: 'UrlInput',
|
|
654
|
+
});
|
|
655
|
+
|
|
656
|
+
export const SharedSelectInputOptionsSchema = z.object({
|
|
657
|
+
...RequiredValidationSchema.shape,
|
|
658
|
+
preview: PreviewSchema.optional(),
|
|
659
|
+
picker_preview: PickerPreviewSchema.optional(),
|
|
660
|
+
allow_create: z.boolean().default(false).optional().meta({
|
|
661
|
+
id: 'allow_create',
|
|
662
|
+
description: 'Allows new text values to be created at edit time.',
|
|
663
|
+
}),
|
|
664
|
+
allow_empty: z.boolean().default(true).optional().meta({
|
|
665
|
+
id: 'allow_empty',
|
|
666
|
+
description: 'Provides an empty option alongside the options provided by values.',
|
|
667
|
+
}),
|
|
668
|
+
values: z.union([z.string(), SelectDataValuesSchema]).optional().meta({
|
|
669
|
+
id: 'values',
|
|
670
|
+
description:
|
|
671
|
+
'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).',
|
|
672
|
+
}),
|
|
673
|
+
value_key: z.string().optional().meta({
|
|
674
|
+
id: 'value_key',
|
|
675
|
+
description:
|
|
676
|
+
'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.',
|
|
677
|
+
}),
|
|
678
|
+
view: z.enum(['card', 'text', 'gallery', 'gallery-left']).optional().meta({
|
|
679
|
+
id: 'view',
|
|
680
|
+
description: 'Controls how selected items are rendered.',
|
|
681
|
+
}),
|
|
682
|
+
picker_view: z.enum(['card', 'text', 'gallery', 'gallery-left']).optional().meta({
|
|
683
|
+
id: 'picker_view',
|
|
684
|
+
description: 'Controls how selectable options are rendered.',
|
|
685
|
+
}),
|
|
686
|
+
});
|
|
687
|
+
|
|
688
|
+
export const SelectInputOptionsSchema = z
|
|
689
|
+
.object({
|
|
690
|
+
...SharedSelectInputOptionsSchema.shape,
|
|
691
|
+
...TextValidationSchema.shape,
|
|
692
|
+
empty_type: EmptyTypeTextSchema.optional(),
|
|
693
|
+
})
|
|
694
|
+
.meta({
|
|
695
|
+
description: 'Options that are specific to Select Inputs.',
|
|
696
|
+
});
|
|
697
|
+
|
|
698
|
+
export const SelectInputSchema = z
|
|
699
|
+
.object({
|
|
700
|
+
...BaseInputSchema.shape,
|
|
701
|
+
type: z.literal('select').meta(typeMeta),
|
|
702
|
+
options: SelectInputOptionsSchema.optional(),
|
|
703
|
+
})
|
|
704
|
+
.meta({
|
|
705
|
+
id: 'SelectInput',
|
|
706
|
+
});
|
|
707
|
+
|
|
708
|
+
export const MultiselectInputOptionsSchema = z
|
|
709
|
+
.object({
|
|
710
|
+
...SharedSelectInputOptionsSchema.shape,
|
|
711
|
+
...ArrayValidationSchema.shape,
|
|
712
|
+
empty_type: EmptyTypeArraySchema.optional(),
|
|
713
|
+
})
|
|
714
|
+
.meta({
|
|
715
|
+
description: 'Options that are specific to Multiselect Inputs.',
|
|
716
|
+
});
|
|
717
|
+
|
|
718
|
+
export const MultiselectInputSchema = z
|
|
719
|
+
.object({
|
|
720
|
+
...BaseInputSchema.shape,
|
|
721
|
+
type: z.literal('multiselect').meta(typeMeta),
|
|
722
|
+
options: MultiselectInputOptionsSchema.optional(),
|
|
723
|
+
})
|
|
724
|
+
.meta({
|
|
725
|
+
id: 'MultiselectInput',
|
|
726
|
+
});
|
|
727
|
+
|
|
728
|
+
export const SharedChoiceInputOptionsSchema = SharedSelectInputOptionsSchema.omit({
|
|
729
|
+
allow_create: true,
|
|
730
|
+
});
|
|
731
|
+
|
|
732
|
+
export const ChoiceInputOptionsSchema = z
|
|
733
|
+
.object({
|
|
734
|
+
...SharedChoiceInputOptionsSchema.shape,
|
|
735
|
+
...TextValidationSchema.shape,
|
|
736
|
+
empty_type: EmptyTypeTextSchema.optional(),
|
|
737
|
+
})
|
|
738
|
+
.meta({
|
|
739
|
+
description: 'Options that are specific to Choice Inputs.',
|
|
740
|
+
});
|
|
741
|
+
|
|
742
|
+
export const ChoiceInputSchema = z
|
|
743
|
+
.object({
|
|
744
|
+
...BaseInputSchema.shape,
|
|
745
|
+
type: z.literal('choice').meta(typeMeta),
|
|
746
|
+
options: ChoiceInputOptionsSchema.optional(),
|
|
747
|
+
})
|
|
748
|
+
.meta({
|
|
749
|
+
id: 'ChoiceInput',
|
|
750
|
+
});
|
|
751
|
+
|
|
752
|
+
export const MultichoiceInputOptionsSchema = z
|
|
753
|
+
.object({
|
|
754
|
+
...SharedChoiceInputOptionsSchema.shape,
|
|
755
|
+
...ArrayValidationSchema.shape,
|
|
756
|
+
empty_type: EmptyTypeArraySchema.optional(),
|
|
757
|
+
})
|
|
758
|
+
.meta({
|
|
759
|
+
description: 'Options that are specific to Multichoice Inputs.',
|
|
760
|
+
});
|
|
761
|
+
|
|
762
|
+
export const MultichoiceInputSchema = z
|
|
763
|
+
.object({
|
|
764
|
+
...BaseInputSchema.shape,
|
|
765
|
+
type: z.literal('multichoice').meta(typeMeta),
|
|
766
|
+
options: MultichoiceInputOptionsSchema.optional(),
|
|
767
|
+
})
|
|
768
|
+
.meta({
|
|
769
|
+
id: 'MultichoiceInput',
|
|
770
|
+
});
|
|
771
|
+
|
|
772
|
+
export const ObjectInputGroupSchema = z.object({
|
|
773
|
+
heading: z.string().optional().meta({
|
|
774
|
+
description: 'The main text for the group shown when collapsed or expanded.',
|
|
775
|
+
}),
|
|
776
|
+
comment: z.string().optional().meta({
|
|
777
|
+
description:
|
|
778
|
+
'Changes the subtext below the `heading`. Has no default. Supports a limited set of Markdown: links, bold, italic, subscript, superscript, and inline code elements are allowed.',
|
|
779
|
+
}),
|
|
780
|
+
collapsed: z.boolean().default(false).optional().meta({
|
|
781
|
+
description: 'Controls if this group is collapsed or expanded when first viewed.',
|
|
782
|
+
}),
|
|
783
|
+
inputs: z.array(z.string()).optional().meta({
|
|
784
|
+
description: 'The keys of each input in this group.',
|
|
785
|
+
}),
|
|
786
|
+
documentation: DocumentationSchema.optional().meta({
|
|
787
|
+
description:
|
|
788
|
+
'Provides a custom link for documentation for editors shown above the collection file list.',
|
|
789
|
+
}),
|
|
790
|
+
});
|
|
791
|
+
|
|
792
|
+
export const ObjectInputOptionsSchema = z
|
|
793
|
+
.object({
|
|
794
|
+
...RequiredValidationSchema.shape,
|
|
795
|
+
empty_type: EmptyTypeObjectSchema.optional(),
|
|
796
|
+
preview: PreviewSchema.optional(),
|
|
797
|
+
subtype: z.enum(['object', 'mutable', 'tabbed']).optional().meta({
|
|
798
|
+
description: 'Changes the appearance and behavior of the input.',
|
|
799
|
+
}),
|
|
800
|
+
entries: z
|
|
801
|
+
.object({
|
|
802
|
+
allowed_keys: z.array(z.string()).optional().meta({
|
|
803
|
+
description:
|
|
804
|
+
'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.',
|
|
805
|
+
}),
|
|
806
|
+
assigned_structures: z.record(z.string(), z.array(z.string())).optional().meta({
|
|
807
|
+
description:
|
|
808
|
+
'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.',
|
|
809
|
+
}),
|
|
810
|
+
get structures() {
|
|
811
|
+
return z.union([z.string(), StructureSchema]).optional().meta({
|
|
812
|
+
description:
|
|
813
|
+
'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.',
|
|
814
|
+
});
|
|
815
|
+
},
|
|
816
|
+
})
|
|
817
|
+
.optional()
|
|
818
|
+
.meta({
|
|
819
|
+
description: 'Contains options for the "mutable" subtype.',
|
|
820
|
+
}),
|
|
821
|
+
get structures() {
|
|
822
|
+
return z.union([z.string(), StructureSchema]).optional().meta({
|
|
823
|
+
description:
|
|
824
|
+
'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.',
|
|
825
|
+
});
|
|
826
|
+
},
|
|
827
|
+
groups: z.array(ObjectInputGroupSchema).optional().meta({
|
|
828
|
+
description:
|
|
829
|
+
'Allows you to group the inputs inside this object together without changing the data structure.',
|
|
830
|
+
}),
|
|
831
|
+
place_groups_below: z.boolean().default(false).optional().meta({
|
|
832
|
+
description: 'Controls which order input groups and ungrouped inputs appear in.',
|
|
833
|
+
}),
|
|
834
|
+
allow_label_formatting: z.boolean().default(false).optional().meta({
|
|
835
|
+
description: 'Controls whether or not labels on mutable object entries are formatted.',
|
|
836
|
+
}),
|
|
837
|
+
view: z.enum(['card', 'gallery', 'gallery-left']).optional().meta({
|
|
838
|
+
description: 'Controls how object previews are rendered.',
|
|
839
|
+
}),
|
|
840
|
+
})
|
|
841
|
+
.meta({
|
|
842
|
+
description: 'Options that are specific to Object Inputs.',
|
|
843
|
+
});
|
|
844
|
+
|
|
845
|
+
export const ObjectInputSchema = z
|
|
846
|
+
.object({
|
|
847
|
+
...BaseInputSchema.shape,
|
|
848
|
+
type: z.literal('object').meta(typeMeta),
|
|
849
|
+
options: ObjectInputOptionsSchema.optional(),
|
|
850
|
+
})
|
|
851
|
+
.meta({
|
|
852
|
+
id: 'ObjectInput',
|
|
853
|
+
});
|
|
854
|
+
|
|
855
|
+
export const ArrayInputOptionsSchema = z
|
|
856
|
+
.object({
|
|
857
|
+
...RequiredValidationSchema.shape,
|
|
858
|
+
...ArrayValidationSchema.shape,
|
|
859
|
+
...ArrayControlOptionsSchema.shape,
|
|
860
|
+
empty_type: EmptyTypeArraySchema.optional(),
|
|
861
|
+
get structures() {
|
|
862
|
+
return z.union([z.string(), StructureSchema]).optional().meta({
|
|
863
|
+
description:
|
|
864
|
+
'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.',
|
|
865
|
+
});
|
|
866
|
+
},
|
|
867
|
+
})
|
|
868
|
+
.meta({
|
|
869
|
+
description: 'Options that are specific to Array Inputs.',
|
|
870
|
+
});
|
|
871
|
+
|
|
872
|
+
export const ArrayInputSchema = z
|
|
873
|
+
.object({
|
|
874
|
+
...BaseInputSchema.shape,
|
|
875
|
+
type: z.literal('array').meta(typeMeta),
|
|
876
|
+
options: ArrayInputOptionsSchema.optional(),
|
|
877
|
+
})
|
|
878
|
+
.meta({
|
|
879
|
+
id: 'ArrayInput',
|
|
880
|
+
});
|
|
881
|
+
|
|
882
|
+
export const AutoInputSchema = z
|
|
883
|
+
.object({
|
|
884
|
+
...BaseInputSchema.shape,
|
|
885
|
+
type: z.literal('auto').meta(typeMeta),
|
|
886
|
+
options: z.unknown().optional().meta({
|
|
887
|
+
description: 'Options that are specific to this `type` of input.',
|
|
888
|
+
}),
|
|
889
|
+
})
|
|
890
|
+
.meta({
|
|
891
|
+
id: 'AutoInput',
|
|
892
|
+
});
|
|
893
|
+
|
|
894
|
+
export const UnknownInputSchema = z
|
|
895
|
+
.object({
|
|
896
|
+
...BaseInputSchema.shape,
|
|
897
|
+
options: z.unknown().optional().meta({
|
|
898
|
+
description: 'Options that are specific to this `type` of input.',
|
|
899
|
+
}),
|
|
900
|
+
})
|
|
901
|
+
.meta({
|
|
902
|
+
id: 'UnknownInput',
|
|
903
|
+
title: 'Unknown Input',
|
|
904
|
+
description:
|
|
905
|
+
'An input type that is not known to the CloudCannon configuration schema. This is logically the same as `AutoInput`, but is used for inputs that have no type set.',
|
|
906
|
+
});
|
|
907
|
+
|
|
908
|
+
export const KnownInputSchema = z
|
|
909
|
+
.discriminatedUnion('type', [
|
|
910
|
+
TextInputSchema,
|
|
911
|
+
TextareaInputSchema,
|
|
912
|
+
CodeInputSchema,
|
|
913
|
+
ColorInputSchema,
|
|
914
|
+
BooleanInputSchema,
|
|
915
|
+
NumberInputSchema,
|
|
916
|
+
RangeInputSchema,
|
|
917
|
+
RichTextInputSchema,
|
|
918
|
+
DateInputSchema,
|
|
919
|
+
TimeInputSchema,
|
|
920
|
+
FileInputSchema,
|
|
921
|
+
UrlInputSchema,
|
|
922
|
+
SelectInputSchema,
|
|
923
|
+
MultiselectInputSchema,
|
|
924
|
+
ChoiceInputSchema,
|
|
925
|
+
MultichoiceInputSchema,
|
|
926
|
+
ObjectInputSchema,
|
|
927
|
+
ArrayInputSchema,
|
|
928
|
+
AutoInputSchema,
|
|
929
|
+
])
|
|
930
|
+
.meta({
|
|
931
|
+
title: 'Known Input',
|
|
932
|
+
description:
|
|
933
|
+
'A union of all input types that are known to the CloudCannon configuration schema.',
|
|
934
|
+
});
|
|
935
|
+
|
|
936
|
+
export const InputSchema = z.union([KnownInputSchema, UnknownInputSchema]).meta({
|
|
937
|
+
id: 'Input',
|
|
938
|
+
});
|
|
939
|
+
|
|
940
|
+
export const InputsSchema = z.record(z.string(), InputSchema).meta({
|
|
941
|
+
id: '_inputs',
|
|
942
|
+
title: 'Inputs',
|
|
943
|
+
description:
|
|
944
|
+
'Controls the behavior and appearance of your inputs in all data editing interfaces.',
|
|
945
|
+
});
|
|
946
|
+
|
|
947
|
+
export type Context = z.infer<typeof ContextSchema>;
|
|
948
|
+
export type BaseInput = z.infer<typeof BaseInputSchema>;
|
|
949
|
+
export type TextInputOptions = z.infer<typeof TextInputOptionsSchema>;
|
|
950
|
+
export type TextInput = z.infer<typeof TextInputSchema>;
|
|
951
|
+
export type TextareaInputOptions = z.infer<typeof TextareaInputOptionsSchema>;
|
|
952
|
+
export type TextareaInput = z.infer<typeof TextareaInputSchema>;
|
|
953
|
+
export type Syntax = z.infer<typeof SyntaxSchema>;
|
|
954
|
+
export type CodeInputOptions = z.infer<typeof CodeInputOptionsSchema>;
|
|
955
|
+
export type CodeInput = z.infer<typeof CodeInputSchema>;
|
|
956
|
+
export type ColorInputOptions = z.infer<typeof ColorInputOptionsSchema>;
|
|
957
|
+
export type ColorInput = z.infer<typeof ColorInputSchema>;
|
|
958
|
+
export type BooleanInput = z.infer<typeof BooleanInputSchema>;
|
|
959
|
+
export type NumberInputOptions = z.infer<typeof NumberInputOptionsSchema>;
|
|
960
|
+
export type NumberInput = z.infer<typeof NumberInputSchema>;
|
|
961
|
+
export type RangeInputOptions = z.infer<typeof RangeInputOptionsSchema>;
|
|
962
|
+
export type RangeInput = z.infer<typeof RangeInputSchema>;
|
|
963
|
+
export type RichTextInputOptions = z.infer<typeof RichTextInputOptionsSchema>;
|
|
964
|
+
export type RichTextInput = z.infer<typeof RichTextInputSchema>;
|
|
965
|
+
export type DateInputOptions = z.infer<typeof DateInputOptionsSchema>;
|
|
966
|
+
export type DateInput = z.infer<typeof DateInputSchema>;
|
|
967
|
+
export type TimeInput = z.infer<typeof TimeInputSchema>;
|
|
968
|
+
export type MimeType = z.infer<typeof MimeTypeSchema>;
|
|
969
|
+
export type FileInputOptions = z.infer<typeof FileInputOptionsSchema>;
|
|
970
|
+
export type FileInput = z.infer<typeof FileInputSchema>;
|
|
971
|
+
export type UrlInputOptions = z.infer<typeof UrlInputOptionsSchema>;
|
|
972
|
+
export type UrlInput = z.infer<typeof UrlInputSchema>;
|
|
973
|
+
export type SharedSelectInputOptions = z.infer<typeof SharedSelectInputOptionsSchema>;
|
|
974
|
+
export type SelectInputOptions = z.infer<typeof SelectInputOptionsSchema>;
|
|
975
|
+
export type SelectInput = z.infer<typeof SelectInputSchema>;
|
|
976
|
+
export type MultiselectInputOptions = z.infer<typeof MultiselectInputOptionsSchema>;
|
|
977
|
+
export type MultiselectInput = z.infer<typeof MultiselectInputSchema>;
|
|
978
|
+
export type SharedChoiceInputOptions = z.infer<typeof SharedChoiceInputOptionsSchema>;
|
|
979
|
+
export type ChoiceInputOptions = z.infer<typeof ChoiceInputOptionsSchema>;
|
|
980
|
+
export type ChoiceInput = z.infer<typeof ChoiceInputSchema>;
|
|
981
|
+
export type MultichoiceInputOptions = z.infer<typeof MultichoiceInputOptionsSchema>;
|
|
982
|
+
export type MultichoiceInput = z.infer<typeof MultichoiceInputSchema>;
|
|
983
|
+
export type ObjectInputGroup = z.infer<typeof ObjectInputGroupSchema>;
|
|
984
|
+
export type ObjectInputOptions = z.infer<typeof ObjectInputOptionsSchema>;
|
|
985
|
+
export type ObjectInput = z.infer<typeof ObjectInputSchema>;
|
|
986
|
+
export type ArrayInputOptions = z.infer<typeof ArrayInputOptionsSchema>;
|
|
987
|
+
export type ArrayInput = z.infer<typeof ArrayInputSchema>;
|
|
988
|
+
export type AutoInput = z.infer<typeof AutoInputSchema>;
|
|
989
|
+
export type UnknownInput = z.infer<typeof UnknownInputSchema>;
|
|
990
|
+
export type KnownInput = z.infer<typeof KnownInputSchema>;
|
|
991
|
+
export type Input = z.infer<typeof InputSchema>;
|
|
992
|
+
export type Inputs = z.infer<typeof InputsSchema>;
|
|
993
|
+
export type InputType = z.infer<typeof InputTypeSchema>;
|