@cloudcannon/configuration-types 0.0.22 → 0.0.24

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/markdown.d.ts CHANGED
@@ -17,7 +17,7 @@ export interface MarkdownSettings {
17
17
  /**
18
18
  * The flavor of Markdown to use to convert between HTML and Markdown.
19
19
  *
20
- * @default kramdown
20
+ * @default commonmark
21
21
  */
22
22
  engine: 'commonmark' | 'kramdown';
23
23
  options: {
package/src/paths.d.ts ADDED
@@ -0,0 +1,44 @@
1
+ export interface Paths {
2
+ /**
3
+ * Location of assets that are statically copied to the output site. This prefix will be removed
4
+ * from the _Uploads_ path when CloudCannon outputs the URL of an asset.
5
+ */
6
+ static?: string;
7
+ /**
8
+ * Default location of newly uploaded site files.
9
+ *
10
+ * @default uploads
11
+ */
12
+ uploads?: string;
13
+ /**
14
+ * Filename template for newly uploaded site files.
15
+ */
16
+ uploads_filename?: string;
17
+ /**
18
+ * Default location of newly uploaded DAM files.
19
+ */
20
+ dam_uploads?: string;
21
+ /**
22
+ * Filename template for newly uploaded DAM files.
23
+ */
24
+ dam_uploads_filename?: string;
25
+ /**
26
+ * Location of statically copied assets for DAM files. This prefix will be removed from the _DAM
27
+ * Uploads_ path when CloudCannon outputs the URL of an asset.
28
+ */
29
+ dam_static?: string;
30
+ /**
31
+ * When set to true, CloudCannon will reference files relative to the path of the file they were
32
+ * uploaded to.
33
+ */
34
+ uploads_use_relative_path?: boolean;
35
+ }
36
+
37
+ export interface WithPaths {
38
+ /**
39
+ * Paths to where new asset files are uploaded to. They also set the default path when choosing
40
+ * existing images, and linking to existing files. Each path is relative to global `source`.
41
+ * Defaults to the global `paths`.
42
+ */
43
+ paths?: Paths;
44
+ }
@@ -0,0 +1,102 @@
1
+ interface PreviewKeyEntry {
2
+ /**
3
+ * The key used to access the value used for the preview.
4
+ */
5
+ key: string;
6
+ }
7
+
8
+ interface PreviewTemplateEntry {
9
+ /**
10
+ * A template string containing various placeholders for the value used in the preview.
11
+ */
12
+ template: string;
13
+ }
14
+
15
+ type PreviewEntry =
16
+ | Array<PreviewKeyEntry | PreviewTemplateEntry | string | boolean>
17
+ | string
18
+ | boolean;
19
+
20
+ export interface WithTextPreview {
21
+ /**
22
+ * Controls the main text shown per item.
23
+ */
24
+ text?: PreviewEntry;
25
+ }
26
+
27
+ export interface WithImagePreview {
28
+ /**
29
+ * Controls the image shown per item.
30
+ */
31
+ image?: PreviewEntry;
32
+ }
33
+
34
+ export interface WithSubtextPreview {
35
+ /**
36
+ * Controls the supporting text shown per item.
37
+ */
38
+ subtext?: PreviewEntry;
39
+ }
40
+
41
+ export interface WithIconPreview {
42
+ /**
43
+ * Controls the icon shown per item. Must result in a Material Icon name.
44
+ */
45
+ icon?: PreviewEntry;
46
+ }
47
+
48
+ export interface WithIconColorPreview {
49
+ /**
50
+ * Controls the color of the icon.
51
+ */
52
+ icon_color?: string;
53
+ }
54
+
55
+ export interface WithPreview {
56
+ /**
57
+ * Changes the way items are previewed in the CMS.
58
+ */
59
+ preview?: Preview;
60
+ }
61
+
62
+ export interface WithPickerPreview {
63
+ /**
64
+ * Changes the way items are previewed in the CMS while being chosen.
65
+ */
66
+ picker_preview?: Preview;
67
+ }
68
+
69
+ export interface PreviewGallery
70
+ extends WithTextPreview,
71
+ WithImagePreview,
72
+ WithIconPreview,
73
+ WithIconColorPreview {
74
+ /**
75
+ * Controls how the gallery image is positioned within the gallery.
76
+ *
77
+ * @default padded
78
+ */
79
+ fit?: 'padded' | 'cover' | 'contain' | 'cover-top';
80
+ }
81
+
82
+ export interface PreviewMetadata
83
+ extends WithTextPreview,
84
+ WithImagePreview,
85
+ WithIconPreview,
86
+ WithIconColorPreview {}
87
+
88
+ export interface Preview
89
+ extends WithTextPreview,
90
+ WithImagePreview,
91
+ WithIconPreview,
92
+ WithIconColorPreview,
93
+ WithSubtextPreview {
94
+ /**
95
+ * Defines a list of items that can contain an image, icon, and text.
96
+ */
97
+ metadata?: PreviewMetadata[];
98
+ /**
99
+ * Details for large image/icon preview per item.
100
+ */
101
+ gallery?: PreviewGallery;
102
+ }
@@ -0,0 +1,6 @@
1
+ export type SelectValues =
2
+ | string[]
3
+ | Record<string, string>[]
4
+ | Record<string, string>
5
+ | Record<string, unknown>[]
6
+ | Record<string, unknown>;
@@ -0,0 +1,227 @@
1
+ import type Scrapbooker from '@cloudcannon/snippet-types';
2
+ import type { ReducedCascade } from './cascade';
3
+ import type { WithPickerPreview, WithPreview } from './preview';
4
+
5
+ // TODO: use SnippetConfig from @cloudcannon/scrap-booker when ParserConfig issue resolved.
6
+ export interface SnippetConfig extends ReducedCascade, WithPreview, WithPickerPreview {
7
+ /**
8
+ * Name of the snippet.
9
+ */
10
+ snippet?: string;
11
+ /**
12
+ * The template that this snippet should inherit, out of the available Shortcode Templates.
13
+ */
14
+ template?: string;
15
+ /**
16
+ * Whether this snippet can appear inline (within a sentence). Defaults to false, which will treat
17
+ * this snippet as a block-level element in the content editor.
18
+ */
19
+ inline?: boolean;
20
+ /**
21
+ * Controls how selected items are rendered. Defaults to 'card', or 'inline' if `inline` is true.
22
+ */
23
+ view?: 'card' | 'inline' | 'gallery';
24
+ /**
25
+ * Whether this snippet treats whitespace as-is or not.
26
+ */
27
+ strict_whitespace?: boolean;
28
+ /**
29
+ * The variables required for the selected template.
30
+ */
31
+ definitions?: Record<string, unknown>;
32
+ /**
33
+ * Alternate configurations for this snippet.
34
+ */
35
+ alternate_formats?: SnippetConfig[];
36
+ /**
37
+ * The parameters of this snippet.
38
+ */
39
+ params?: Record<string, unknown>; // TODO: use ParserConfig from @cloudcannon/scrap-booker.
40
+ }
41
+
42
+ export interface SnippetsImports {
43
+ /**
44
+ * Default snippets for Hugo SSG.
45
+ */
46
+ hugo?:
47
+ | boolean
48
+ | {
49
+ /**
50
+ * The list of excluded snippets. If unset, all snippets are excluded unless defined in
51
+ * `include`.
52
+ *
53
+ * @uniqueItems
54
+ */
55
+ exclude: Array<keyof typeof Scrapbooker.defaults.hugo.snippets>;
56
+ }
57
+ | {
58
+ /**
59
+ * The list of included snippets. If unset, all snippets are included unless defined in
60
+ * `exclude`.
61
+ *
62
+ * @uniqueItems
63
+ */
64
+ include: Array<keyof typeof Scrapbooker.defaults.hugo.snippets>;
65
+ };
66
+ /**
67
+ * Default snippets for Jekyll SSG.
68
+ */
69
+ jekyll?:
70
+ | boolean
71
+ | {
72
+ /**
73
+ * The list of excluded snippets. If unset, all snippets are excluded unless defined in
74
+ * `include`.
75
+ *
76
+ * @uniqueItems
77
+ */
78
+ exclude: Array<keyof typeof Scrapbooker.defaults.jekyll.snippets>;
79
+ }
80
+ | {
81
+ /**
82
+ * The list of included snippets. If unset, all snippets are included unless defined in
83
+ * `exclude`.
84
+ *
85
+ * @uniqueItems
86
+ */
87
+ include: Array<keyof typeof Scrapbooker.defaults.jekyll.snippets>;
88
+ };
89
+ /**
90
+ * Default snippets for MDX-based content.
91
+ */
92
+ mdx?:
93
+ | boolean
94
+ | {
95
+ /**
96
+ * The list of excluded snippets. If unset, all snippets are excluded unless defined in
97
+ * `include`.
98
+ *
99
+ * @uniqueItems
100
+ */
101
+ exclude: Array<keyof typeof Scrapbooker.defaults.mdx.snippets>;
102
+ }
103
+ | {
104
+ /**
105
+ * The list of included snippets. If unset, all snippets are included unless defined in
106
+ * `exclude`.
107
+ *
108
+ * @uniqueItems
109
+ */
110
+ include: Array<keyof typeof Scrapbooker.defaults.mdx.snippets>;
111
+ };
112
+ /**
113
+ * Default snippets for Eleventy SSG Liquid files.
114
+ */
115
+ eleventy_liquid?:
116
+ | boolean
117
+ | {
118
+ /**
119
+ * The list of excluded snippets. If unset, all snippets are excluded unless defined in
120
+ * `include`.
121
+ *
122
+ * @uniqueItems
123
+ */
124
+ exclude: Array<keyof typeof Scrapbooker.defaults.eleventy_liquid.snippets>;
125
+ }
126
+ | {
127
+ /**
128
+ * The list of included snippets. If unset, all snippets are included unless defined in
129
+ * `exclude`.
130
+ *
131
+ * @uniqueItems
132
+ */
133
+ include: Array<keyof typeof Scrapbooker.defaults.eleventy_liquid.snippets>;
134
+ };
135
+ /**
136
+ * Default snippets for Eleventy SSG Nunjucks files.
137
+ */
138
+ eleventy_nunjucks?:
139
+ | boolean
140
+ | {
141
+ /**
142
+ * The list of excluded snippets. If unset, all snippets are excluded unless defined in
143
+ * `include`.
144
+ *
145
+ * @uniqueItems
146
+ */
147
+ exclude: Array<keyof typeof Scrapbooker.defaults.eleventy_nunjucks.snippets>;
148
+ }
149
+ | {
150
+ /**
151
+ * The list of included snippets. If unset, all snippets are included unless defined in
152
+ * `exclude`.
153
+ *
154
+ * @uniqueItems
155
+ */
156
+ include: Array<keyof typeof Scrapbooker.defaults.eleventy_nunjucks.snippets>;
157
+ };
158
+ /**
159
+ * Default snippets for Markdoc-based content.
160
+ */
161
+ markdoc?:
162
+ | boolean
163
+ | {
164
+ /**
165
+ * The list of excluded snippets. If unset, all snippets are excluded unless defined in
166
+ * `include`.
167
+ *
168
+ * @uniqueItems
169
+ */
170
+ exclude: Array<keyof typeof Scrapbooker.defaults.markdoc.snippets>;
171
+ }
172
+ | {
173
+ /**
174
+ * The list of included snippets. If unset, all snippets are included unless defined in
175
+ * `exclude`.
176
+ *
177
+ * @uniqueItems
178
+ */
179
+ include: Array<keyof typeof Scrapbooker.defaults.markdoc.snippets>;
180
+ };
181
+ /**
182
+ * Default snippets for content using Python markdown extensions.
183
+ */
184
+ python_markdown_extensions?:
185
+ | boolean
186
+ | {
187
+ /**
188
+ * The list of excluded snippets. If unset, all snippets are excluded unless defined in
189
+ * `include`.
190
+ *
191
+ * @uniqueItems
192
+ */
193
+ exclude: Array<keyof typeof Scrapbooker.defaults.python_markdown_extensions.snippets>;
194
+ }
195
+ | {
196
+ /**
197
+ * The list of included snippets. If unset, all snippets are included unless defined in
198
+ * `exclude`.
199
+ *
200
+ * @uniqueItems
201
+ */
202
+ include: Array<keyof typeof Scrapbooker.defaults.python_markdown_extensions.snippets>;
203
+ };
204
+ /**
205
+ * Default snippets for Docusaurus SSG.
206
+ */
207
+ docusaurus_mdx?:
208
+ | boolean
209
+ | {
210
+ /**
211
+ * The list of excluded snippets. If unset, all snippets are excluded unless defined in
212
+ * `include`.
213
+ *
214
+ * @uniqueItems
215
+ */
216
+ exclude: Array<keyof typeof Scrapbooker.defaults.docusaurus_mdx.snippets>;
217
+ }
218
+ | {
219
+ /**
220
+ * The list of included snippets. If unset, all snippets are included unless defined in
221
+ * `exclude`.
222
+ *
223
+ * @uniqueItems
224
+ */
225
+ include: Array<keyof typeof Scrapbooker.defaults.docusaurus_mdx.snippets>;
226
+ };
227
+ }
@@ -0,0 +1,86 @@
1
+ /**
2
+ * This key defines the appearance and behavior of the Source Editor. The following nested keys are
3
+ * available:
4
+ *
5
+ * - `tab_size`
6
+ * - `show_gutter`
7
+ * - `theme`
8
+ *
9
+ * This key has no default.
10
+ *
11
+ * https://cloudcannon.com/documentation/articles/the-source-editor/#source_editor
12
+ */
13
+ export interface SourceEditor {
14
+ /**
15
+ * This key defines the auto-indentation of each line and how many spaces a tab indentation counts
16
+ * as.
17
+ *
18
+ * By default, this key is `2`.
19
+ *
20
+ * https://cloudcannon.com/documentation/articles/the-source-editor/#source_editor.tab_size
21
+ *
22
+ * @default 2
23
+ */
24
+ tab_size?: number;
25
+ /**
26
+ * This key defines the color theme for syntax highlighting in the Source Editor.
27
+ *
28
+ * By default, this key is `monokai`.
29
+ *
30
+ * https://cloudcannon.com/documentation/articles/the-source-editor/#source_editor.theme
31
+ *
32
+ * @default monokai
33
+ */
34
+ theme?: Theme;
35
+ /**
36
+ * This key toggles the gutter on the left of the editing interface, displaying line numbers and
37
+ * code folding controls.
38
+ *
39
+ * By default, this key is `true`.
40
+ *
41
+ * https://cloudcannon.com/documentation/articles/the-source-editor/#source_editor.show_gutter
42
+ *
43
+ * @default true
44
+ */
45
+ show_gutter?: boolean;
46
+ }
47
+
48
+ export type Theme =
49
+ | 'ambiance'
50
+ | 'chaos'
51
+ | 'chrome'
52
+ | 'clouds'
53
+ | 'clouds_midnight'
54
+ | 'cobalt'
55
+ | 'crimson_editor'
56
+ | 'dawn'
57
+ | 'dracula'
58
+ | 'dreamweaver'
59
+ | 'eclipse'
60
+ | 'github'
61
+ | 'gob'
62
+ | 'gruvbox'
63
+ | 'idle_fingers'
64
+ | 'iplastic'
65
+ | 'katzenmilch'
66
+ | 'kr_theme'
67
+ | 'kuroir'
68
+ | 'merbivore'
69
+ | 'merbivore_soft'
70
+ | 'mono_industrial'
71
+ | 'monokai'
72
+ | 'nord_dark'
73
+ | 'pastel_on_dark'
74
+ | 'solarized_dark'
75
+ | 'solarized_light'
76
+ | 'sqlserver'
77
+ | 'terminal'
78
+ | 'textmate'
79
+ | 'tomorrow'
80
+ | 'tomorrow_night'
81
+ | 'tomorrow_night_blue'
82
+ | 'tomorrow_night_bright'
83
+ | 'tomorrow_night_eighties'
84
+ | 'twilight'
85
+ | 'vibrant_ink'
86
+ | 'xcode';
@@ -0,0 +1,113 @@
1
+ import type { Cascade } from './cascade';
2
+ import type { Documentation } from './documentation';
3
+ import type { Icon } from './icon';
4
+ import type { ObjectInputGroup } from './inputs';
5
+ import type { WithPickerPreview, WithPreview } from './preview';
6
+
7
+ interface StructureBase {
8
+ /**
9
+ * If true, inputs are sorted to match when editing. Extra inputs are ordered after expected
10
+ * inputs, unless `remove_extra_inputs` is true. Defaults to true.
11
+ */
12
+ reorder_inputs?: boolean;
13
+ /**
14
+ * Hides unexpected inputs when editing. Has no effect if `remove_extra_inputs` is true. Defaults
15
+ * to false.
16
+ */
17
+ hide_extra_inputs?: boolean;
18
+ /**
19
+ * If checked, empty inputs are removed from the source file on save. Removed inputs will be
20
+ * available for editing again, provided they are in the matching schema/structure. Defaults to
21
+ * false.
22
+ */
23
+ remove_empty_inputs?: boolean;
24
+ /**
25
+ * If checked, extra inputs are removed when editing. Defaults to true.
26
+ */
27
+ remove_extra_inputs?: boolean;
28
+ }
29
+
30
+ export interface Structure extends StructureBase {
31
+ /**
32
+ * Defines what values are available to add when using this structure.
33
+ */
34
+ values: StructureValue[];
35
+ /**
36
+ * Defines what key should be used to detect which structure an item is. If this key is not found
37
+ * in the existing structure, a comparison of key names is used. Defaults to "_type".
38
+ */
39
+ id_key?: string;
40
+ /**
41
+ * Defines whether options are shown to your editors in a select menu (select, default) or a modal
42
+ * pop up window (modal) when adding a new item.
43
+ *
44
+ * @default select
45
+ */
46
+ style?: 'select' | 'modal';
47
+ }
48
+
49
+ export interface StructureValue extends WithPreview, WithPickerPreview, StructureBase, Cascade {
50
+ /**
51
+ * A unique reference value used when referring to this structure value from the Object input's
52
+ * assigned_structures option.
53
+ */
54
+ id?: string;
55
+ /**
56
+ * If set to true, this item will be considered the default type for this structure. If the type
57
+ * of a value within a structure cannot be inferred based on its id_key or matching fields, then
58
+ * it will fall back to this item. If multiple items have default set to true, only the first item
59
+ * will be used.
60
+ *
61
+ * @default false
62
+ */
63
+ default?: boolean;
64
+ /**
65
+ * An icon used when displaying the structure (defaults to either format_list_bulleted for items
66
+ * in arrays, or notes otherwise).
67
+ */
68
+ icon?: Icon;
69
+ /**
70
+ * Path to an image in your source files used when displaying the structure. Can be either a
71
+ * source (has priority) or output path.
72
+ */
73
+ image?: string;
74
+ /**
75
+ * Used as the main text in the interface for this value.
76
+ */
77
+ label?: string;
78
+ /**
79
+ * Used to group and filter items when selecting from a modal.
80
+ */
81
+ tags?: string[];
82
+ /**
83
+ * Allows you to group the inputs inside this object together without changing the data structure.
84
+ */
85
+ groups?: ObjectInputGroup[];
86
+ /**
87
+ * Controls which order input groups and ungrouped inputs appear in.
88
+ *
89
+ * @default false
90
+ */
91
+ place_groups_below?: boolean;
92
+ /**
93
+ * Show nested objects as tabs. Requires all top-level keys to be objects.
94
+ *
95
+ * @default false
96
+ */
97
+ tabbed?: boolean;
98
+ /**
99
+ * The actual value used when items are added after selection.
100
+ */
101
+ value: unknown;
102
+ /**
103
+ * Provides short descriptive text for editors shown in the Data Editor for expanded values
104
+ * matching this Structure value. Has no default. Supports a limited set of Markdown: links, bold,
105
+ * italic, subscript, superscript, and inline code elements are allowed.
106
+ */
107
+ comment?: string;
108
+ /**
109
+ * Provides a custom link for documentation for editors shown in the Data Editor for expanded
110
+ * values matching this Structure value. Has no default.
111
+ */
112
+ documentation?: Documentation;
113
+ }