@cloudcannon/configuration-types 0.0.44 → 0.0.46

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloudcannon/configuration-types",
3
- "version": "0.0.44",
3
+ "version": "0.0.46",
4
4
  "type": "module",
5
5
  "description": "Contains TypeScript declarations and generates JSONSchema files for the CloudCannon configuration file.",
6
6
  "author": "CloudCannon <support@cloudcannon.com>",
package/src/cascade.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import * as z from 'zod';
2
- import { EditablesSchema } from './editables.ts';
3
- import { InputsSchema } from './inputs.ts';
2
+ import { EditablesFromGlobSchema, EditablesSchema } from './editables.ts';
3
+ import { InputsFromGlobSchema, InputsSchema } from './inputs.ts';
4
4
  import { SelectDataSchema } from './select-values.ts';
5
- import { StructuresSchema } from './structures.ts';
5
+ import { StructuresFromGlobSchema, StructuresSchema } from './structures.ts';
6
6
 
7
7
  export const EditorKeySchema = z.enum(['visual', 'content', 'data']).meta({
8
8
  id: 'EditorKey',
@@ -12,10 +12,10 @@ export const EditorKeySchema = z.enum(['visual', 'content', 'data']).meta({
12
12
 
13
13
  export const ReducedCascadeSchema = z.object({
14
14
  _inputs: InputsSchema.optional(),
15
- _inputs_from_glob: z.array(z.string()).optional(),
15
+ _inputs_from_glob: InputsFromGlobSchema.optional(),
16
16
  _select_data: SelectDataSchema.optional(),
17
17
  _structures: StructuresSchema.optional(),
18
- _structures_from_glob: z.array(z.string()).optional(),
18
+ _structures_from_glob: StructuresFromGlobSchema.optional(),
19
19
  });
20
20
 
21
21
  export const CascadeSchema = z.object({
@@ -33,7 +33,7 @@ export const CascadeSchema = z.object({
33
33
  description:
34
34
  'Configuration for editable regions in the Visual Editor, including content, block, link, image, and text editing options.',
35
35
  }),
36
- _editables_from_glob: z.array(z.string()).optional(),
36
+ _editables_from_glob: EditablesFromGlobSchema.optional(),
37
37
  });
38
38
 
39
39
  export type EditorKey = z.infer<typeof EditorKeySchema>;
@@ -94,7 +94,7 @@ export const CreateSchema = z
94
94
  ...ReducedCascadeSchema.shape,
95
95
  })
96
96
  .meta({
97
- id: 'create',
97
+ id: 'type.create',
98
98
  title: 'Create',
99
99
  description: 'Controls where new files are saved.',
100
100
  });
@@ -110,7 +110,7 @@ export const SchemaSchema = z
110
110
  }),
111
111
  icon: IconSchema.default('notes').optional().meta({
112
112
  description:
113
- '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.',
113
+ 'Displayed in the add menu when creating new files; also used as the icon for collection files if no other preview is found.',
114
114
  }),
115
115
  create: CreateSchema.optional(),
116
116
  new_preview_url: z.string().optional().meta({
@@ -119,7 +119,7 @@ export const SchemaSchema = z
119
119
  }),
120
120
  reorder_inputs: z.boolean().default(true).optional().meta({
121
121
  description:
122
- '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.',
122
+ 'If true, inputs are sorted to match when editing. Extra inputs are ordered after expected inputs, unless `remove_extra_inputs` is true.',
123
123
  }),
124
124
  hide_extra_inputs: z.boolean().default(false).optional().meta({
125
125
  description:
@@ -127,10 +127,10 @@ export const SchemaSchema = z
127
127
  }),
128
128
  remove_empty_inputs: z.boolean().default(false).optional().meta({
129
129
  description:
130
- '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.',
130
+ '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.',
131
131
  }),
132
132
  remove_extra_inputs: z.boolean().default(true).optional().meta({
133
- description: 'If checked, extra inputs are removed when editing. Defaults to true.',
133
+ description: 'If checked, extra inputs are removed when editing.',
134
134
  }),
135
135
  preview: PreviewSchema.optional(),
136
136
  ...CascadeSchema.shape,
@@ -231,7 +231,7 @@ export const CollectionConfigSchema = z
231
231
  description:
232
232
  'This key defines which Schemas are available to populate files in this Collection.',
233
233
  }),
234
- schemas_config_from_glob: z.array(z.string()).optional(),
234
+ schemas_from_glob: z.array(z.string()).optional(),
235
235
  schema_key: z.string().optional().meta({
236
236
  description:
237
237
  'This key defines the name for the structured data key that references the Schema a file uses.',
@@ -14,7 +14,7 @@ export const DocumentationSchema = z
14
14
  }),
15
15
  })
16
16
  .meta({
17
- id: 'documentation',
17
+ id: 'type.documentation',
18
18
  title: 'Documentation',
19
19
  description: 'Configuration for documentation links displayed in the CloudCannon interface.',
20
20
  });
package/src/editables.ts CHANGED
@@ -6,72 +6,72 @@ export const TextEditableSchema = z.object({
6
6
  paths: PathsSchema.optional(),
7
7
 
8
8
  bold: z.boolean().default(true).optional().meta({
9
- id: 'bold',
9
+ id: 'type._editables.*.bold',
10
10
  description: 'Enables a control to set selected text to bold.',
11
11
  }),
12
12
 
13
13
  copyformatting: z.boolean().default(false).optional().meta({
14
- id: 'copyformatting',
14
+ id: 'type._editables.*.copyformatting',
15
15
  description:
16
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
17
  }),
18
18
 
19
19
  italic: z.boolean().default(true).optional().meta({
20
- id: 'italic',
20
+ id: 'type._editables.*.italic',
21
21
  description: 'Enables a control to italicize selected text.',
22
22
  }),
23
23
 
24
24
  link: z.boolean().default(true).optional().meta({
25
- id: 'link',
25
+ id: 'type._editables.*.link',
26
26
  description: 'Enables a control to create hyperlinks around selected text.',
27
27
  }),
28
28
 
29
29
  redo: z.boolean().default(false).optional().meta({
30
- id: 'redo',
30
+ id: 'type._editables.*.redo',
31
31
  description:
32
32
  'Enables a control to redo recent edits undone with undo. Redo is always enabled through standard OS-specific keyboard shortcuts.',
33
33
  }),
34
34
 
35
35
  removeformat: z.boolean().default(true).optional().meta({
36
- id: 'removeformat',
36
+ id: 'type._editables.*.removeformat',
37
37
  description:
38
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
39
  }),
40
40
 
41
41
  strike: z.boolean().default(false).optional().meta({
42
- id: 'strike',
42
+ id: 'type._editables.*.strike',
43
43
  description: 'Enables a control to strike selected text.',
44
44
  }),
45
45
 
46
46
  subscript: z.boolean().default(false).optional().meta({
47
- id: 'subscript',
47
+ id: 'type._editables.*.subscript',
48
48
  description: 'Enables a control to set selected text to subscript.',
49
49
  }),
50
50
 
51
51
  superscript: z.boolean().default(false).optional().meta({
52
- id: 'superscript',
52
+ id: 'type._editables.*.superscript',
53
53
  description: 'Enables a control to set selected text to superscript.',
54
54
  }),
55
55
 
56
56
  underline: z.boolean().default(false).optional().meta({
57
- id: 'underline',
57
+ id: 'type._editables.*.underline',
58
58
  description: 'Enables a control to underline selected text.',
59
59
  }),
60
60
 
61
61
  undo: z.boolean().default(false).optional().meta({
62
- id: 'undo',
62
+ id: 'type._editables.*.undo',
63
63
  description:
64
64
  'Enables a control to undo recent edits. Undo is always enabled through standard OS-specific keyboard shortcuts.',
65
65
  }),
66
66
 
67
67
  remove_custom_markup: z.boolean().optional().meta({
68
- id: 'remove_custom_markup',
68
+ id: 'type._editables.*.remove_custom_markup',
69
69
  description:
70
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
71
  }),
72
72
 
73
73
  allow_custom_markup: z.boolean().optional().meta({
74
- id: 'allow_custom_markup',
74
+ id: 'type._editables.*.allow_custom_markup',
75
75
  description:
76
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
77
  }),
@@ -81,119 +81,119 @@ export const ToolbarOptionsSchema = z.object({
81
81
  ...TextEditableSchema.shape,
82
82
 
83
83
  blockquote: z.boolean().default(true).optional().meta({
84
- id: 'blockquote',
84
+ id: 'type._editables.*.blockquote',
85
85
  description: 'Enables a control to wrap blocks of text in block quotes.',
86
86
  }),
87
87
 
88
88
  bulletedlist: z.boolean().default(true).optional().meta({
89
- id: 'bulletedlist',
89
+ id: 'type._editables.*.bulletedlist',
90
90
  description:
91
91
  'Enables a control to insert an unordered list, or to convert selected blocks of text into a unordered list.',
92
92
  }),
93
93
 
94
94
  center: z.string().optional().meta({
95
- id: 'center',
95
+ id: 'type._editables.*.center',
96
96
  description:
97
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
98
  }),
99
99
 
100
100
  code_inline: z.boolean().default(false).optional().meta({
101
- id: 'code_inline',
101
+ id: 'type._editables.*.code_inline',
102
102
  description:
103
103
  'Enables a control to create an inline code element, containing any selected text.',
104
104
  }),
105
105
 
106
106
  code_block: z.boolean().default(false).optional().meta({
107
- id: 'code_block',
107
+ id: 'type._editables.*.code_block',
108
108
  description: 'Enables a control to insert a code block.',
109
109
  }),
110
110
 
111
111
  code: z.boolean().default(false).optional().meta({
112
- id: 'code',
112
+ id: 'type._editables.*.code',
113
113
  description: 'Enables both block and inline code controls: `code_block` and `code_inline`.',
114
114
  }),
115
115
 
116
116
  embed: z.boolean().default(false).optional().meta({
117
- id: 'embed',
117
+ id: 'type._editables.*.embed',
118
118
  description:
119
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
120
  }),
121
121
 
122
122
  format: z.string().default('p h1 h2 h3 h4 h5 h6').optional().meta({
123
- id: 'format',
123
+ id: 'type._editables.*.format',
124
124
  description:
125
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
126
  }),
127
127
 
128
128
  horizontalrule: z.boolean().default(false).optional().meta({
129
- id: 'horizontalrule',
129
+ id: 'type._editables.*.horizontalrule',
130
130
  description: 'Enables a control to insert a horizontal rule.',
131
131
  }),
132
132
 
133
133
  image: z.boolean().default(true).optional().meta({
134
- id: 'image',
134
+ id: 'type._editables.*.image',
135
135
  description:
136
136
  'Enables a control to insert an image. The image can be uploaded, existing or an external link.',
137
137
  }),
138
138
 
139
139
  indent: z.boolean().default(false).optional().meta({
140
- id: 'indent',
140
+ id: 'type._editables.*.indent',
141
141
  description: 'Enables a control to increase indentation for numbered and unordered lists.',
142
142
  }),
143
143
 
144
144
  justify: z.string().optional().meta({
145
- id: 'justify',
145
+ id: 'type._editables.*.justify',
146
146
  description:
147
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
148
  }),
149
149
 
150
150
  left: z.string().optional().meta({
151
- id: 'left',
151
+ id: 'type._editables.*.left',
152
152
  description:
153
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
154
  }),
155
155
 
156
156
  numberedlist: z.boolean().default(true).optional().meta({
157
- id: 'numberedlist',
157
+ id: 'type._editables.*.numberedlist',
158
158
  description:
159
159
  'Enables a control to insert a numbered list, or to convert selected blocks of text into a numbered list.',
160
160
  }),
161
161
 
162
162
  outdent: z.boolean().default(false).optional().meta({
163
- id: 'outdent',
163
+ id: 'type._editables.*.outdent',
164
164
  description: 'Enables a control to reduce indentation for numbered and unordered lists.',
165
165
  }),
166
166
 
167
167
  right: z.string().optional().meta({
168
- id: 'right',
168
+ id: 'type._editables.*.right',
169
169
  description:
170
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
171
  }),
172
172
 
173
173
  snippet: z.boolean().default(true).optional().meta({
174
- id: 'snippet',
174
+ id: 'type._editables.*.snippet',
175
175
  description: 'Enables a control to insert snippets, if any are available.',
176
176
  }),
177
177
 
178
178
  styles: z.string().optional().meta({
179
- id: 'styles',
179
+ id: 'type._editables.*.styles',
180
180
  description:
181
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
182
  }),
183
183
 
184
184
  table: z.boolean().default(false).optional().meta({
185
- id: 'table',
185
+ id: 'type._editables.*.table',
186
186
  description:
187
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
188
  }),
189
189
 
190
190
  join_above: z.boolean().default(false).optional().meta({
191
- id: 'join_above',
191
+ id: 'type._editables.*.join_above',
192
192
  description: 'Enables a control to join the selected block with the block above it.',
193
193
  }),
194
194
 
195
195
  join_below: z.boolean().default(false).optional().meta({
196
- id: 'join_below',
196
+ id: 'type._editables.*.join_below',
197
197
  description: 'Enables a control to join the selected block with the block below it.',
198
198
  }),
199
199
  });
@@ -245,6 +245,10 @@ export const EditablesSchema = z.object({
245
245
  }),
246
246
  });
