@cloudcannon/configuration-types 0.0.41 → 0.0.43

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/preview.ts CHANGED
@@ -1,144 +1,79 @@
1
1
  import * as z from 'zod';
2
2
 
3
- const PreviewKeyEntrySchema = z.object({
4
- key: z.string().meta({
5
- description: 'The key used to access the value used for the preview.',
6
- }),
7
- });
3
+ const PreviewKeyEntrySchema = z
4
+ .object({ key: z.string().meta({ title: 'Key Value' }) })
5
+ .meta({ title: 'Key' });
8
6
 
9
- const PreviewTemplateEntrySchema = z.object({
10
- template: z.string().meta({
11
- description:
12
- 'A template string containing various placeholders for the value used in the preview.',
13
- }),
14
- });
7
+ const PreviewTemplateEntrySchema = z
8
+ .object({ template: z.string().meta({ title: 'Template Value' }) })
9
+ .meta({ title: 'Template' });
15
10
 
16
- const PreviewTextEntrySchema = z.object({
17
- text: z.string().meta({
18
- description: 'The raw text used as the value for the preview.',
19
- }),
20
- });
11
+ const PreviewTextEntrySchema = z
12
+ .object({ text: z.string().meta({ title: 'Text Value' }) })
13
+ .meta({ title: 'Text' });
14
+
15
+ const PreviewRawTextEntrySchema = z.string().meta({ title: 'Raw Text' });
16
+ const PreviewFalseEntrySchema = z.literal(false).meta({ title: 'False' });
21
17
 
22
18
  const PreviewEntrySchema = z
23
19
  .union([
24
20
  PreviewKeyEntrySchema,
25
21
  PreviewTemplateEntrySchema,
26
22
  PreviewTextEntrySchema,
27
- z.string(),
28
- z.literal(false),
23
+ PreviewRawTextEntrySchema,
24
+ PreviewFalseEntrySchema,
29
25
  ])
30
- .meta({
31
- id: 'PreviewEntry',
32
- });
33
-
34
- const PreviewEntriesSchema = z
35
- .union([z.array(PreviewEntrySchema), z.string(), z.literal(false)])
36
- .meta({
37
- id: 'PreviewEntries',
38
- });
39
-
40
- const TextPreviewSchema = PreviewEntriesSchema.meta({
41
- id: 'preview.text',
42
- description: 'Controls the main text shown per item.',
43
- });
44
-
45
- const ImagePreviewSchema = PreviewEntriesSchema.meta({
46
- id: 'preview.image',
47
- description: 'Controls the image shown per item.',
48
- });
49
-
50
- const IconPreviewSchema = PreviewEntriesSchema.meta({
51
- id: 'preview.icon',
52
- description: 'Controls the icon shown per item. Must result in a Material Symbol name.',
53
- });
54
-
55
- export const IconColorSchema = PreviewEntriesSchema.meta({
56
- id: 'preview.icon_color',
57
- description: 'Controls the color of the icon.',
58
- });
26
+ .meta({ id: 'PreviewEntry' });
59
27
 
60
- export const IconBackgroundColorSchema = PreviewEntriesSchema.meta({
61
- id: 'preview.icon_background_color',
62
- description: 'Controls the background color of the icon.',
63
- });
28
+ export const PreviewEntriesSchema = z
29
+ .union([
30
+ z.array(PreviewEntrySchema).meta({ title: 'Array' }),
31
+ PreviewRawTextEntrySchema,
32
+ PreviewFalseEntrySchema,
33
+ ])
34
+ .meta({ id: 'PreviewEntries' });
64
35
 
65
36
  export const PreviewGallerySchema = z
66
37
  .object({
67
- text: TextPreviewSchema.optional(),
68
- image: ImagePreviewSchema.optional(),
69
- icon: IconPreviewSchema.optional(),
70
- icon_color: IconColorSchema.optional(),
71
- icon_background_color: IconBackgroundColorSchema.optional(),
72
- fit: z.enum(['padded', 'cover', 'contain', 'cover-top']).default('padded').optional().meta({
73
- description: 'Controls how the gallery image is positioned within the gallery.',
74
- }),
75
- background_color: PreviewEntriesSchema.optional().meta({
76
- description: 'Controls the background color gallery area.',
77
- }),
38
+ text: PreviewEntriesSchema.optional(),
39
+ image: PreviewEntriesSchema.optional(),
40
+ icon: PreviewEntriesSchema.optional(),
41
+ icon_color: PreviewEntriesSchema.optional(),
42
+ icon_background_color: PreviewEntriesSchema.optional(),
43
+ fit: z
44
+ .enum(['padded', 'cover', 'contain', 'cover-top'])
45
+ .default('padded')
46
+ .optional()
47
+ .meta({ id: 'preview.gallery.fit' }),
48
+ background_color: PreviewEntriesSchema.optional(),
78
49
  })
