@cloudcannon/configuration-types 0.0.37 → 0.0.38

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.
Files changed (44) hide show
  1. package/dist/cloudcannon-config.latest.schema.json +9352 -10957
  2. package/dist/cloudcannon-config.legacy-eleventy.schema.json +9476 -11075
  3. package/dist/cloudcannon-config.legacy-hugo.schema.json +9424 -11028
  4. package/dist/cloudcannon-config.legacy-jekyll.schema.json +9476 -11075
  5. package/dist/cloudcannon-config.legacy-reader.schema.json +5882 -7489
  6. package/package.json +19 -21
  7. package/src/build-coupled.ts +295 -0
  8. package/src/cascade.ts +38 -0
  9. package/src/configuration.ts +421 -0
  10. package/src/documentation.ts +22 -0
  11. package/src/editables.ts +243 -0
  12. package/src/icon.ts +3597 -0
  13. package/src/image-options.ts +72 -0
  14. package/src/index.ts +40 -0
  15. package/src/inputs.ts +993 -0
  16. package/src/markdown.ts +97 -0
  17. package/src/mimetype.ts +445 -0
  18. package/src/paths.ts +43 -0
  19. package/src/preview.ts +125 -0
  20. package/src/select-values.ts +26 -0
  21. package/src/snippets.ts +113 -0
  22. package/src/source-editor.ts +68 -0
  23. package/src/structures.ts +120 -0
  24. package/src/syntax.ts +183 -0
  25. package/src/timezone.ts +607 -0
  26. package/src/build-coupled.d.ts +0 -315
  27. package/src/cascade.d.ts +0 -37
  28. package/src/cloudcannon-config.schema.json +0 -79
  29. package/src/configuration.d.ts +0 -750
  30. package/src/documentation.d.ts +0 -18
  31. package/src/editables.d.ts +0 -252
  32. package/src/icon.d.ts +0 -3585
  33. package/src/image-resizeable.d.ts +0 -65
  34. package/src/index.d.ts +0 -36
  35. package/src/inputs.d.ts +0 -1647
  36. package/src/javascript-api.d.ts +0 -204
  37. package/src/markdown.d.ts +0 -103
  38. package/src/paths.d.ts +0 -44
  39. package/src/preview.d.ts +0 -110
  40. package/src/select-values.d.ts +0 -6
  41. package/src/snippets.d.ts +0 -227
  42. package/src/source-editor.d.ts +0 -92
  43. package/src/structures.d.ts +0 -113
  44. package/src/timezone.d.ts +0 -596
