@cloudcannon/configuration-types 0.0.37 → 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 -10957
- package/dist/cloudcannon-config.legacy-eleventy.schema.json +9476 -11075
- package/dist/cloudcannon-config.legacy-hugo.schema.json +9424 -11028
- package/dist/cloudcannon-config.legacy-jekyll.schema.json +9476 -11075
- package/dist/cloudcannon-config.legacy-reader.schema.json +5882 -7489
- 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 -1647
- 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
|
@@ -0,0 +1,421 @@
|
|
|
1
|
+
import * as z from 'zod';
|
|
2
|
+
import { CascadeSchema, EditorKeySchema, ReducedCascadeSchema } from './cascade';
|
|
3
|
+
import { DocumentationSchema } from './documentation';
|
|
4
|
+
import { IconSchema } from './icon';
|
|
5
|
+
import { InputSchema } from './inputs';
|
|
6
|
+
import { MarkdownSettingsSchema } from './markdown';
|
|
7
|
+
import { PathsSchema } from './paths';
|
|
8
|
+
import { PreviewSchema } from './preview';
|
|
9
|
+
import { SnippetConfigSchema } from './snippets';
|
|
10
|
+
import { SnippetsImportsSchema } from './snippets';
|
|
11
|
+
import { SourceEditorSchema } from './source-editor';
|
|
12
|
+
import { TimezoneSchema } from './timezone';
|
|
13
|
+
|
|
14
|
+
export const HrefAddOptionSchema = z
|
|
15
|
+
.object({
|
|
16
|
+
name: z.string().optional().meta({
|
|
17
|
+
description: 'The text displayed for the menu item.',
|
|
18
|
+
}),
|
|
19
|
+
icon: IconSchema.default('add').optional().meta({
|
|
20
|
+
description: 'The icon next to the text in the menu item.',
|
|
21
|
+
}),
|
|
22
|
+
href: z.string().meta({
|
|
23
|
+
description:
|
|
24
|
+
'The link that opens when the option is clicked. Can either be an external or internal link. If internal, the link is relative to the current site.',
|
|
25
|
+
}),
|
|
26
|
+
})
|
|
27
|
+
.meta({
|
|
28
|
+
title: 'HREF Add Option',
|
|
29
|
+
description: 'An option for the add menu that opens a link.',
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
export const AddOptionSchema = z
|
|
33
|
+
.object({
|
|
34
|
+
name: z.string().optional().meta({
|
|
35
|
+
description:
|
|
36
|
+
'The text displayed for the menu item. Defaults to using name from the matching schema if set.',
|
|
37
|
+
}),
|
|
38
|
+
icon: IconSchema.optional().meta({
|
|
39
|
+
description:
|
|
40
|
+
'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.',
|
|
41
|
+
}),
|
|
42
|
+
editor: EditorKeySchema.optional().meta({
|
|
43
|
+
description:
|
|
44
|
+
"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.",
|
|
45
|
+
}),
|
|
46
|
+
base_path: z.string().optional().meta({
|
|
47
|
+
description:
|
|
48
|
+
'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.',
|
|
49
|
+
}),
|
|
50
|
+
collection: z.string().optional().meta({
|
|
51
|
+
description:
|
|
52
|
+
'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.',
|
|
53
|
+
}),
|
|
54
|
+
schema: z.string().optional().meta({
|
|
55
|
+
description:
|
|
56
|
+
'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.',
|
|
57
|
+
}),
|
|
58
|
+
default_content_file: z.string().optional().meta({
|
|
59
|
+
description:
|
|
60
|
+
'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.',
|
|
61
|
+
}),
|
|
62
|
+
})
|
|
63
|
+
.meta({
|
|
64
|
+
title: 'Add Option',
|
|
65
|
+
description: 'An option for the add menu.',
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
export const SortSchema = z
|
|
69
|
+
.object({
|
|
70
|
+
key: z.string().meta({
|
|
71
|
+
description:
|
|
72
|
+
"Defines what field contains the value to sort on inside each collection item's data.",
|
|
73
|
+
}),
|
|
74
|
+
order: z.enum(['ascending', 'descending', 'asc', 'desc']).default('ascending').optional().meta({
|
|
75
|
+
description: 'Controls which sort values come first.',
|
|
76
|
+
}),
|
|
77
|
+
})
|
|
78
|
+
.meta({
|
|
79
|
+
title: 'Sort',
|
|
80
|
+
description: 'A sort for a Collection.',
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
export const SortOptionSchema = z
|
|
84
|
+
.object({
|
|
85
|
+
...SortSchema.shape,
|
|
86
|
+
label: z.string().optional().meta({
|
|
87
|
+
description:
|
|
88
|
+
'The text to display in the sort option list. Defaults to a generated label from key and order.',
|
|
89
|
+
}),
|
|
90
|
+
})
|
|
91
|
+
.meta({
|
|
92
|
+
title: 'SortOption',
|
|
93
|
+
description: 'A sort option for a Collection.',
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
export const CreateSchema = z
|
|
97
|
+
.object({
|
|
98
|
+
...ReducedCascadeSchema.shape,
|
|
99
|
+
path: z.string().optional().meta({
|
|
100
|
+
description:
|
|
101
|
+
"The raw template to be processed when creating files. Relative to the containing collection's path.",
|
|
102
|
+
}),
|
|
103
|
+
extra_data: z.record(z.string(), z.string()).optional().meta({
|
|
104
|
+
description:
|
|
105
|
+
'Adds to the available data placeholders coming from the file. Entry values follow the same format as path, and are processed sequentially before path. These values are not saved back to your file.',
|
|
106
|
+
}),
|
|
107
|
+
publish_to: z.string().optional().meta({
|
|
108
|
+
description:
|
|
109
|
+
"Defines a target collection when publishing. When a file is published, the target collection's create definition is used instead.",
|
|
110
|
+
}),
|
|
111
|
+
})
|
|
112
|
+
.meta({
|
|
113
|
+
id: 'create',
|
|
114
|
+
title: 'Create',
|
|
115
|
+
description: 'Controls where new files are saved.',
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
export const SchemaSchema = z
|
|
119
|
+
.object({
|
|
120
|
+
...CascadeSchema.shape,
|
|
121
|
+
preview: PreviewSchema.optional(),
|
|
122
|
+
path: z.string().meta({
|
|
123
|
+
description: 'The path to the schema file. Relative to the root folder of the site.',
|
|
124
|
+
}),
|
|
125
|
+
name: z.string().optional().meta({
|
|
126
|
+
description:
|
|
127
|
+
'Displayed in the add menu when creating new files. Defaults to a formatted version of the key.',
|
|
128
|
+
}),
|
|
129
|
+
icon: IconSchema.default('notes').optional().meta({
|
|
130
|
+
description:
|
|
131
|
+
'Displayed in the add menu when creating new files; also used as the icon for collection files if no other preview is found. Defaults to notes.',
|
|
132
|
+
}),
|
|
133
|
+
create: CreateSchema.optional(),
|
|
134
|
+
new_preview_url: z.string().optional().meta({
|
|
135
|
+
description:
|
|
136
|
+
"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.",
|
|
137
|
+
}),
|
|
138
|
+
reorder_inputs: z.boolean().default(true).optional().meta({
|
|
139
|
+
description:
|
|
140
|
+
'If true, inputs are sorted to match when editing. Extra inputs are ordered after expected inputs, unless `remove_extra_inputs` is true. Defaults to true.',
|
|
141
|
+
}),
|
|
142
|
+
hide_extra_inputs: z.boolean().default(false).optional().meta({
|
|
143
|
+
description:
|
|
144
|
+
'Hides unexpected inputs when editing. Has no effect if `remove_extra_inputs` is true. Defaults to false.',
|
|
145
|
+
}),
|
|
146
|
+
remove_empty_inputs: z.boolean().default(false).optional().meta({
|
|
147
|
+
description:
|
|
148
|
+
'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. Defaults to false.',
|
|
149
|
+
}),
|
|
150
|
+
remove_extra_inputs: z.boolean().default(true).optional().meta({
|
|
151
|
+
description: 'If checked, extra inputs are removed when editing. Defaults to true.',
|
|
152
|
+
}),
|
|
153
|
+
})
|
|
154
|
+
.meta({
|
|
155
|
+
title: 'Schema',
|
|
156
|
+
description:
|
|
157
|
+
'Definitions for your schemas, which are the structured data formats for your content files.',
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
export const CollectionConfigSchema = z
|
|
161
|
+
.object({
|
|
162
|
+
...CascadeSchema.shape,
|
|
163
|
+
preview: PreviewSchema.optional(),
|
|
164
|
+
path: z.string().meta({
|
|
165
|
+
id: 'path',
|
|
166
|
+
description:
|
|
167
|
+
'This key defines the folder path for the collection key in which it is nested. The value for this key is relative to your Site `source`. Each Collection must have a unique path.',
|
|
168
|
+
}),
|
|
169
|
+
glob: z
|
|
170
|
+
.union([z.array(z.string()), z.string()])
|
|
171
|
+
.optional()
|
|
172
|
+
.meta({
|
|
173
|
+
id: 'glob',
|
|
174
|
+
description:
|
|
175
|
+
'This key defines globs which filter the files visible in the _Collection browser_ for a given Collection. Values in this array are relative to the Collection `path`.',
|
|
176
|
+
}),
|
|
177
|
+
url: z.string().optional().meta({
|
|
178
|
+
description:
|
|
179
|
+
'This key defines the output URL for files in a given Collection. CloudCannon uses the output URL in the Visual Editor, and when linking to your Testing Domain and Custom Domain.',
|
|
180
|
+
}),
|
|
181
|
+
disable_url: z.boolean().default(false).optional().meta({
|
|
182
|
+
description:
|
|
183
|
+
'This key toggles whether CloudCannon will generate an output URL for a given Collection.',
|
|
184
|
+
}),
|
|
185
|
+
include_developer_files: z.boolean().default(false).optional().meta({
|
|
186
|
+
description:
|
|
187
|
+
'This key toggles whether CloudCannon removes developer files from your _Collection browser_.',
|
|
188
|
+
}),
|
|
189
|
+
name: z.string().optional().meta({
|
|
190
|
+
description:
|
|
191
|
+
'This key defines the display name for a Collection. The name appears in the _Site Navigation_ and at the top of the _Collection browser_.',
|
|
192
|
+
}),
|
|
193
|
+
description: z.string().optional().meta({
|
|
194
|
+
description:
|
|
195
|
+
'This key defines the description text that appears on the _Collection browser_ page. Collection descriptions are useful for adding extra context for your team members.',
|
|
196
|
+
}),
|
|
197
|
+
icon: IconSchema.default('notes').optional().meta({
|
|
198
|
+
description:
|
|
199
|
+
'This key defines the icon for a Collection. Collection icons appear in the _Site Navigation_ and are the default icon for Collection file Cards if you have not defined `preview.icon`.',
|
|
200
|
+
}),
|
|
201
|
+
documentation: DocumentationSchema.optional().meta({
|
|
202
|
+
description:
|
|
203
|
+
'This key defines the documentation link at the top of a _Collection browser_. Collection documentation is useful for assisting your team members.',
|
|
204
|
+
}),
|
|
205
|
+
sort: SortSchema.optional().meta({
|
|
206
|
+
description:
|
|
207
|
+
'This key defines how CloudCannon sorts your Collection files when you first open your _Collection browser_.',
|
|
208
|
+
}),
|
|
209
|
+
sort_options: z.array(SortOptionSchema).optional().meta({
|
|
210
|
+
description: 'This key defines the options for the Sort dropdown in a _Collection browser_.',
|
|
211
|
+
}),
|
|
212
|
+
singular_name: z.string().optional().meta({
|
|
213
|
+
description:
|
|
214
|
+
'This key defines the singular noun for your Collection name. CloudCannon uses the singular noun in the _+ Add_ button in the top right of the _Collection browser_.',
|
|
215
|
+
}),
|
|
216
|
+
add_options: z
|
|
217
|
+
.array(z.union([AddOptionSchema, HrefAddOptionSchema]))
|
|
218
|
+
.optional()
|
|
219
|
+
.meta({
|
|
220
|
+
description:
|
|
221
|
+
'This key defines the options available in the _+ Add_ button dropdown at the top right of your _Collection browser_.',
|
|
222
|
+
}),
|
|
223
|
+
create: CreateSchema.optional(),
|
|
224
|
+
disable_add: z.boolean().optional().meta({
|
|
225
|
+
description:
|
|
226
|
+
'This key toggles whether team members can use the _+ Add_ button in the top right of the _Collection browser_ to add files to a Collection.',
|
|
227
|
+
}),
|
|
228
|
+
disable_add_folder: z.boolean().optional().meta({
|
|
229
|
+
description:
|
|
230
|
+
'This key toggles whether team members can use the _+ Add_ button in the top right of the _Collection browser_ to add subfolders to a Collection.',
|
|
231
|
+
}),
|
|
232
|
+
disable_file_actions: z.boolean().optional().meta({
|
|
233
|
+
description:
|
|
234
|
+
'This key toggles whether team members can use the _+ Add_ button in the top right of the _Collection browser_ to add files to a Collection.',
|
|
235
|
+
}),
|
|
236
|
+
new_preview_url: z.string().optional().meta({
|
|
237
|
+
description:
|
|
238
|
+
'This key defines a new URL for previewing your unbuilt pages in the Visual Editor.',
|
|
239
|
+
}),
|
|
240
|
+
schemas: z.record(z.string(), SchemaSchema).optional().meta({
|
|
241
|
+
description:
|
|
242
|
+
'This key defines which Schemas are available to populate files in this Collection.',
|
|
243
|
+
}),
|
|
244
|
+
schema_key: z.string().optional().meta({
|
|
245
|
+
description:
|
|
246
|
+
'This key defines the name for the structured data key that references the Schema a file uses.',
|
|
247
|
+
}),
|
|
248
|
+
})
|
|
249
|
+
.meta({
|
|
250
|
+
title: 'CollectionConfig',
|
|
251
|
+
description:
|
|
252
|
+
'Definitions for your Collections, which are the sets of content files for your site grouped by folder.',
|
|
253
|
+
});
|
|
254
|
+
|
|
255
|
+
export const CollectionGroupSchema = z
|
|
256
|
+
.object({
|
|
257
|
+
heading: z.string().meta({
|
|
258
|
+
description: 'Short, descriptive label for this group of Collections.',
|
|
259
|
+
}),
|
|
260
|
+
collections: z.array(z.string()).meta({
|
|
261
|
+
description:
|
|
262
|
+
'The collections shown in the sidebar for this group. Collections here are referenced by their key within `collections_config`.',
|
|
263
|
+
}),
|
|
264
|
+
})
|
|
265
|
+
.meta({
|
|
266
|
+
title: 'Collection Group',
|
|
267
|
+
description:
|
|
268
|
+
'Defines which Collections are shown in the Site Navigation and how those Collections are grouped.',
|
|
269
|
+
});
|
|
270
|
+
|
|
271
|
+
export const DataConfigEntrySchema = z
|
|
272
|
+
.object({
|
|
273
|
+
path: z.string().meta({
|
|
274
|
+
id: 'DataConfigEntry.path',
|
|
275
|
+
description: 'The path to a file or folder of files containing data.',
|
|
276
|
+
}),
|
|
277
|
+
})
|
|
278
|
+
.meta({
|
|
279
|
+
id: 'DataConfigEntry',
|
|
280
|
+
title: 'Data Config Entry',
|
|
281
|
+
description: 'Controls what data sets are available to populate select and multiselect inputs.',
|
|
282
|
+
});
|
|
283
|
+
|
|
284
|
+
export const FileConfigEntrySchema = z
|
|
285
|
+
.object({
|
|
286
|
+
...CascadeSchema.shape,
|
|
287
|
+
glob: z.union([z.array(z.string()), z.string()]).meta({
|
|
288
|
+
description: 'The glob pattern(s) targeting a path to one or more files.',
|
|
289
|
+
}),
|
|
290
|
+
})
|
|
291
|
+
.meta({
|
|
292
|
+
title: 'FileConfigEntry',
|
|
293
|
+
description:
|
|
294
|
+
'Provides scope to configure at a file level, without adding configuration to files.',
|
|
295
|
+
});
|
|
296
|
+
|
|
297
|
+
export const EditorSchema = z.object({
|
|
298
|
+
default_path: z.string().default('/').meta({
|
|
299
|
+
description:
|
|
300
|
+
'The URL used for the dashboard screenshot, and where the editor opens to when clicking the dashboard "Edit Home" button.',
|
|
301
|
+
}),
|
|
302
|
+
});
|
|
303
|
+
|
|
304
|
+
export const CommitTemplateSchema = z
|
|
305
|
+
.object({
|
|
306
|
+
label: z.string().optional().meta({
|
|
307
|
+
description:
|
|
308
|
+
'Used to identify a commit template when multiple commit templates are available.',
|
|
309
|
+
}),
|
|
310
|
+
template_string: z.string().optional().meta({
|
|
311
|
+
description:
|
|
312
|
+
'Set the string for the commit template. This will only be used if `template_path` is not set.',
|
|
313
|
+
}),
|
|
314
|
+
template_path: z.string().optional().meta({
|
|
315
|
+
description:
|
|
316
|
+
'Sets the path for a file containing your commit template. The file path should be relative to the root directory.',
|
|
317
|
+
}),
|
|
318
|
+
_inputs: z.record(z.string(), InputSchema).optional().meta({
|
|
319
|
+
title: 'Inputs',
|
|
320
|
+
description: 'Define inputs used to populate data placeholders in the commit template.',
|
|
321
|
+
}),
|
|
322
|
+
extra_data: z.record(z.string(), z.string()).optional().meta({
|
|
323
|
+
description: 'Define additional template strings, for building nested templates.',
|
|
324
|
+
}),
|
|
325
|
+
wrap_width: z.number().optional().meta({
|
|
326
|
+
description: 'Sets the width of the text wrap in the editor.',
|
|
327
|
+
}),
|
|
328
|
+
})
|
|
329
|
+
.meta({
|
|
330
|
+
title: 'Commit Template',
|
|
331
|
+
description: 'A template for commit messages when saving changes.',
|
|
332
|
+
});
|
|
333
|
+
|
|
334
|
+
export const ConfigurationSchema = z
|
|
335
|
+
.object({
|
|
336
|
+
...CascadeSchema.shape,
|
|
337
|
+
paths: PathsSchema.optional(),
|
|
338
|
+
version: z.literal('latest').optional().meta({
|
|
339
|
+
description:
|
|
340
|
+
'Controls which schema this file is validated against. Defaults to the latest schema.',
|
|
341
|
+
}),
|
|
342
|
+
source: z
|
|
343
|
+
.string()
|
|
344
|
+
.optional()
|
|
345
|
+
.meta({
|
|
346
|
+
description: `This key defines the base path for your source files, relative to the root folder of your
|
|
347
|
+
repository. Unless you use a nested folder as the source for your Site you can leave this key
|
|
348
|
+
empty or set it to \`/\`.
|
|
349
|
+
|
|
350
|
+
By default, this key is empty.
|
|
351
|
+
|
|
352
|
+
https://cloudcannon.com/documentation/articles/configuration-file-reference/#source',`,
|
|
353
|
+
}),
|
|
354
|
+
collections_config: z.record(z.string(), CollectionConfigSchema).optional().meta({
|
|
355
|
+
description:
|
|
356
|
+
'Definitions for your collections, which are the sets of content files for your site grouped by folder.',
|
|
357
|
+
}),
|
|
358
|
+
collection_groups: z.array(CollectionGroupSchema).optional().meta({
|
|
359
|
+
description:
|
|
360
|
+
'Defines which collections are shown in the site navigation and how those collections are grouped.',
|
|
361
|
+
}),
|
|
362
|
+
base_url: z.string().optional().meta({
|
|
363
|
+
description: 'The subpath where your output files are hosted.',
|
|
364
|
+
}),
|
|
365
|
+
data_config: z.record(z.string(), DataConfigEntrySchema).optional().meta({
|
|
366
|
+
description:
|
|
367
|
+
'Controls what data sets are available to populate select and multiselect inputs.',
|
|
368
|
+
}),
|
|
369
|
+
file_config: z.array(FileConfigEntrySchema).optional().meta({
|
|
370
|
+
description:
|
|
371
|
+
'Provides scope to configure at a file level, without adding configuration to files.',
|
|
372
|
+
}),
|
|
373
|
+
editor: EditorSchema.optional().meta({
|
|
374
|
+
description: 'Contains settings for the default editor actions on your site.',
|
|
375
|
+
}),
|
|
376
|
+
source_editor: SourceEditorSchema.optional().meta({
|
|
377
|
+
title: 'Source Editor',
|
|
378
|
+
description:
|
|
379
|
+
'This key defines the appearance and behavior of the Source Editor. The following nested keys are available:\n\n- `tab_size`\n- `show_gutter`\n- `theme`\n\nThis key has no default.\n\nhttps://cloudcannon.com/documentation/articles/the-source-editor/#source_editor',
|
|
380
|
+
}),
|
|
381
|
+
commit_templates: z.array(CommitTemplateSchema).optional().meta({
|
|
382
|
+
description: 'Templates for commit messages when saving changes.',
|
|
383
|
+
}),
|
|
384
|
+
upstream_commit_template: z.string().optional().meta({
|
|
385
|
+
description: 'The commit template to use when pulling changes from the upstream repository.',
|
|
386
|
+
}),
|
|
387
|
+
markdown: MarkdownSettingsSchema.optional().meta({
|
|
388
|
+
description: 'Contains settings for various Markdown engines.',
|
|
389
|
+
}),
|
|
390
|
+
timezone: TimezoneSchema.default('Etc/UTC').optional().meta({
|
|
391
|
+
description: 'Specifies the time zone that dates are displayed and edited in.',
|
|
392
|
+
}),
|
|
393
|
+
_snippets: z.record(z.string(), SnippetConfigSchema).optional().meta({
|
|
394
|
+
description: 'Configuration for custom snippets.',
|
|
395
|
+
}),
|
|
396
|
+
_snippets_imports: SnippetsImportsSchema.optional(),
|
|
397
|
+
_snippets_templates: z.record(z.string(), SnippetConfigSchema).optional().meta({
|
|
398
|
+
description: 'Extended option used when creating more complex custom snippets.',
|
|
399
|
+
}),
|
|
400
|
+
_snippets_definitions: z.record(z.string(), SnippetConfigSchema).optional().meta({
|
|
401
|
+
description: 'Extended option used when creating more complex custom snippets.',
|
|
402
|
+
}),
|
|
403
|
+
})
|
|
404
|
+
.meta({
|
|
405
|
+
title: 'Configuration',
|
|
406
|
+
description: 'The main CloudCannon configuration schema.',
|
|
407
|
+
});
|
|
408
|
+
|
|
409
|
+
export type HrefAddOption = z.infer<typeof HrefAddOptionSchema>;
|
|
410
|
+
export type AddOption = z.infer<typeof AddOptionSchema>;
|
|
411
|
+
export type Sort = z.infer<typeof SortSchema>;
|
|
412
|
+
export type SortOption = z.infer<typeof SortOptionSchema>;
|
|
413
|
+
export type Create = z.infer<typeof CreateSchema>;
|
|
414
|
+
export type Schema = z.infer<typeof SchemaSchema>;
|
|
415
|
+
export type CollectionConfig = z.infer<typeof CollectionConfigSchema>;
|
|
416
|
+
export type CollectionGroup = z.infer<typeof CollectionGroupSchema>;
|
|
417
|
+
export type DataConfigEntry = z.infer<typeof DataConfigEntrySchema>;
|
|
418
|
+
export type FileConfigEntry = z.infer<typeof FileConfigEntrySchema>;
|
|
419
|
+
export type Editor = z.infer<typeof EditorSchema>;
|
|
420
|
+
export type CommitTemplate = z.infer<typeof CommitTemplateSchema>;
|
|
421
|
+
export type Configuration = z.infer<typeof ConfigurationSchema>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import * as z from 'zod';
|
|
2
|
+
import { IconSchema } from './icon';
|
|
3
|
+
|
|
4
|
+
export const DocumentationSchema = z
|
|
5
|
+
.object({
|
|
6
|
+
url: z.string().meta({
|
|
7
|
+
description: 'The "href" value of the link.',
|
|
8
|
+
}),
|
|
9
|
+
text: z.string().optional().meta({
|
|
10
|
+
description: 'The visible text used in the link.',
|
|
11
|
+
}),
|
|
12
|
+
icon: IconSchema.default('auto_stories').optional().meta({
|
|
13
|
+
description: 'The icon displayed next to the link.',
|
|
14
|
+
}),
|
|
15
|
+
})
|
|
16
|
+
.meta({
|
|
17
|
+
id: 'documentation',
|
|
18
|
+
title: 'Documentation',
|
|
19
|
+
description: 'Configuration for documentation links displayed in the CloudCannon interface.',
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
export type Documentation = z.infer<typeof DocumentationSchema>;
|
package/src/editables.ts
ADDED
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
import * as z from 'zod';
|
|
2
|
+
import { ImageOptionsSchema } from './image-options';
|
|
3
|
+
import { PathsSchema } from './paths';
|
|
4
|
+
|
|
5
|
+
export const TextEditableSchema = z.object({
|
|
6
|
+
paths: PathsSchema.optional(),
|
|
7
|
+
|
|
8
|
+
bold: z.boolean().default(true).optional().meta({
|
|
9
|
+
id: 'bold',
|
|
10
|
+
description: 'Enables a control to set selected text to bold.',
|
|
11
|
+
}),
|
|
12
|
+
|
|
13
|
+
copyformatting: z.boolean().default(false).optional().meta({
|
|
14
|
+
id: 'copyformatting',
|
|
15
|
+
description:
|
|
16
|
+
'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.',
|
|
17
|
+
}),
|
|
18
|
+
|
|
19
|
+
italic: z.boolean().default(true).optional().meta({
|
|
20
|
+
id: 'italic',
|
|
21
|
+
description: 'Enables a control to italicize selected text.',
|
|
22
|
+
}),
|
|
23
|
+
|
|
24
|
+
link: z.boolean().default(true).optional().meta({
|
|
25
|
+
id: 'link',
|
|
26
|
+
description: 'Enables a control to create hyperlinks around selected text.',
|
|
27
|
+
}),
|
|
28
|
+
|
|
29
|
+
redo: z.boolean().default(false).optional().meta({
|
|
30
|
+
id: 'redo',
|
|
31
|
+
description:
|
|
32
|
+
'Enables a control to redo recent edits undone with undo. Redo is always enabled through standard OS-specific keyboard shortcuts.',
|
|
33
|
+
}),
|
|
34
|
+
|
|
35
|
+
removeformat: z.boolean().default(true).optional().meta({
|
|
36
|
+
id: 'removeformat',
|
|
37
|
+
description:
|
|
38
|
+
'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.',
|
|
39
|
+
}),
|
|
40
|
+
|
|
41
|
+
strike: z.boolean().default(false).optional().meta({
|
|
42
|
+
id: 'strike',
|
|
43
|
+
description: 'Enables a control to strike selected text.',
|
|
44
|
+
}),
|
|
45
|
+
|
|
46
|
+
subscript: z.boolean().default(false).optional().meta({
|
|
47
|
+
id: 'subscript',
|
|
48
|
+
description: 'Enables a control to set selected text to subscript.',
|
|
49
|
+
}),
|
|
50
|
+
|
|
51
|
+
superscript: z.boolean().default(false).optional().meta({
|
|
52
|
+
id: 'superscript',
|
|
53
|
+
description: 'Enables a control to set selected text to superscript.',
|
|
54
|
+
}),
|
|
55
|
+
|
|
56
|
+
underline: z.boolean().default(false).optional().meta({
|
|
57
|
+
id: 'underline',
|
|
58
|
+
description: 'Enables a control to underline selected text.',
|
|
59
|
+
}),
|
|
60
|
+
|
|
61
|
+
undo: z.boolean().default(false).optional().meta({
|
|
62
|
+
id: 'undo',
|
|
63
|
+
description:
|
|
64
|
+
'Enables a control to undo recent edits. Undo is always enabled through standard OS-specific keyboard shortcuts.',
|
|
65
|
+
}),
|
|
66
|
+
|
|
67
|
+
remove_custom_markup: z.boolean().optional().meta({
|
|
68
|
+
id: 'remove_custom_markup',
|
|
69
|
+
description:
|
|
70
|
+
'Defines if the content should be stripped of "custom markup". It is recommended to have this option turned on once you have all of your rich text options configured. Having `allow_custom_markup` turned on disables this option. Defaults to false.',
|
|
71
|
+
}),
|
|
72
|
+
|
|
73
|
+
allow_custom_markup: z.boolean().optional().meta({
|
|
74
|
+
id: 'allow_custom_markup',
|
|
75
|
+
description:
|
|
76
|
+
'Defines if the content can contain "custom markup". It is not recommended to have this option turned on. Defaults to true for non-content editable regions, false otherwise.',
|
|
77
|
+
}),
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
export const ToolbarOptionsSchema = z.object({
|
|
81
|
+
...TextEditableSchema.shape,
|
|
82
|
+
|
|
83
|
+
blockquote: z.boolean().default(true).optional().meta({
|
|
84
|
+
id: 'blockquote',
|
|
85
|
+
description: 'Enables a control to wrap blocks of text in block quotes.',
|
|
86
|
+
}),
|
|
87
|
+
|
|
88
|
+
bulletedlist: z.boolean().default(true).optional().meta({
|
|
89
|
+
id: 'bulletedlist',
|
|
90
|
+
description:
|
|
91
|
+
'Enables a control to insert an unordered list, or to convert selected blocks of text into a unordered list.',
|
|
92
|
+
}),
|
|
93
|
+
|
|
94
|
+
center: z.string().optional().meta({
|
|
95
|
+
id: 'center',
|
|
96
|
+
description:
|
|
97
|
+
'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.',
|
|
98
|
+
}),
|
|
99
|
+
|
|
100
|
+
code_inline: z.boolean().default(false).optional().meta({
|
|
101
|
+
id: 'code_inline',
|
|
102
|
+
description:
|
|
103
|
+
'Enables a control to create an inline code element, containing any selected text.',
|
|
104
|
+
}),
|
|
105
|
+
|
|
106
|
+
code_block: z.boolean().default(false).optional().meta({
|
|
107
|
+
id: 'code_block',
|
|
108
|
+
description: 'Enables a control to insert a code block.',
|
|
109
|
+
}),
|
|
110
|
+
|
|
111
|
+
code: z.boolean().default(false).optional().meta({
|
|
112
|
+
id: 'code',
|
|
113
|
+
description: 'Enables both block and inline code controls: `code_block` and `code_inline`.',
|
|
114
|
+
}),
|
|
115
|
+
|
|
116
|
+
embed: z.boolean().default(false).optional().meta({
|
|
117
|
+
id: 'embed',
|
|
118
|
+
description:
|
|
119
|
+
'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.',
|
|
120
|
+
}),
|
|
121
|
+
|
|
122
|
+
format: z.string().default('p h1 h2 h3 h4 h5 h6').optional().meta({
|
|
123
|
+
id: 'format',
|
|
124
|
+
description:
|
|
125
|
+
'Enables a drop down menu for structured text. Has options for "p", "h1", "h2", "h3", "h4", "h5", "h6". Set as space separated options (e.g. "p h1 h2").',
|
|
126
|
+
}),
|
|
127
|
+
|
|
128
|
+
horizontalrule: z.boolean().default(false).optional().meta({
|
|
129
|
+
id: 'horizontalrule',
|
|
130
|
+
description: 'Enables a control to insert a horizontal rule.',
|
|
131
|
+
}),
|
|
132
|
+
|
|
133
|
+
image: z.boolean().default(true).optional().meta({
|
|
134
|
+
id: 'image',
|
|
135
|
+
description:
|
|
136
|
+
'Enables a control to insert an image. The image can be uploaded, existing or an external link.',
|
|
137
|
+
}),
|
|
138
|
+
|
|
139
|
+
indent: z.boolean().default(false).optional().meta({
|
|
140
|
+
id: 'indent',
|
|
141
|
+
description: 'Enables a control to increase indentation for numbered and unordered lists.',
|
|
142
|
+
}),
|
|
143
|
+
|
|
144
|
+
justify: z.string().optional().meta({
|
|
145
|
+
id: 'justify',
|
|
146
|
+
description:
|
|
147
|
+
'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.',
|
|
148
|
+
}),
|
|
149
|
+
|
|
150
|
+
left: z.string().optional().meta({
|
|
151
|
+
id: 'left',
|
|
152
|
+
description:
|
|
153
|
+
'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.',
|
|
154
|
+
}),
|
|
155
|
+
|
|
156
|
+
numberedlist: z.boolean().default(true).optional().meta({
|
|
157
|
+
id: 'numberedlist',
|
|
158
|
+
description:
|
|
159
|
+
'Enables a control to insert a numbered list, or to convert selected blocks of text into a numbered list.',
|
|
160
|
+
}),
|
|
161
|
+
|
|
162
|
+
outdent: z.boolean().default(false).optional().meta({
|
|
163
|
+
id: 'outdent',
|
|
164
|
+
description: 'Enables a control to reduce indentation for numbered and unordered lists.',
|
|
165
|
+
}),
|
|
166
|
+
|
|
167
|
+
right: z.string().optional().meta({
|
|
168
|
+
id: 'right',
|
|
169
|
+
description:
|
|
170
|
+
'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.',
|
|
171
|
+
}),
|
|
172
|
+
|
|
173
|
+
snippet: z.boolean().default(true).optional().meta({
|
|
174
|
+
id: 'snippet',
|
|
175
|
+
description: 'Enables a control to insert snippets, if any are available.',
|
|
176
|
+
}),
|
|
177
|
+
|
|
178
|
+
styles: z.string().optional().meta({
|
|
179
|
+
id: 'styles',
|
|
180
|
+
description:
|
|
181
|
+
'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.',
|
|
182
|
+
}),
|
|
183
|
+
|
|
184
|
+
table: z.boolean().default(false).optional().meta({
|
|
185
|
+
id: 'table',
|
|
186
|
+
description:
|
|
187
|
+
'Enables a control to insert a table. Further options for table cells are available in the context menu for cells within the editor.',
|
|
188
|
+
}),
|
|
189
|
+
|
|
190
|
+
join_above: z.boolean().default(false).optional().meta({
|
|
191
|
+
id: 'join_above',
|
|
192
|
+
description: 'Enables a control to join the selected block with the block above it.',
|
|
193
|
+
}),
|
|
194
|
+
|
|
195
|
+
join_below: z.boolean().default(false).optional().meta({
|
|
196
|
+
id: 'join_below',
|
|
197
|
+
description: 'Enables a control to join the selected block with the block below it.',
|
|
198
|
+
}),
|
|
199
|
+
});
|
|
200
|
+
|
|
201
|
+
export const BlockEditableSchema = z.object({
|
|
202
|
+
...ImageOptionsSchema.shape,
|
|
203
|
+
...TextEditableSchema.shape,
|
|
204
|
+
...ToolbarOptionsSchema.shape,
|
|
205
|
+
});
|
|
206
|
+
|
|
207
|
+
export const ImageEditableSchema = z.object({
|
|
208
|
+
...ImageOptionsSchema.shape,
|
|
209
|
+
paths: PathsSchema.optional(),
|
|
210
|
+
});
|
|
211
|
+
|
|
212
|
+
export const LinkEditableSchema = z.object({
|
|
213
|
+
paths: PathsSchema.optional(),
|
|
214
|
+
});
|
|
215
|
+
|
|
216
|
+
export const EditablesSchema = z.object({
|
|
217
|
+
content: BlockEditableSchema.optional().meta({
|
|
218
|
+
description: 'Contains input options for the Content Editor.',
|
|
219
|
+
}),
|
|
220
|
+
|
|
221
|
+
block: BlockEditableSchema.optional().meta({
|
|
222
|
+
description: 'Contains input options for block Editable Regions.',
|
|
223
|
+
}),
|
|
224
|
+
|
|
225
|
+
link: LinkEditableSchema.optional().meta({
|
|
226
|
+
description: 'Contains input options for link Editable Regions.',
|
|
227
|
+
}),
|
|
228
|
+
|
|
229
|
+
image: ImageEditableSchema.optional().meta({
|
|
230
|
+
description: 'Contains input options for image Editable Regions.',
|
|
231
|
+
}),
|
|
232
|
+
|
|
233
|
+
text: TextEditableSchema.optional().meta({
|
|
234
|
+
description: 'Contains input options for text Editable Regions.',
|
|
235
|
+
}),
|
|
236
|
+
});
|
|
237
|
+
|
|
238
|
+
export type ToolbarOptions = z.infer<typeof ToolbarOptionsSchema>;
|
|
239
|
+
export type TextEditable = z.infer<typeof TextEditableSchema>;
|
|
240
|
+
export type BlockEditable = z.infer<typeof BlockEditableSchema>;
|
|
241
|
+
export type ImageEditable = z.infer<typeof ImageEditableSchema>;
|
|
242
|
+
export type LinkEditable = z.infer<typeof LinkEditableSchema>;
|
|
243
|
+
export type Editables = z.infer<typeof EditablesSchema>;
|