79
- .meta({
80
- id: 'preview.gallery',
81
- title: 'Preview Gallery',
82
- description: 'Configuration for gallery-style previews.',
83
- });
50
+ .meta({ id: 'preview.gallery' });
84
51
 
85
- export const PreviewMetadataSchema = z
52
+ const PreviewMetadataEntrySchema = z
86
53
  .object({
87
- text: TextPreviewSchema.optional(),
88
- image: ImagePreviewSchema.optional(),
89
- icon: IconPreviewSchema.optional(),
90
- icon_color: IconColorSchema.optional(),
91
- icon_background_color: IconBackgroundColorSchema.optional(),
54
+ text: PreviewEntriesSchema.optional(),
55
+ image: PreviewEntriesSchema.optional(),
56
+ icon: PreviewEntriesSchema.optional(),
57
+ icon_color: PreviewEntriesSchema.optional(),
58
+ icon_background_color: PreviewEntriesSchema.optional(),
92
59
  })
93
- .meta({
94
- id: 'preview.metadata',
95
- title: 'Preview Metadata',
96
- description:
97
- 'Metadata configuration for preview items including text, image, and icon options.',
98
- });
60
+ .meta({ id: 'PreviewMetadataEntry' });
99
61
 
100
62
  export const PreviewSchema = z
101
63
  .object({
102
- text: TextPreviewSchema.optional(),
103
- subtext: PreviewEntriesSchema.optional().meta({
104
- description: 'Controls the supporting text shown per item.',
105
- }),
106
- image: ImagePreviewSchema.optional(),
107
- icon: IconPreviewSchema.optional(),
108
- icon_color: IconColorSchema.optional(),
109
- icon_background_color: IconBackgroundColorSchema.optional(),
110
- tags: z.array(z.string()).optional().meta({
111
- description: 'Defines a list of tags.',
112
- }),
113
- metadata: z.array(PreviewMetadataSchema).optional().meta({
114
- description: 'Defines a list of items that can contain an image, icon, and text.',
115
- }),
116
- gallery: PreviewGallerySchema.optional().meta({
117
- description: 'Details for large image/icon preview per item.',
118
- }),
119
- })
120
- .meta({
121
- id: 'preview',
122
- title: 'Preview',
123
- description:
124
- 'Configuration for how content items are visually previewed in the CloudCannon interface.',
125
- });
126
-
127
- export const PickerPreviewSchema = z
128
- .object({
129
- // This needs to extend it this way, rather than calling PreviewSchema.meta({}).
130
- // Otherwise, it seems to override in a way that does not allow us to remove `"id": "preview"`
131
- // during JSONSchema generate.
132
- ...PreviewSchema.shape,
64
+ text: PreviewEntriesSchema.optional(),
65
+ subtext: PreviewEntriesSchema.optional(),
66
+ image: PreviewEntriesSchema.optional(),
67
+ icon: PreviewEntriesSchema.optional(),
68
+ icon_color: PreviewEntriesSchema.optional(),
69
+ icon_background_color: PreviewEntriesSchema.optional(),
70
+ tags: z.array(z.string()).optional().meta({ id: 'preview.tags' }),
71
+ metadata: z.array(PreviewMetadataEntrySchema).optional().meta({ id: 'preview.metadata' }),
72
+ gallery: PreviewGallerySchema.optional(),
133
73
  })
134
- .meta({
135
- id: 'picker_preview',
136
- title: 'Picker Preview',
137
- description: 'Changes the way items are previewed in the CMS while being chosen.',
138
- });
74
+ .meta({ id: 'type.preview', title: 'Preview' });
139
75
 
140
76
  export type PreviewEntry = z.infer<typeof PreviewEntrySchema>;