@@ -1,204 +0,0 @@
1
- import type { Cascade } from './cascade';
2
- import type { SnippetConfig } from './snippets';
3
- import type { FileInput, UrlInput, RichTextInput } from './inputs';
4
-
5
- export interface CloseCustomDataPanelOptions {
6
- parentId: string;
7
- id: string;
8
- }
9
-
10
- export interface OpenCustomDataPanelOptions extends CloseCustomDataPanelOptions {
11
- data: Record<string, any> | any[] | undefined;
12
- position?: DOMRect;
13
- title: string;
14
- inputConfig: Cascade & SnippetConfig;
15
- allowFullDataCascade?: boolean;
16
- }
17
-
18
- /**
19
- * Interface defining the public JavaScript API for interacting with CloudCannon's Visual Editor.
20
- * This API provides methods for managing content, handling file operations, and controlling the
21
- * editor's state.
22
- */
23
- export interface CloudCannonJavaScriptAPI {
24
- /**
25
- * Whether event handling is currently enabled
26
- */
27
- eventsEnabled: boolean;
28
- /**
29
- * Whether the API should be installed globally
30
- */
31
- installGlobally: boolean;
32
-
33
- /**
34
- * Disables the global installation of the API
35
- */
36
- disableGlobalInstall(): void;
37
-
38
- /**
39
- * Enables event handling for the API This will also ensure the commit model is created
40
- */
41
- enableEvents(): void;
42
-
43
- /**
44
- * Disables event handling for the API
45
- */
46
- disableEvents(): void;
47
-
48
- /**
49
- * Refreshes the editor interface Note: This has been replaced with a MutationObserver in
50
- * editor-overlays-view
51
- */
52
- refreshInterface(): void;
53
-
54
- /**
55
- * Triggers an update event for a specific file
56
- *
57
- * @param sourcePath - The path of the file to update
58
- */
59
- triggerUpdateEvent(sourcePath: string): void;
60
-
61
- /**
62
- * Sets the loading state of the editor
63
- *
64
- * @param loadingData - Optional loading state message
65
- * @returns Promise that resolves when loading state is updated
66
- */
67
- setLoading(loadingData: string | undefined): Promise<any>;
68
-
69
- /**
70
- * Sets data for a specific field
71
- *
72
- * @param slug - The identifier of the field to set
73
- * @param value - The value to set
74
- * @returns Promise that resolves when the data is set
75
- */
76
- set(slug: string, value: any): Promise<any>;
77
-
78
- /**
79
- * Initiates editing of a specific field
80
- *
81
- * @param slug - The identifier of the field to edit
82
- * @param style - Optional style information
83
- * @param e - The mouse event that triggered the edit
84
- */
85
- edit(slug: string, style: string | null, e: MouseEvent): void;
86
-
87
- /**
88
- * Opens a custom data panel for editing
89
- *
90
- * @param options - Configuration options for the panel
91
- * @returns Promise that resolves when the panel is opened
92
- */
93
- openCustomDataPanel(options: OpenCustomDataPanelOptions): Promise<void>;
94
-
95
- /**
96
- * Closes a custom data panel
97
- *
98
- * @param options - Configuration options for the panel to close
99
- * @returns Promise that resolves when the panel is closed
100
- */
101
- closeCustomDataPanel(options: CloseCustomDataPanelOptions): Promise<void>;
102
-
103
- /**
104
- * Uploads a file to the editor
105
- *
106
- * @param file - The file to upload
107
- * @param inputConfig - Optional configuration for the input
108
- * @returns Promise that resolves with the path of the uploaded file
109
- */
110
- uploadFile(
111
- file: File,
112
- inputConfig: RichTextInput | UrlInput | FileInput | undefined,
113
- ): Promise<string | undefined>;
114
-
115
- /**
116
- * Adds an item to an array field
117
- *
118
- * @param slug - The identifier of the array field
119
- * @param index - The position to insert at (null for end)
120
- * @param value - The value to insert
121
- * @param e - The mouse event that triggered the addition
122
- * @returns Promise that resolves when the item is added
123
- */
124
- addArrayItem(slug: string, index: number | null, value: any, e: MouseEvent): Promise<void>;
125
-
126
- /**
127
- * Adds an item before a specific index in an array field
128
- *
129
- * @param slug - The identifier of the array field
130
- * @param index - The index to insert before
131
- * @param value - The value to insert
132
- * @param e - The mouse event that triggered the addition
133
- * @returns Promise that resolves when the item is added
134
- */
135
- addArrayItemBefore(slug: string, index: number, value: any, e: MouseEvent): Promise<void>;
136
-
137
- /**
138
- * Adds an item after a specific index in an array field
139
- *
140
- * @param slug - The identifier of the array field
141
- * @param index - The index to insert after
142
- * @param value - The value to insert
143
- * @param e - The mouse event that triggered the addition
144
- * @returns Promise that resolves when the item is added
145
- */
146
- addArrayItemAfter(slug: string, index: number, value: any, e: MouseEvent): Promise<void>;
147
-
148
- /**
149
- * Removes an item from an array field
150
- *
151
- * @param slug - The identifier of the array field
152
- * @param index - The index of the item to remove
153
- * @returns Promise that resolves when the item is removed
154
- */
155
- removeArrayItem(slug: string, index: number): Promise<void>;
156
-
157
- /**
158
- * Moves an item within an array field
159
- *
160
- * @param slug - The identifier of the array field
161
- * @param index - The current index of the item
162
- * @param toIndex - The target index for the item
163
- * @returns Promise that resolves when the item is moved
164
- */
165
- moveArrayItem(slug: string, index: number, toIndex: number): Promise<void>;
166
-
167
- /**
168
- * Gets the current value of the editor
169
- *
170
- * @param options - Optional configuration for the value retrieval
171
- * @returns Promise that resolves with the current value
172
- */
173
- value(options?: { keepMarkdownAsHTML?: boolean }): Promise<string>;
174
-
175
- /**
176
- * Claims a lock on a file
177
- *
178
- * @param sourcePath - Optional path of the file to lock
179
- * @returns Promise that resolves with the lock status
180
- */
181
- claimLock(sourcePath?: string): Promise<{ readOnly: boolean }>;
182
-
183
- /**
184
- * Releases a lock on a file
185
- *
186
- * @param sourcePath - Optional path of the file to unlock
187
- * @returns Promise that resolves with the lock status
188
- */
189
- releaseLock(sourcePath?: string): Promise<{ readOnly: boolean }>;
190
-
191
- /**
192
- * Gets prefetched files
193
- *
194
- * @returns Promise that resolves with a record of file blobs
195
- */
196
- prefetchedFiles(): Promise<Record<string, Blob>>;
197
-
198
- /**
199
- * Loads legacy Bookshop information
200
- *
201
- * @returns Promise that resolves with the Bookshop data
202
- */
203
- loadLegacyBookshopInfo(): Promise<any>;
204
- }
package/src/markdown.d.ts DELETED
@@ -1,103 +0,0 @@
1
- export type AttributeListPosition =
2
- | 'none'
3
- | 'right'
4
- | 'space right'
5
- | 'below'
6
- | 'newline below'
7
- | 'right-of-prefix';
8
-
9
- export type MarkdownAttributeElementOptions = {
10
- inline?: AttributeListPosition;
11
- block?: AttributeListPosition;
12
- } & {
13
- [index: string]: AttributeListPosition;
14
- };
15
-
16
- export interface MarkdownSettings {
17
- /**
18
- * The flavor of Markdown to use to convert between HTML and Markdown.
19
- *
20
- * @default commonmark
21
- */
22
- engine: 'commonmark' | 'kramdown';
23
- options: {
24
- /**
25
- * Output HTML tags from source.
26
- */
27
- html?: boolean;
28
- /**
29
- * Use `/` to close single tags (e.g. `<br />`).
30
- */
31
- xhtml?: boolean;
32
- /**
33
- * Convert `\n` in paragraphs into `<br>`.
34
- */
35
- breaks?: boolean;
36
- /**
37
- * Autoconvert URL-like text to links.
38
- */
39
- linkify?: boolean;
40
- /**
41
- * Enable some language-neutral replacement, as well as quotes beautification.
42
- */
43
- typographer?: boolean;
44
- /**
45
- * Double + single quotes replacement pairs, when typographer enabled and smartquotes on. For
46
- * example, you can use `'«»„“'` for Russian, `'„“‚‘'` for German, and `['«\xA0', '\xA0»',
47
- * '‹\xA0', '\xA0›']` for French (including `nbsp`).
48
- */
49
- quotes?: string;
50
- /**
51
- * Output lists with an extra space in Markdown.
52
- */
53
- spaced_lists?: boolean;
54
- /**
55
- * Add linebreaks between sentences in Markdown.
56
- */
57
- sentence_per_line?: boolean;
58
- /**
59
- * Enable GFM mode.
60
- */
61
- gfm?: boolean;
62
- /**
63
- * Determines which style of code block fences to use.
64
- */
65
- code_block_fences?: '```' | '~~~';
66
- /**
67
- * Determines whether 4 spaces on indentation should be read as a code block.
68
- */
69
- treat_indentation_as_code?: boolean;
70
- /**
71
- * Render snippets as plain text within code blocks.
72
- */
73
- escape_snippets_in_code_blocks?: boolean;
74
- /**
75
- * Output tables in Markdown format.
76
- */
77
- table?: boolean;
78
- /**
79
- * Output strikes in wrapped in double tildes (e.g. `~~strike~~`).
80
- */
81
- strikethrough?: boolean;
82
- /**
83
- * Output subscript in wrapped in tildes (e.g. `~sub~`).
84
- */
85
- subscript?: boolean;
86
- /**
87
- * Output superscript in wrapped in carets (e.g. `^super^`).
88
- */
89
- superscript?: boolean;
90
- /**
91
- * Generate IDs for headings.
92
- */
93
- heading_ids?: boolean;
94
- /**
95
- * Save element attributes in Markdown format instead of converting to HTML.
96
- */
97
- attributes?: boolean;
98
- /**
99
- * Define positioning behavior of Markdown attributes for different elements.
100
- */
101
- attribute_elements?: MarkdownAttributeElementOptions;
102
- };
103
- }
package/src/paths.d.ts DELETED
@@ -1,44 +0,0 @@
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
- }
package/src/preview.d.ts DELETED
@@ -1,110 +0,0 @@
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?: PreviewEntry;
53
- /**
54
- * Controls the background color of the icon.
55
- */
56
- icon_background_color?: PreviewEntry;
57
- }
58
-
59
- export interface WithPreview {
60
- /**
61
- * Changes the way items are previewed in the CMS.
62
- */
63
- preview?: Preview;
64
- }
65
-
66
- export interface WithPickerPreview {
67
- /**
68
- * Changes the way items are previewed in the CMS while being chosen.
69
- */
70
- picker_preview?: Preview;
71
- }
72
-
73
- export interface PreviewGallery
74
- extends WithTextPreview,
75
- WithImagePreview,
76
- WithIconPreview,
77
- WithIconColorPreview {
78
- /**
79
- * Controls how the gallery image is positioned within the gallery.
80
- *
81
- * @default padded
82
- */
83
- fit?: 'padded' | 'cover' | 'contain' | 'cover-top';
84
- /**
85
- * Controls the background color gallery area.
86
- */
87
- background_color?: PreviewEntry;
88
- }
89
-
90
- export interface PreviewMetadata
91
- extends WithTextPreview,
92
- WithImagePreview,
93
- WithIconPreview,
94
- WithIconColorPreview {}
95
-
96
- export interface Preview
97
- extends WithTextPreview,
98
- WithImagePreview,
99
- WithIconPreview,
100
- WithIconColorPreview,
101
- WithSubtextPreview {
102
- /**
103
- * Defines a list of items that can contain an image, icon, and text.
104
- */
105
- metadata?: PreviewMetadata[];
106
- /**
107
- * Details for large image/icon preview per item.
108
- */
109
- gallery?: PreviewGallery;
110
- }
@@ -1,6 +0,0 @@
1
- export type SelectValues =
2
- | string[]
3
- | Record<string, string>[]
4
- | Record<string, string>
5
- | Record<string, unknown>[]
6
- | Record<string, unknown>;
package/src/snippets.d.ts DELETED
@@ -1,227 +0,0 @@
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
- }