@sveltia/cms 0.63.0 → 0.63.1

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/main.d.ts ADDED
@@ -0,0 +1,81 @@
1
+ export default CMS;
2
+ declare namespace CMS {
3
+ export { init };
4
+ export { registerCustomFormat };
5
+ export { registerEditorComponent };
6
+ export { registerEventListener };
7
+ export { registerPreviewStyle };
8
+ export { registerPreviewTemplate };
9
+ export { registerWidget };
10
+ }
11
+ /**
12
+ * Initialize the CMS, optionally with the given site configuration.
13
+ * @param {object} [options] Options.
14
+ * @param {SiteConfig} [options.config] Configuration to be merged with `config.yml`. Include
15
+ * `load_config_file: false` to prevent the configuration file from being loaded.
16
+ * @see https://decapcms.org/docs/manual-initialization/
17
+ */
18
+ export function init({ config }?: {
19
+ config?: SiteConfig;
20
+ }): Promise<void>;
21
+ /**
22
+ * Register a custom entry file format.
23
+ * @param {string} name Format name. This should match the `format` option of a collection where the
24
+ * custom format will be used..
25
+ * @param {string} extension File extension.
26
+ * @param {{ fromFile?: FileParser, toFile?: FileFormatter }} methods Parser and/or formatter
27
+ * methods. Async functions can be used.
28
+ * @see https://decapcms.org/docs/custom-formatters/
29
+ */
30
+ declare function registerCustomFormat(name: string, extension: string, { fromFile, toFile }: {
31
+ fromFile?: FileParser;
32
+ toFile?: FileFormatter;
33
+ }): void;
34
+ /**
35
+ * Register a custom component.
36
+ * @param {EditorComponentDefinition} definition Component definition.
37
+ * @see https://decapcms.org/docs/custom-widgets/#registereditorcomponent
38
+ */
39
+ declare function registerEditorComponent(definition: EditorComponentDefinition): void;
40
+ /**
41
+ * Register an event listener.
42
+ * @param {AppEventListener} eventListener Event listener.
43
+ * @see https://decapcms.org/docs/registering-events/
44
+ */
45
+ declare function registerEventListener(eventListener: AppEventListener): void;
46
+ /**
47
+ * Register a custom preview style.
48
+ * @param {string} style File path or raw CSS string.
49
+ * @param {object} [options] Options.
50
+ * @param {boolean} [options.raw] Whether to use a CSS string.
51
+ * @see https://decapcms.org/docs/customization/#registerpreviewstyle
52
+ */
53
+ declare function registerPreviewStyle(style: string, { raw }?: {
54
+ raw?: boolean;
55
+ }): void;
56
+ /**
57
+ * Register a custom preview template.
58
+ * @param {string} name Template name.
59
+ * @param {ComponentType<CustomPreviewTemplateProps>} component React component.
60
+ * @see https://decapcms.org/docs/customization/#registerpreviewtemplate
61
+ */
62
+ declare function registerPreviewTemplate(name: string, component: ComponentType<CustomPreviewTemplateProps>): void;
63
+ /**
64
+ * Register a custom widget.
65
+ * @param {string} name Widget name.
66
+ * @param {ComponentType<CustomWidgetControlProps> | string} control Component for the edit pane.
67
+ * @param {ComponentType<CustomWidgetPreviewProps>} [preview] Component for the preview pane.
68
+ * @param {CustomWidgetSchema} [schema] Field schema.
69
+ * @see https://decapcms.org/docs/custom-widgets/
70
+ */
71
+ declare function registerWidget(name: string, control: ComponentType<CustomWidgetControlProps> | string, preview?: ComponentType<CustomWidgetPreviewProps>, schema?: CustomWidgetSchema): void;
72
+ import type { SiteConfig } from './types/public';
73
+ import type { FileParser } from './types/public';
74
+ import type { FileFormatter } from './types/public';
75
+ import type { EditorComponentDefinition } from './types/public';
76
+ import type { AppEventListener } from './types/public';
77
+ import type { CustomPreviewTemplateProps } from './types/public';
78
+ import type { ComponentType } from 'react';
79
+ import type { CustomWidgetControlProps } from './types/public';
80
+ import type { CustomWidgetPreviewProps } from './types/public';
81
+ import type { CustomWidgetSchema } from './types/public';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sveltia/cms",
3
- "version": "0.63.0",
3
+ "version": "0.63.1",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "repository": {
@@ -16,7 +16,9 @@
16
16
  "@types/react": "^19.0.12"
17
17
  },
18
18
  "files": [
19
- "dist"
19
+ "dist",
20
+ "types",
21
+ "main.d.ts"
20
22
  ],
21
23
  "main": "./dist/sveltia-cms.mjs",
22
24
  "module": "./dist/sveltia-cms.mjs",