141
77
  export type PreviewEntries = z.infer<typeof PreviewEntriesSchema>;
142
78
  export type PreviewGallery = z.infer<typeof PreviewGallerySchema>;
143
- export type PreviewMetadata = z.infer<typeof PreviewMetadataSchema>;
144
79
  export type Preview = z.infer<typeof PreviewSchema>;
@@ -2,21 +2,18 @@ import * as z from 'zod';
2
2
 
3
3
  export const SelectDataValuesSchema = z
4
4
  .union([
5
- z.array(z.string()),
6
- z.array(z.record(z.string(), z.string())),
7
- z.record(z.string(), z.string()),
8
- z.array(z.record(z.string(), z.unknown())),
9
- z.record(z.string(), z.unknown()),
5
+ z.array(z.string()).meta({ title: 'Text Array' }),
6
+ z.record(z.string(), z.string()).meta({ title: 'Text Object' }),
7
+ z.array(z.record(z.string(), z.unknown())).meta({ title: 'Object Array' }),
8
+ z.record(z.string(), z.unknown()).meta({ title: 'Object' }),
10
9
  ])
11
10
  .meta({
12
- id: 'SelectDataValues',
13
- title: 'Select Data Values',
14
11
  description:
15
12
  'Data formats for populating select and multiselect input options, supporting arrays and objects.',
16
13
  });
17
14
 
