@cloudcannon/configuration-types 0.0.42 → 0.0.44
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-collections.schema.json +9677 -0
- package/dist/cloudcannon-config.documentation.schema.json +11087 -0
- package/dist/cloudcannon-config.latest.schema.json +3640 -2288
- package/dist/cloudcannon-config.legacy-eleventy.schema.json +11018 -9663
- package/dist/cloudcannon-config.legacy-hugo.schema.json +3482 -2127
- package/dist/cloudcannon-config.legacy-jekyll.schema.json +11018 -9663
- package/dist/cloudcannon-config.legacy-reader.schema.json +6664 -5314
- package/dist/cloudcannon-editables.schema.json +767 -0
- package/dist/cloudcannon-inputs.schema.json +8713 -0
- package/dist/cloudcannon-schemas.schema.json +9341 -0
- package/dist/cloudcannon-snippets-definitions.schema.json +9 -0
- package/dist/cloudcannon-snippets-imports.schema.json +340 -0
- package/dist/cloudcannon-snippets.schema.json +9960 -0
- package/dist/cloudcannon-structure-value.schema.json +8715 -0
- package/dist/cloudcannon-structures.schema.json +8713 -0
- package/dist/documentation.json +59120 -0
- package/package.json +14 -12
- package/src/build-coupled.ts +3 -6
- package/src/cascade.ts +9 -6
- package/src/collections.ts +262 -0
- package/src/configuration.ts +53 -369
- package/src/documentation.ts +1 -1
- package/src/editables.ts +12 -2
- package/src/icon.ts +1 -1
- package/src/index.ts +17 -16
- package/src/inputs.ts +117 -50
- package/src/markdown.ts +69 -68
- package/src/paths.ts +11 -36
- package/src/preview.ts +51 -116
- package/src/select-values.ts +5 -8
- package/src/snippets.ts +218 -49
- package/src/source-editor.ts +25 -52
- package/src/structures.ts +17 -8
- package/src/syntax.ts +0 -103
- package/src/timezone.ts +1 -5
package/src/preview.ts
CHANGED
|
@@ -1,144 +1,79 @@
|
|
|
1
1
|
import * as z from 'zod';
|
|
2
2
|
|
|
3
|
-
const PreviewKeyEntrySchema = z
|
|
4
|
-
key: z.string().meta({
|
|
5
|
-
|
|
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
|
|
10
|
-
template: z.string().meta({
|
|
11
|
-
|
|
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
|
|
17
|
-
text: z.string().meta({
|
|
18
|
-
|
|
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
|
-
|
|
28
|
-
|
|
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
|
|
61
|
-
|
|
62
|
-
|
|
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:
|
|
68
|
-
image:
|
|
69
|
-
icon:
|
|
70
|
-
icon_color:
|
|
71
|
-
icon_background_color:
|
|
72
|
-
fit: z
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
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
|
-
|
|
52
|
+
const PreviewMetadataEntrySchema = z
|
|
86
53
|
.object({
|
|
87
|
-
text:
|
|
88
|
-
image:
|
|
89
|
-
icon:
|
|
90
|
-
icon_color:
|
|
91
|
-
icon_background_color:
|
|
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:
|
|
103
|
-
subtext: PreviewEntriesSchema.optional()
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
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>;
|
package/src/select-values.ts
CHANGED
|
@@ -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.
|
|
7
|
-
z.record(z.string(), z.
|
|
8
|
-
z.
|
|
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
|
-
import { ReducedCascadeSchema } from './cascade';
|
|
3
|
-
import {
|
|
2
|
+
import { ReducedCascadeSchema } from './cascade.ts';
|
|
3
|
+
import { PreviewSchema } from './preview.ts';
|
|
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:
|
|
178
|
+
picker_preview: PreviewSchema.optional(),
|
|
10
179
|
})
|
|
11
180
|
.extend({
|
|
12
181
|
snippet: z.string().optional().meta({
|
|
13
|
-
description:
|
|
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
|
|
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(),
|
|
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: '
|
|
44
|
-
title: 'Snippet
|
|
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
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
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
|
-
.
|
|
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.
|
|
73
|
-
|
|
246
|
+
hugo: SnippetImportSchema.meta({
|
|
247
|
+
id: '_snippets_imports.hugo',
|
|
74
248
|
uniqueItems: true,
|
|
75
249
|
}),
|
|
76
|
-
jekyll: SnippetImportSchema.
|
|
77
|
-
|
|
250
|
+
jekyll: SnippetImportSchema.meta({
|
|
251
|
+
id: '_snippets_imports.jekyll',
|
|
78
252
|
uniqueItems: true,
|
|
79
253
|
}),
|
|
80
|
-
mdx: SnippetImportSchema.
|
|
81
|
-
|
|
254
|
+
mdx: SnippetImportSchema.meta({
|
|
255
|
+
id: '_snippets_imports.mdx',
|
|
82
256
|
uniqueItems: true,
|
|
83
257
|
}),
|
|
84
|
-
eleventy_liquid: SnippetImportSchema.
|
|
85
|
-
|
|
258
|
+
eleventy_liquid: SnippetImportSchema.meta({
|
|
259
|
+
id: '_snippets_imports.eleventy_liquid',
|
|
86
260
|
uniqueItems: true,
|
|
87
261
|
}),
|
|
88
|
-
eleventy_nunjucks: SnippetImportSchema.
|
|
89
|
-
|
|
262
|
+
eleventy_nunjucks: SnippetImportSchema.meta({
|
|
263
|
+
id: '_snippets_imports.eleventy_nunjucks',
|
|
90
264
|
uniqueItems: true,
|
|
91
265
|
}),
|
|
92
|
-
markdoc: SnippetImportSchema.
|
|
93
|
-
|
|
266
|
+
markdoc: SnippetImportSchema.meta({
|
|
267
|
+
id: '_snippets_imports.markdoc',
|
|
94
268
|
uniqueItems: true,
|
|
95
269
|
}),
|
|
96
|
-
python_markdown_extensions: SnippetImportSchema.
|
|
97
|
-
|
|
270
|
+
python_markdown_extensions: SnippetImportSchema.meta({
|
|
271
|
+
id: '_snippets_imports.python_markdown_extensions',
|
|
98
272
|
uniqueItems: true,
|
|
99
273
|
}),
|
|
100
|
-
docusaurus_mdx: SnippetImportSchema.
|
|
101
|
-
|
|
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>;
|
package/src/source-editor.ts
CHANGED
|
@@ -2,66 +2,39 @@ import * as z from 'zod';
|
|
|
2
2
|
|
|
3
3
|
export const ThemeSchema = z
|
|
4
4
|
.enum([
|
|
5
|
-
'
|
|
6
|
-
'
|
|
7
|
-
'
|
|
8
|
-
'
|
|
9
|
-
'clouds_midnight',
|
|
10
|
-
'cobalt',
|
|
11
|
-
'crimson_editor',
|
|
12
|
-
'dawn',
|
|
5
|
+
'atomone',
|
|
6
|
+
'basic_dark',
|
|
7
|
+
'basic_light',
|
|
8
|
+
'darcula',
|
|
13
9
|
'dracula',
|
|
14
|
-
'
|
|
10
|
+
'duotone_dark',
|
|
11
|
+
'duotone_light',
|
|
15
12
|
'eclipse',
|
|
16
|
-
'
|
|
17
|
-
'
|
|
18
|
-
'
|
|
19
|
-
'
|
|
20
|
-
'
|
|
21
|
-
'
|
|
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
|
-
'
|
|
33
|
-
'
|
|
34
|
-
'
|
|
35
|
-
'
|
|
36
|
-
'tomorrow_night',
|
|
21
|
+
'sublime',
|
|
22
|
+
'tokyo_night',
|
|
23
|
+
'tokyo_night_day',
|
|
24
|
+
'tokyo_night_storm',
|
|
37
25
|
'tomorrow_night_blue',
|
|
38
|
-
'
|
|
39
|
-
'
|
|
40
|
-
'
|
|
41
|
-
'
|
|
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()
|
|
50
|
-
|
|
51
|
-
|
|
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>;
|