247
247
 
248
+ export const EditablesFromGlobSchema = z.array(z.string()).meta({
249
+ id: 'type._editables_from_glob',
250
+ });
251
+
248
252
  export type ToolbarOptions = z.infer<typeof ToolbarOptionsSchema>;
249
253
  export type TextEditable = z.infer<typeof TextEditableSchema>;
250
254
  export type BlockEditable = z.infer<typeof BlockEditableSchema>;
@@ -2,49 +2,49 @@ import * as z from 'zod';
2
2
 
3
3
  export const ImageOptionsSchema = z.object({
4
4
  mime_type: z.enum(['image/jpeg', 'image/png', 'image/webp']).optional().meta({
5
- id: 'mime_type',
5
+ id: 'type._inputs.*.options.mime_type',
6
6
  title: 'Mime Type',
7
7
  description:
8
8
  '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.',
9
9
  }),
10
10
  resize_style: z.enum(['cover', 'contain', 'stretch', 'crop']).default('contain').optional().meta({
11
- id: 'resize_style',
11
+ id: 'type._inputs.*.options.resize_style',
12
12
  title: 'Resize Style',
13
13
  description:
14
14
  '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.',
15
15
  }),
16
16
  width: z.number().optional().meta({
17
- id: 'width',
17
+ id: 'type._inputs.*.options.width',
18
18
  title: 'Width',
19
19
  description:
20
20
  'Defines the width of the bounding box used in the image resizing process defined with resize_style.',
21
21
  }),
22
22
  height: z.number().optional().meta({
23
- id: 'height',
23
+ id: 'type._inputs.*.options.height',
24
24
  title: 'Height',
25
25
  description:
26
26
  'Defines the height of the bounding box used in the image resizing process defined with resize_style.',
27
27
  }),
28
28
  expandable: z.boolean().default(false).optional().meta({
29
- id: 'expandable',
29
+ id: 'type._inputs.*.options.expandable',
30
30
  title: 'Expandable',
31
31
  description:
32
32
  '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.',
33
33
  }),
34
34
  image_size_attributes: z.boolean().default(true).optional().meta({
35
- id: 'image_size_attributes',
35
+ id: 'type._inputs.*.options.image_size_attributes',
36
36
  title: 'Image Size Attributes',
37
37
  description:
38
38
  'Instructs the editor to save `width` and `height` attributes on the image elements. This can prevent pop-in as a page loads.',
39
39
  }),
40
40
  allowed_sources: z.array(z.string()).optional().meta({
41
- id: 'allowed_sources',
41
+ id: 'type._inputs.*.options.allowed_sources',
42
42
  title: 'Allowed Sources',
43
43
  description:
44
44
  '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.',
45
45
  }),
46
46
  prevent_resize_existing_files: z.boolean().default(false).optional().meta({
47
- id: 'prevent_resize_existing_files',
47
+ id: 'type._inputs.*.options.prevent_resize_existing_files',
48
48
  title: 'Prevent Resize Existing Files',
49
49
  description:
50
50
  'Enable to skip the image resizing process configured for this input when selecting existing images.',
@@ -64,7 +64,7 @@ export const ImageOptionsSchema = z.object({
64
64
  )
65
65
  .optional()
66
66
  .meta({
67
- id: 'sizes',
67
+ id: 'type._inputs.*.options.sizes',
68
68
  title: 'Sizes',
69
69
  description:
70
70
  'Definitions for creating additional images of different sizes when uploading or selecting existing files.',