18
15
  export const SelectDataSchema = z.record(z.string(), SelectDataValuesSchema).meta({
19
- id: '_select_data',
16
+ id: 'type._select_data',
20
17
  title: 'Select Data',
21
18
  description:
22
19
  'Fixed datasets that can be referenced by the _Values_ configuration for _Select_ and _Multiselect_ inputs.',
package/src/snippets.ts CHANGED
@@ -1,22 +1,192 @@
1
1
  import * as z from 'zod';
2
2
  import { ReducedCascadeSchema } from './cascade';
3
- import { PickerPreviewSchema, PreviewSchema } from './preview';
3
+ import { PreviewSchema } from './preview';
4
+
5
+ export const ParserModelSchema = z.object({
6
+ source_key: z.string().optional(),
7
+ editor_key: z.string().optional(),
8
+ remove_empty: z.boolean(),
9
+ optional: z.boolean(),
10
+ type: z.enum(['array', 'object', 'string', 'boolean', 'number']).optional(),
11
+ allowed_values: z.array(z.any()).optional(),
12
+ implied_boolean: z.boolean(),
13
+ default: z.any().optional(),
14
+ });
15
+
16
+ export const PairedTokenSchema = z.object({
17
+ start: z.string(),
18
+ end: z.string(),
19
+ });
20
+
21
+ export const StringCasesSchema = z.object({
22
+ any: z.boolean().optional(),
23
+ leading_upper: z.boolean().optional(),
24
+ leading_lower: z.boolean().optional(),
25
+ lower: z.boolean().optional(),
26
+ upper: z.boolean().optional(),
27
+ });
28
+
29
+ export const SnippetStyleSchema = z.object({
30
+ output: z.enum(['legacy', 'inline', 'block']),
31
+ inline: z
32
+ .object({
33
+ leading: z.string().optional(),
34
+ trailing: z.string().optional(),
35
+ })
36
+
37
+ .optional(),
38
+ block: z
39
+ .object({
40
+ leading: z.string().optional(),
41
+ trailing: z.string().optional(),
42
+ indent: z.string().optional(),
43
+ })
44
+
45
+ .optional(),
46
+ });
47
+
48
+ export const ParserFormatSchema = z.object({
49
+ root_boundary: PairedTokenSchema,
50
+ root_value_boundary: PairedTokenSchema,
51
+ root_value_boundary_optional: z.record(z.string(), z.boolean()),
52
+ root_value_delimiter: z.string().optional(),
53
+ root_pair_delimiter: z.array(z.string()),
54
+ remove_empty_root_boundary: z.boolean(),
55
+ object_boundary: PairedTokenSchema,
56
+ object_value_delimiter: z.string(),
57
+ object_pair_delimiter: z.string(),
58
+ array_boundary: PairedTokenSchema,
59
+ array_delimiter: z.string(),
60
+ string_boundary: z.array(z.string()),
61
+ string_escape_character: z.string(),
62
+ allow_booleans: z.boolean(),
63
+ allow_numbers: z.boolean(),
64
+ allow_implied_values: z.boolean(),
65
+ allow_null: z.boolean(),
66
+ forbidden_tokens: z.array(z.string()),
67
+ allowed_string_cases: StringCasesSchema,
68
+ });
69
+
70
+ export const ArgumentListParserConfigSchema = z.object({
71
+ parser: z.literal('argument_list'),
72
+ options: z.object({
73
+ models: z.array(ParserModelSchema),
74
+ format: ParserFormatSchema,
75
+ }),
76
+ });
77
+
78
+ export const ArgumentParserConfigSchema = z.object({
79
+ parser: z.literal('argument'),
80
+ options: z.object({
81
+ model: ParserModelSchema,
82
+ format: ParserFormatSchema,
83
+ }),
84
+ });
85
+
86
+ export const ContentParserConfigSchema = z.object({
87
+ parser: z.literal('content'),
88
+ options: z.object({
89
+ editor_key: z.string().optional(),
90
+ indented_by: z.string().optional(),
91
+ default: z.string().optional(),
92
+ trim_text: z.boolean().optional(),
93
+ allow_nested: z.boolean().optional(),
94
+ raw: z.boolean().optional(),
95
+ forbidden_tokens: z.array(z.string()).optional(),
96
+ optional: z.boolean().optional(),
97
+ allow_leading: z.boolean().optional(),
98
+ escape_indented_blocks: z.boolean().default(false).optional(),
99
+ parse_newline_character: z.boolean().default(false).optional(),
100
+ ignore_unpaired_backticks: z.boolean().default(true).optional(),
101
+ escape_fenced_blocks: z.boolean().default(false).optional(),
102
+ style: SnippetStyleSchema.optional(),
103
+ }),
104
+ });
105
+
106
+ export const KeyValueListParserConfigSchema = z.object({
107
+ parser: z.literal('key_values'),
108
+ options: z.object({
109
+ models: z.array(ParserModelSchema),
110
+ format: ParserFormatSchema,
111
+ style: SnippetStyleSchema,
112
+ }),
113
+ });
114
+
115
+ export const LiteralParserConfigSchema = z.object({
116
+ parser: z.literal('literal'),
117
+ options: z.object({
118
+ literal: z.string(),
119
+ format: z.object({ string_boundary: z.array(z.string()).optional() }).optional(),
120
+ }),
121
+ });
122
+
123
+ export const OptionalParserConfigSchema = z.object({
124
+ parser: z.literal('optional'),
125
+ options: z.object({
126
+ snippet: z.string(),
127
+ remove_empty: z.boolean().optional(),
128
+ }),
129
+ });
130
+
131
+ export const RepeatingLiteralParserConfigSchema = z.object({
132
+ parser: z.literal('repeating_literal'),
133
+ options: z.object({
134
+ literal: z.string(),
135
+ default: z.number(),
136
+ minimum: z.number(),
137
+ editor_key: z.string().optional(),
138
+ }),
139
+ });
140
+
141
+ export const RepeatingParserConfigSchema = z.object({
142
+ parser: z.literal('repeating'),
143
+ options: z.object({
144
+ snippet: z.string(),
145
+ editor_key: z.string().optional(),
146
+ output_delimiter: z.string().optional(),
147
+ default_length: z.number().optional(),
148
+ style: SnippetStyleSchema.optional(),
149
+ optional: z.boolean().optional(),
150
+ }),
151
+ });
152
+
153
+ export const WrapperParserConfigSchema = z.object({
154
+ parser: z.literal('wrapper'),
155
+ options: z.object({
156
+ snippet: z.string(),
157
+ remove_empty: z.boolean().optional(),
158
+ style: SnippetStyleSchema.optional(),
159
+ }),
160
+ });
161
+
162
+ export const ParserConfigSchema = z.union([
163
+ ArgumentListParserConfigSchema.meta({ title: 'Argument List Parser Config' }),
164
+ ArgumentParserConfigSchema.meta({ title: 'Argument Parser Config' }),
165
+ ContentParserConfigSchema.meta({ title: 'Content Parser Config' }),
166
+ KeyValueListParserConfigSchema.meta({ title: 'Key Value List Parser Config' }),
167
+ LiteralParserConfigSchema.meta({ title: 'Literal Parser Config' }),
168
+ OptionalParserConfigSchema.meta({ title: 'Optional Parser Config' }),
169
+ RepeatingLiteralParserConfigSchema.meta({ title: 'Repeating Literal Parser Config' }),
170
+ RepeatingParserConfigSchema.meta({ title: 'Repeating Parser Config' }),
171
+ WrapperParserConfigSchema.meta({ title: 'Wrapper Parser Config' }),
172
+ ]);
4
173
 
5
174
  export const SnippetConfigSchema = z
6
175
  .object({
7
176
  ...ReducedCascadeSchema.shape,
8
177
  preview: PreviewSchema.optional(),
9
- picker_preview: PickerPreviewSchema.optional(),
178
+ picker_preview: PreviewSchema.optional(),
10
179
  })
11
180
  .extend({
12
181
  snippet: z.string().optional().meta({
13
- description: 'Name of the snippet.',
182
+ description:
183
+ 'The snippet string contains the text to match for your snippet, with any dynamic sections represented using a placeholder in double square brackets.',
14
184
  }),
15
185
  template: z.string().optional().meta({
16
186
  description:
17
- 'The template that this snippet should inherit, out of the available Shortcode Templates.',
187
+ 'The template that this snippet should inherit, out of the available Snippet Templates.',
18
188
  }),
19
- inline: z.boolean().optional().meta({
189
+ inline: z.boolean().default(false).optional().meta({
20
190
  description:
21
191
  'Whether this snippet can appear inline (within a sentence). Defaults to false, which will treat this snippet as a block-level element in the content editor.',
22
192
  }),
@@ -32,82 +202,81 @@ export const SnippetConfigSchema = z
32
202
  }),
33
203
  get alternate_formats() {
34
204
  return z.array(SnippetConfigSchema).optional().meta({
205
+ id: 'SnippetAlternateFormats',
35
206
  description: 'Alternate configurations for this snippet.',
36
207
  });
37
208
  },
38
- params: z.record(z.string(), z.unknown()).optional().meta({
209
+ params: z.record(z.string(), ParserConfigSchema).optional().meta({
210
+ title: 'Parser Config',
39
211
  description: 'The parameters of this snippet.',
40
212
  }),
41
213
  })
42
214
  .meta({
43
- id: 'SnippetConfig',
44
- title: 'Snippet Configuration',
215
+ id: 'type.snippet',
216
+ title: 'Snippet',
45
217
  description: 'A snippet configuration.',
46
218
  });
47
219
 
48
220
  const SnippetImportSchema = z
49
221
  .union([
50
- z.boolean(),
51
- z.object({
52
- exclude: z.array(z.string()).meta({
53
- description:
54
- 'The list of excluded snippets. If unset, all snippets are excluded unless defined in `include`.',
55
- }),
56
- }),
57
- z.object({
58
- include: z.array(z.string()).meta({
59
- description:
60
- 'The list of included snippets. If unset, all snippets are included unless defined in `exclude`.',
61
- }),
62
- }),
222
+ z.boolean().meta({ title: 'Full Import' }),
223
+ z
224
+ .object({
225
+ exclude: z.array(z.string()).meta({
226
+ id: 'SnippetImportExclude',
227
+ description:
228
+ 'The list of excluded snippets. If unset, all snippets are excluded unless defined in `include`.',
229
+ }),
230
+ })
231
+ .meta({ title: 'Exclude List' }),
232
+ z
233
+ .object({
234
+ include: z.array(z.string()).meta({
235
+ id: 'SnippetImportInclude',
236
+ description:
237
+ 'The list of included snippets. If unset, all snippets are included unless defined in `exclude`.',
238
+ }),
239
+ })
240
+ .meta({ title: 'Include List' }),
63
241
  ])
64
- .meta({
65
- id: 'SnippetImport',
66
- title: 'Snippet Import',
67
- description: 'Controls what snippets are available to import.',
68
- });
242
+ .optional();
69
243
 
70
244
  export const SnippetsImportsSchema = z
71
245
  .object({
72
- hugo: SnippetImportSchema.optional().meta({
73
- description: 'Default snippets for Hugo SSG.',
246
+ hugo: SnippetImportSchema.meta({
247
+ id: '_snippets_imports.hugo',
74
248
  uniqueItems: true,
75
249
  }),
76
- jekyll: SnippetImportSchema.optional().meta({
77
- description: 'Default snippets for Jekyll SSG.',
250
+ jekyll: SnippetImportSchema.meta({
251
+ id: '_snippets_imports.jekyll',
78
252
  uniqueItems: true,
79
253
  }),
80
- mdx: SnippetImportSchema.optional().meta({
81
- description: 'Default snippets for MDX-based content.',
254
+ mdx: SnippetImportSchema.meta({
255
+ id: '_snippets_imports.mdx',
82
256
  uniqueItems: true,
83
257
  }),
84
- eleventy_liquid: SnippetImportSchema.optional().meta({
85
- description: 'Default snippets for Eleventy SSG Liquid files.',
258
+ eleventy_liquid: SnippetImportSchema.meta({
259
+ id: '_snippets_imports.eleventy_liquid',
86
260
  uniqueItems: true,
87
261
  }),
88
- eleventy_nunjucks: SnippetImportSchema.optional().meta({
89
- description: 'Default snippets for Eleventy SSG Nunjucks files.',
262
+ eleventy_nunjucks: SnippetImportSchema.meta({
263
+ id: '_snippets_imports.eleventy_nunjucks',
90
264
  uniqueItems: true,
91
265
  }),
92
- markdoc: SnippetImportSchema.optional().meta({
93
- description: 'Default snippets for Markdoc-based content.',
266
+ markdoc: SnippetImportSchema.meta({
267
+ id: '_snippets_imports.markdoc',
94
268
  uniqueItems: true,
95
269
  }),
96
- python_markdown_extensions: SnippetImportSchema.optional().meta({
97
- description: 'Default snippets for content using Python markdown extensions.',
270
+ python_markdown_extensions: SnippetImportSchema.meta({
271
+ id: '_snippets_imports.python_markdown_extensions',
98
272
  uniqueItems: true,
99
273
  }),
100
- docusaurus_mdx: SnippetImportSchema.optional().meta({
101
- description: 'Default snippets for Docusaurus SSG.',
274
+ docusaurus_mdx: SnippetImportSchema.meta({
275
+ id: '_snippets_imports.docusaurus_mdx',
102
276
  uniqueItems: true,
103
277
  }),
104
278
  })
105
- .meta({
106
- id: '_snippets_imports',
107
- title: 'Snippets Imports',
108
- description:
109
- 'Provides control over which snippets are available to use and/or extend within `_snippets`.',
110
- });
279
+ .meta({ id: 'type._snippets_imports', title: 'Snippets Imports' });
111
280
 
112
281
  export type SnippetConfig = z.infer<typeof SnippetConfigSchema>;
113
282
  export type SnippetsImports = z.infer<typeof SnippetsImportsSchema>;
@@ -2,66 +2,39 @@ import * as z from 'zod';
2
2
 
3
3
  export const ThemeSchema = z
4
4
  .enum([
5
- 'ambiance',
6
- 'chaos',
7
- 'chrome',
8
- 'clouds',
9
- 'clouds_midnight',
10
- 'cobalt',
11
- 'crimson_editor',
12
- 'dawn',
5
+ 'atomone',
6
+ 'basic_dark',
7
+ 'basic_light',
8
+ 'darcula',
13
9
  'dracula',
14
- 'dreamweaver',
10
+ 'duotone_dark',
11
+ 'duotone_light',
15
12
  'eclipse',
16
- 'github',
17
- 'gob',
18
- 'gruvbox',
19
- 'idle_fingers',
20
- 'iplastic',
21
- 'katzenmilch',
22
- 'kr_theme',
23
- 'kuroir',
24
- 'merbivore',
25
- 'merbivore_soft',
26
- 'mono_industrial',
27
- 'monokai',
28
- 'nord_dark',
29
- 'pastel_on_dark',
13
+ 'github_dark',
14
+ 'github_light',
15
+ 'gruvbox_dark',
16
+ 'gruvbox_light',
17
+ 'material_dark',
18
+ 'material_light',
30
19
  'solarized_dark',
31
20
  'solarized_light',
32
- 'sqlserver',
33
- 'terminal',
34
- 'textmate',
35
- 'tomorrow',
36
- 'tomorrow_night',
21
+ 'sublime',
22
+ 'tokyo_night',
23
+ 'tokyo_night_day',
24
+ 'tokyo_night_storm',
37
25
  'tomorrow_night_blue',
38
- 'tomorrow_night_bright',
39
- 'tomorrow_night_eighties',
40
- 'twilight',
41
- 'vibrant_ink',
42
- 'xcode',
26
+ 'vscode_dark',
27
+ 'vscode_light',
28
+ 'xcode_dark',
29
+ 'xcode_light',
43
30
  ])
44
- .meta({
45
- id: 'Theme',
46
- });
31
+ .meta({ id: 'Theme' });
47
32
 
48
33
  export const SourceEditorSchema = z.object({
49
- tab_size: z.number().default(2).optional().meta({
50
- description:
51
- 'This key defines the auto-indentation of each line and how many spaces a tab indentation counts as.\n\nBy default, this key is `2`.\n\nhttps://cloudcannon.com/documentation/articles/the-source-editor/#source_editor.tab_size',
52
- }),
53
- theme: ThemeSchema.default('monokai').optional().meta({
54
- title: 'Theme',
55
- description:
56
- 'This key defines the color theme for syntax highlighting.\n\nBy default, this key is `monokai`.\n\nhttps://cloudcannon.com/documentation/articles/the-source-editor/#source_editor.theme',
57
- }),
58
- show_gutter: z.boolean().default(true).optional().meta({
59
- description:
60
- 'This key toggles the gutter on the left of the editing interface, displaying line numbers and code folding controls.\n\nBy default, this key is `true`.\n\nhttps://cloudcannon.com/documentation/articles/the-source-editor/#source_editor.show_gutter',
61
- }),
62
- soft_wrap: z.boolean().default(false).optional().meta({
63
- description: 'Enables soft wrapping of the code.',
64
- }),
34
+ tab_size: z.number().default(2).optional(),
35
+ theme: ThemeSchema.default('basic_dark').optional(),
36
+ show_gutter: z.boolean().default(true).optional(),
37
+ soft_wrap: z.boolean().default(false).optional(),
65
38
  });
66
39
 
67
40
  export type Theme = z.infer<typeof ThemeSchema>;
package/src/structures.ts CHANGED
@@ -2,9 +2,15 @@ import * as z from 'zod';
2
2
  import { DocumentationSchema } from './documentation';
3
3
  import { IconSchema } from './icon';
4
4
  import { InputsSchema, ObjectInputGroupSchema } from './inputs';
5
- import { PickerPreviewSchema, PreviewSchema } from './preview';
5
+ import { PreviewSchema } from './preview';
6
6
  import { SelectDataSchema } from './select-values';
7
7
 
8
+ export const StructureReferenceSchema = z.string().meta({
9
+ id: 'type.structure-reference',
10
+ title: 'Structure Reference',
11
+ description: 'A reference to an existing structure.',
12
+ });
13
+
8
14
  const StructureBaseSchema = z.object({
9
15
  reorder_inputs: z.boolean().default(true).optional().meta({
10
16
  description:
@@ -25,7 +31,7 @@ const StructureBaseSchema = z.object({
25
31
 
26
32
  export const StructureValueSchema = StructureBaseSchema.extend({
27
33
  preview: PreviewSchema.optional(),
28
- picker_preview: PickerPreviewSchema.optional(),
34
+ picker_preview: PreviewSchema.optional(),
29
35
 
30
36
  // This is the ReducedCascadeSchema - can't seem to reuse it due to Zod's limitations.
31
37
  get _inputs() {
@@ -103,14 +109,14 @@ export const StructureSchema = z
103
109
  }),
104
110
  })
105
111
  .meta({
106
- id: 'Structure',
112
+ id: 'type.structure',
107
113
  title: 'Structure',
108
114
  description:
109
115
  'Provides data formats when adding new items to arrays and objects, with options for how editors choose from available values.',
110
116
  });
111
117
 
112
118
  export const StructuresSchema = z.record(z.string(), StructureSchema).meta({
113
- id: '_structures',
119
+ id: 'type._structures',
114
120
  title: 'Structures',
115
121
  description:
116
122
  'Structured values for editors adding new items to arrays and objects. Entries here can be referenced in the configuration for `array` or `object` inputs.',