@cloudcannon/configuration-types 0.0.38 → 0.0.40
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 +98 -78
- package/dist/cloudcannon-config.legacy-eleventy.schema.json +98 -78
- package/dist/cloudcannon-config.legacy-hugo.schema.json +98 -78
- package/dist/cloudcannon-config.legacy-jekyll.schema.json +98 -78
- package/dist/cloudcannon-config.legacy-reader.schema.json +98 -78
- package/package.json +1 -1
- package/src/configuration.ts +10 -5
- package/src/preview.ts +28 -9
|
@@ -138,37 +138,8 @@
|
|
|
138
138
|
],
|
|
139
139
|
"markdownDescription": "This key defines the documentation link at the top of a _Collection browser_. Collection documentation is useful for assisting your team members."
|
|
140
140
|
},
|
|
141
|
-
"sort": {
|
|
142
|
-
"description": "This key defines how CloudCannon sorts your Collection files when you first open your _Collection browser_.",
|
|
143
|
-
"title": "Sort",
|
|
144
|
-
"type": "object",
|
|
145
|
-
"properties": {
|
|
146
|
-
"key": {
|
|
147
|
-
"description": "Defines what field contains the value to sort on inside each collection item's data.",
|
|
148
|
-
"type": "string",
|
|
149
|
-
"markdownDescription": "Defines what field contains the value to sort on inside each collection item's data."
|
|
150
|
-
},
|
|
151
|
-
"order": {
|
|
152
|
-
"description": "Controls which sort values come first.",
|
|
153
|
-
"default": "ascending",
|
|
154
|
-
"type": "string",
|
|
155
|
-
"enum": [
|
|
156
|
-
"ascending",
|
|
157
|
-
"descending",
|
|
158
|
-
"asc",
|
|
159
|
-
"desc"
|
|
160
|
-
],
|
|
161
|
-
"markdownDescription": "Controls which sort values come first."
|
|
162
|
-
}
|
|
163
|
-
},
|
|
164
|
-
"required": [
|
|
165
|
-
"key"
|
|
166
|
-
],
|
|
167
|
-
"additionalProperties": false,
|
|
168
|
-
"markdownDescription": "This key defines how CloudCannon sorts your Collection files when you first open your _Collection browser_."
|
|
169
|
-
},
|
|
170
141
|
"sort_options": {
|
|
171
|
-
"description": "This key defines the options for the Sort dropdown in a _Collection browser_.",
|
|
142
|
+
"description": "This key defines the options for the Sort dropdown in a _Collection browser_. The first option listed is used as the default sort.",
|
|
172
143
|
"type": "array",
|
|
173
144
|
"items": {
|
|
174
145
|
"title": "SortOption",
|
|
@@ -204,7 +175,21 @@
|
|
|
204
175
|
"additionalProperties": false,
|
|
205
176
|
"markdownDescription": "A sort option for a Collection."
|
|
206
177
|
},
|
|
207
|
-
"markdownDescription": "This key defines the options for the Sort dropdown in a _Collection browser_."
|
|
178
|
+
"markdownDescription": "This key defines the options for the Sort dropdown in a _Collection browser_. The first option listed is used as the default sort."
|
|
179
|
+
},
|
|
180
|
+
"view_options": {
|
|
181
|
+
"uniqueItems": true,
|
|
182
|
+
"description": "This key defines the options for the View dropdown in a _Collection browser_. The first option listed is used as the default view.",
|
|
183
|
+
"type": "array",
|
|
184
|
+
"items": {
|
|
185
|
+
"type": "string",
|
|
186
|
+
"enum": [
|
|
187
|
+
"card",
|
|
188
|
+
"list",
|
|
189
|
+
"gallery"
|
|
190
|
+
]
|
|
191
|
+
},
|
|
192
|
+
"markdownDescription": "This key defines the options for the View dropdown in a _Collection browser_. The first option listed is used as the default view."
|
|
208
193
|
},
|
|
209
194
|
"singular_name": {
|
|
210
195
|
"description": "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_.",
|
|
@@ -4956,60 +4941,79 @@
|
|
|
4956
4941
|
"description": "Controls the color of the icon.",
|
|
4957
4942
|
"allOf": [
|
|
4958
4943
|
{
|
|
4959
|
-
"$ref": "#/definitions/
|
|
4944
|
+
"$ref": "#/definitions/PreviewEntries"
|
|
4960
4945
|
}
|
|
4961
4946
|
],
|
|
4962
4947
|
"markdownDescription": "Controls the color of the icon."
|
|
4963
4948
|
},
|
|
4964
|
-
"
|
|
4965
|
-
"id": "
|
|
4949
|
+
"PreviewEntries": {
|
|
4950
|
+
"id": "PreviewEntries",
|
|
4966
4951
|
"anyOf": [
|
|
4967
4952
|
{
|
|
4968
4953
|
"type": "array",
|
|
4969
4954
|
"items": {
|
|
4970
|
-
"
|
|
4971
|
-
{
|
|
4972
|
-
"type": "object",
|
|
4973
|
-
"properties": {
|
|
4974
|
-
"key": {
|
|
4975
|
-
"description": "The key used to access the value used for the preview.",
|
|
4976
|
-
"type": "string",
|
|
4977
|
-
"markdownDescription": "The key used to access the value used for the preview."
|
|
4978
|
-
}
|
|
4979
|
-
},
|
|
4980
|
-
"required": [
|
|
4981
|
-
"key"
|
|
4982
|
-
],
|
|
4983
|
-
"additionalProperties": false
|
|
4984
|
-
},
|
|
4985
|
-
{
|
|
4986
|
-
"type": "object",
|
|
4987
|
-
"properties": {
|
|
4988
|
-
"template": {
|
|
4989
|
-
"description": "A template string containing various placeholders for the value used in the preview.",
|
|
4990
|
-
"type": "string",
|
|
4991
|
-
"markdownDescription": "A template string containing various placeholders for the value used in the preview."
|
|
4992
|
-
}
|
|
4993
|
-
},
|
|
4994
|
-
"required": [
|
|
4995
|
-
"template"
|
|
4996
|
-
],
|
|
4997
|
-
"additionalProperties": false
|
|
4998
|
-
},
|
|
4999
|
-
{
|
|
5000
|
-
"type": "string"
|
|
5001
|
-
},
|
|
5002
|
-
{
|
|
5003
|
-
"type": "boolean"
|
|
5004
|
-
}
|
|
5005
|
-
]
|
|
4955
|
+
"$ref": "#/definitions/PreviewEntry"
|
|
5006
4956
|
}
|
|
5007
4957
|
},
|
|
5008
4958
|
{
|
|
5009
4959
|
"type": "string"
|
|
5010
4960
|
},
|
|
5011
4961
|
{
|
|
5012
|
-
"type": "boolean"
|
|
4962
|
+
"type": "boolean",
|
|
4963
|
+
"const": false
|
|
4964
|
+
}
|
|
4965
|
+
]
|
|
4966
|
+
},
|
|
4967
|
+
"PreviewEntry": {
|
|
4968
|
+
"anyOf": [
|
|
4969
|
+
{
|
|
4970
|
+
"type": "object",
|
|
4971
|
+
"properties": {
|
|
4972
|
+
"key": {
|
|
4973
|
+
"description": "The key used to access the value used for the preview.",
|
|
4974
|
+
"type": "string",
|
|
4975
|
+
"markdownDescription": "The key used to access the value used for the preview."
|
|
4976
|
+
}
|
|
4977
|
+
},
|
|
4978
|
+
"required": [
|
|
4979
|
+
"key"
|
|
4980
|
+
],
|
|
4981
|
+
"additionalProperties": false
|
|
4982
|
+
},
|
|
4983
|
+
{
|
|
4984
|
+
"type": "object",
|
|
4985
|
+
"properties": {
|
|
4986
|
+
"template": {
|
|
4987
|
+
"description": "A template string containing various placeholders for the value used in the preview.",
|
|
4988
|
+
"type": "string",
|
|
4989
|
+
"markdownDescription": "A template string containing various placeholders for the value used in the preview."
|
|
4990
|
+
}
|
|
4991
|
+
},
|
|
4992
|
+
"required": [
|
|
4993
|
+
"template"
|
|
4994
|
+
],
|
|
4995
|
+
"additionalProperties": false
|
|
4996
|
+
},
|
|
4997
|
+
{
|
|
4998
|
+
"type": "object",
|
|
4999
|
+
"properties": {
|
|
5000
|
+
"text": {
|
|
5001
|
+
"description": "The raw text used as the value for the preview.",
|
|
5002
|
+
"type": "string",
|
|
5003
|
+
"markdownDescription": "The raw text used as the value for the preview."
|
|
5004
|
+
}
|
|
5005
|
+
},
|
|
5006
|
+
"required": [
|
|
5007
|
+
"text"
|
|
5008
|
+
],
|
|
5009
|
+
"additionalProperties": false
|
|
5010
|
+
},
|
|
5011
|
+
{
|
|
5012
|
+
"type": "string"
|
|
5013
|
+
},
|
|
5014
|
+
{
|
|
5015
|
+
"type": "boolean",
|
|
5016
|
+
"const": false
|
|
5013
5017
|
}
|
|
5014
5018
|
]
|
|
5015
5019
|
},
|
|
@@ -5017,7 +5021,7 @@
|
|
|
5017
5021
|
"description": "Controls the background color of the icon.",
|
|
5018
5022
|
"allOf": [
|
|
5019
5023
|
{
|
|
5020
|
-
"$ref": "#/definitions/
|
|
5024
|
+
"$ref": "#/definitions/PreviewEntries"
|
|
5021
5025
|
}
|
|
5022
5026
|
],
|
|
5023
5027
|
"markdownDescription": "Controls the background color of the icon."
|
|
@@ -8230,7 +8234,7 @@
|
|
|
8230
8234
|
"description": "Controls the supporting text shown per item.",
|
|
8231
8235
|
"allOf": [
|
|
8232
8236
|
{
|
|
8233
|
-
"$ref": "#/definitions/
|
|
8237
|
+
"$ref": "#/definitions/PreviewEntries"
|
|
8234
8238
|
}
|
|
8235
8239
|
],
|
|
8236
8240
|
"markdownDescription": "Controls the supporting text shown per item."
|
|
@@ -8263,6 +8267,14 @@
|
|
|
8263
8267
|
}
|
|
8264
8268
|
]
|
|
8265
8269
|
},
|
|
8270
|
+
"tags": {
|
|
8271
|
+
"description": "Defines a list of tags.",
|
|
8272
|
+
"type": "array",
|
|
8273
|
+
"items": {
|
|
8274
|
+
"type": "string"
|
|
8275
|
+
},
|
|
8276
|
+
"markdownDescription": "Defines a list of tags."
|
|
8277
|
+
},
|
|
8266
8278
|
"metadata": {
|
|
8267
8279
|
"description": "Defines a list of items that can contain an image, icon, and text.",
|
|
8268
8280
|
"type": "array",
|
|
@@ -8288,7 +8300,7 @@
|
|
|
8288
8300
|
"description": "Controls the main text shown per item.",
|
|
8289
8301
|
"allOf": [
|
|
8290
8302
|
{
|
|
8291
|
-
"$ref": "#/definitions/
|
|
8303
|
+
"$ref": "#/definitions/PreviewEntries"
|
|
8292
8304
|
}
|
|
8293
8305
|
],
|
|
8294
8306
|
"markdownDescription": "Controls the main text shown per item."
|
|
@@ -8297,7 +8309,7 @@
|
|
|
8297
8309
|
"description": "Controls the image shown per item.",
|
|
8298
8310
|
"allOf": [
|
|
8299
8311
|
{
|
|
8300
|
-
"$ref": "#/definitions/
|
|
8312
|
+
"$ref": "#/definitions/PreviewEntries"
|
|
8301
8313
|
}
|
|
8302
8314
|
],
|
|
8303
8315
|
"markdownDescription": "Controls the image shown per item."
|
|
@@ -8306,7 +8318,7 @@
|
|
|
8306
8318
|
"description": "Controls the icon shown per item. Must result in a Material Symbol name.",
|
|
8307
8319
|
"allOf": [
|
|
8308
8320
|
{
|
|
8309
|
-
"$ref": "#/definitions/
|
|
8321
|
+
"$ref": "#/definitions/PreviewEntries"
|
|
8310
8322
|
}
|
|
8311
8323
|
],
|
|
8312
8324
|
"markdownDescription": "Controls the icon shown per item. Must result in a Material Symbol name."
|
|
@@ -8411,7 +8423,7 @@
|
|
|
8411
8423
|
"description": "Controls the background color gallery area.",
|
|
8412
8424
|
"allOf": [
|
|
8413
8425
|
{
|
|
8414
|
-
"$ref": "#/definitions/
|
|
8426
|
+
"$ref": "#/definitions/PreviewEntries"
|
|
8415
8427
|
}
|
|
8416
8428
|
],
|
|
8417
8429
|
"markdownDescription": "Controls the background color gallery area."
|
|
@@ -8436,7 +8448,7 @@
|
|
|
8436
8448
|
"description": "Controls the supporting text shown per item.",
|
|
8437
8449
|
"allOf": [
|
|
8438
8450
|
{
|
|
8439
|
-
"$ref": "#/definitions/
|
|
8451
|
+
"$ref": "#/definitions/PreviewEntries"
|
|
8440
8452
|
}
|
|
8441
8453
|
],
|
|
8442
8454
|
"markdownDescription": "Controls the supporting text shown per item."
|
|
@@ -8469,6 +8481,14 @@
|
|
|
8469
8481
|
}
|
|
8470
8482
|
]
|
|
8471
8483
|
},
|
|
8484
|
+
"tags": {
|
|
8485
|
+
"description": "Defines a list of tags.",
|
|
8486
|
+
"type": "array",
|
|
8487
|
+
"items": {
|
|
8488
|
+
"type": "string"
|
|
8489
|
+
},
|
|
8490
|
+
"markdownDescription": "Defines a list of tags."
|
|
8491
|
+
},
|
|
8472
8492
|
"metadata": {
|
|
8473
8493
|
"description": "Defines a list of items that can contain an image, icon, and text.",
|
|
8474
8494
|
"type": "array",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudcannon/configuration-types",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.40",
|
|
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/configuration.ts
CHANGED
|
@@ -202,13 +202,18 @@ export const CollectionConfigSchema = z
|
|
|
202
202
|
description:
|
|
203
203
|
'This key defines the documentation link at the top of a _Collection browser_. Collection documentation is useful for assisting your team members.',
|
|
204
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
205
|
sort_options: z.array(SortOptionSchema).optional().meta({
|
|
210
|
-
description:
|
|
206
|
+
description:
|
|
207
|
+
'This key defines the options for the Sort dropdown in a _Collection browser_. The first option listed is used as the default sort.',
|
|
211
208
|
}),
|
|
209
|
+
view_options: z
|
|
210
|
+
.array(z.enum(['card', 'list', 'gallery']))
|
|
211
|
+
.optional()
|
|
212
|
+
.meta({
|
|
213
|
+
uniqueItems: true,
|
|
214
|
+
description:
|
|
215
|
+
'This key defines the options for the View dropdown in a _Collection browser_. The first option listed is used as the default view.',
|
|
216
|
+
}),
|
|
212
217
|
singular_name: z.string().optional().meta({
|
|
213
218
|
description:
|
|
214
219
|
'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_.',
|
package/src/preview.ts
CHANGED
|
@@ -13,37 +13,51 @@ const PreviewTemplateEntrySchema = z.object({
|
|
|
13
13
|
}),
|
|
14
14
|
});
|
|
15
15
|
|
|
16
|
+
const PreviewTextEntrySchema = z.object({
|
|
17
|
+
text: z.string().meta({
|
|
18
|
+
description: 'The raw text used as the value for the preview.',
|
|
19
|
+
}),
|
|
20
|
+
});
|
|
21
|
+
|
|
16
22
|
const PreviewEntrySchema = z
|
|
17
23
|
.union([
|
|
18
|
-
|
|
24
|
+
PreviewKeyEntrySchema,
|
|
25
|
+
PreviewTemplateEntrySchema,
|
|
26
|
+
PreviewTextEntrySchema,
|
|
19
27
|
z.string(),
|
|
20
|
-
z.
|
|
28
|
+
z.literal(false),
|
|
21
29
|
])
|
|
22
30
|
.meta({
|
|
23
31
|
id: 'PreviewEntry',
|
|
24
32
|
});
|
|
25
33
|
|
|
26
|
-
const
|
|
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({
|
|
27
41
|
id: 'preview.text',
|
|
28
42
|
description: 'Controls the main text shown per item.',
|
|
29
43
|
});
|
|
30
44
|
|
|
31
|
-
const ImagePreviewSchema =
|
|
45
|
+
const ImagePreviewSchema = PreviewEntriesSchema.meta({
|
|
32
46
|
id: 'preview.image',
|
|
33
47
|
description: 'Controls the image shown per item.',
|
|
34
48
|
});
|
|
35
49
|
|
|
36
|
-
const IconPreviewSchema =
|
|
50
|
+
const IconPreviewSchema = PreviewEntriesSchema.meta({
|
|
37
51
|
id: 'preview.icon',
|
|
38
52
|
description: 'Controls the icon shown per item. Must result in a Material Symbol name.',
|
|
39
53
|
});
|
|
40
54
|
|
|
41
|
-
export const IconColorSchema =
|
|
55
|
+
export const IconColorSchema = PreviewEntriesSchema.meta({
|
|
42
56
|
id: 'preview.icon_color',
|
|
43
57
|
description: 'Controls the color of the icon.',
|
|
44
58
|
});
|
|
45
59
|
|
|
46
|
-
export const IconBackgroundColorSchema =
|
|
60
|
+
export const IconBackgroundColorSchema = PreviewEntriesSchema.meta({
|
|
47
61
|
id: 'preview.icon_background_color',
|
|
48
62
|
description: 'Controls the background color of the icon.',
|
|
49
63
|
});
|
|
@@ -58,7 +72,7 @@ export const PreviewGallerySchema = z
|
|
|
58
72
|
fit: z.enum(['padded', 'cover', 'contain', 'cover-top']).default('padded').optional().meta({
|
|
59
73
|
description: 'Controls how the gallery image is positioned within the gallery.',
|
|
60
74
|
}),
|
|
61
|
-
background_color:
|
|
75
|
+
background_color: PreviewEntriesSchema.optional().meta({
|
|
62
76
|
description: 'Controls the background color gallery area.',
|
|
63
77
|
}),
|
|
64
78
|
})
|
|
@@ -86,13 +100,16 @@ export const PreviewMetadataSchema = z
|
|
|
86
100
|
export const PreviewSchema = z
|
|
87
101
|
.object({
|
|
88
102
|
text: TextPreviewSchema.optional(),
|
|
89
|
-
subtext:
|
|
103
|
+
subtext: PreviewEntriesSchema.optional().meta({
|
|
90
104
|
description: 'Controls the supporting text shown per item.',
|
|
91
105
|
}),
|
|
92
106
|
image: ImagePreviewSchema.optional(),
|
|
93
107
|
icon: IconPreviewSchema.optional(),
|
|
94
108
|
icon_color: IconColorSchema.optional(),
|
|
95
109
|
icon_background_color: IconBackgroundColorSchema.optional(),
|
|
110
|
+
tags: z.array(z.string()).optional().meta({
|
|
111
|
+
description: 'Defines a list of tags.',
|
|
112
|
+
}),
|
|
96
113
|
metadata: z.array(PreviewMetadataSchema).optional().meta({
|
|
97
114
|
description: 'Defines a list of items that can contain an image, icon, and text.',
|
|
98
115
|
}),
|
|
@@ -120,6 +137,8 @@ export const PickerPreviewSchema = z
|
|
|
120
137
|
description: 'Changes the way items are previewed in the CMS while being chosen.',
|
|
121
138
|
});
|
|
122
139
|
|
|
140
|
+
export type PreviewEntry = z.infer<typeof PreviewEntrySchema>;
|
|
141
|
+
export type PreviewEntries = z.infer<typeof PreviewEntriesSchema>;
|
|
123
142
|
export type PreviewGallery = z.infer<typeof PreviewGallerySchema>;
|
|
124
143
|
export type PreviewMetadata = z.infer<typeof PreviewMetadataSchema>;
|
|
125
144
|
export type Preview = z.infer<typeof PreviewSchema>;
|