datocms-plugin-sdk 0.3.7 → 0.3.24-alpha.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/dist/cjs/connect.js +18 -7
- package/dist/cjs/connect.js.map +1 -1
- package/dist/cjs/guards.js +2 -1
- package/dist/cjs/guards.js.map +1 -1
- package/dist/esm/SiteApiSchema.d.ts +165 -81
- package/dist/esm/connect.d.ts +45 -26
- package/dist/esm/connect.js +19 -8
- package/dist/esm/connect.js.map +1 -1
- package/dist/esm/guards.d.ts +4 -1
- package/dist/esm/guards.js +1 -0
- package/dist/esm/guards.js.map +1 -1
- package/dist/esm/types.d.ts +591 -313
- package/dist/types/SiteApiSchema.d.ts +165 -81
- package/dist/types/connect.d.ts +45 -26
- package/dist/types/guards.d.ts +4 -1
- package/dist/types/types.d.ts +591 -313
- package/package.json +2 -2
- package/types.json +3079 -1488
package/dist/types/connect.d.ts
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import { Field, ModelBlock } from './SiteApiSchema';
|
|
2
|
-
import { ContentAreaSidebarItem, FieldExtensionOverride, InitPropertiesAndMethods, ItemFormSidebarPanel, MainNavigationTab, ManualFieldExtension, OnBootPropertiesAndMethods, RenderConfigScreenPropertiesAndMethods, RenderFieldExtensionPropertiesAndMethods, RenderManualFieldExtensionConfigScreenPropertiesAndMethods, RenderModalPropertiesAndMethods, RenderPagePropertiesAndMethods, RenderSidebarPanePropertiesAndMethods, SettingsAreaSidebarItemGroup } from './types';
|
|
2
|
+
import { AssetSource, ContentAreaSidebarItem, FieldExtensionOverride, InitPropertiesAndMethods, ItemFormSidebarPanel, MainNavigationTab, ManualFieldExtension, OnBootPropertiesAndMethods, RenderAssetSourcePropertiesAndMethods, RenderConfigScreenPropertiesAndMethods, RenderFieldExtensionPropertiesAndMethods, RenderManualFieldExtensionConfigScreenPropertiesAndMethods, RenderModalPropertiesAndMethods, RenderPagePropertiesAndMethods, RenderSidebarPanePropertiesAndMethods, SettingsAreaSidebarItemGroup } from './types';
|
|
3
3
|
export declare type SizingUtilities = {
|
|
4
4
|
/**
|
|
5
|
-
* Listens for DOM changes and automatically calls `setHeight` when it detects
|
|
6
|
-
* If you're using `datocms-react-ui` package, the `<Canvas />`
|
|
7
|
-
* care of calling this method for you.
|
|
5
|
+
* Listens for DOM changes and automatically calls `setHeight` when it detects
|
|
6
|
+
* a change. If you're using `datocms-react-ui` package, the `<Canvas />`
|
|
7
|
+
* component already takes care of calling this method for you.
|
|
8
8
|
*/
|
|
9
9
|
startAutoResizer: () => void;
|
|
10
10
|
/** Stops resizing the iframe automatically */
|
|
11
11
|
stopAutoResizer: () => void;
|
|
12
12
|
/**
|
|
13
|
-
* Triggers a change in the size of the iframe. If you don't explicitely pass
|
|
14
|
-
* `newHeight` it will be automatically calculated using the iframe content
|
|
13
|
+
* Triggers a change in the size of the iframe. If you don't explicitely pass
|
|
14
|
+
* a `newHeight` it will be automatically calculated using the iframe content
|
|
15
|
+
* at the moment
|
|
15
16
|
*/
|
|
16
17
|
updateHeight: (newHeight?: number) => void;
|
|
17
18
|
};
|
|
@@ -23,6 +24,7 @@ export declare type FieldIntentCtx = InitPropertiesAndMethods & {
|
|
|
23
24
|
};
|
|
24
25
|
export declare type RenderPageCtx = RenderPagePropertiesAndMethods;
|
|
25
26
|
export declare type RenderModalCtx = RenderModalPropertiesAndMethods & SizingUtilities;
|
|
27
|
+
export declare type RenderAssetSourceCtx = RenderAssetSourcePropertiesAndMethods & SizingUtilities;
|
|
26
28
|
export declare type RenderItemFormSidebarPanelCtx = RenderSidebarPanePropertiesAndMethods & SizingUtilities;
|
|
27
29
|
export declare type RenderFieldExtensionCtx = RenderFieldExtensionPropertiesAndMethods & SizingUtilities;
|
|
28
30
|
export declare type RenderManualFieldExtensionConfigScreenCtx = RenderManualFieldExtensionConfigScreenPropertiesAndMethods & SizingUtilities;
|
|
@@ -30,8 +32,8 @@ export declare type RenderConfigScreenCtx = RenderConfigScreenPropertiesAndMetho
|
|
|
30
32
|
/** The full options you can pass to the `connect` function */
|
|
31
33
|
export declare type FullConnectParameters = {
|
|
32
34
|
/**
|
|
33
|
-
* This function will be called once at boot time and can be used to perform
|
|
34
|
-
* initial integrity checks on the configuration.
|
|
35
|
+
* This function will be called once at boot time and can be used to perform
|
|
36
|
+
* ie. some initial integrity checks on the configuration.
|
|
35
37
|
*
|
|
36
38
|
* @group boot
|
|
37
39
|
*/
|
|
@@ -55,69 +57,86 @@ export declare type FullConnectParameters = {
|
|
|
55
57
|
*/
|
|
56
58
|
contentAreaSidebarItems: (ctx: IntentCtx) => ContentAreaSidebarItem[];
|
|
57
59
|
/**
|
|
58
|
-
* Use this function to declare new field extensions that users will be able
|
|
59
|
-
* manually in some field
|
|
60
|
+
* Use this function to declare new field extensions that users will be able
|
|
61
|
+
* to install manually in some field
|
|
60
62
|
*
|
|
61
63
|
* @group manualFieldExtensions
|
|
62
64
|
*/
|
|
63
65
|
manualFieldExtensions: (ctx: IntentCtx) => ManualFieldExtension[];
|
|
64
66
|
/**
|
|
65
|
-
* Use this function to declare
|
|
66
|
-
*
|
|
67
|
+
* Use this function to declare additional sources to be shown when users want
|
|
68
|
+
* to upload new assets
|
|
69
|
+
*
|
|
70
|
+
* @group assetSources
|
|
71
|
+
*/
|
|
72
|
+
assetSources: (ctx: IntentCtx) => AssetSource[] | void;
|
|
73
|
+
/**
|
|
74
|
+
* Use this function to declare new sidebar panels to be shown when the user
|
|
75
|
+
* edits records of a particular model
|
|
67
76
|
*
|
|
68
77
|
* @group sidebarPanels
|
|
69
78
|
*/
|
|
70
79
|
itemFormSidebarPanels: (itemType: ModelBlock, ctx: IntentCtx) => ItemFormSidebarPanel[];
|
|
71
80
|
/**
|
|
72
|
-
* Use this function to automatically force one or more field extensions to a
|
|
81
|
+
* Use this function to automatically force one or more field extensions to a
|
|
82
|
+
* particular field
|
|
73
83
|
*
|
|
74
84
|
* @group forcedFieldExtensions
|
|
75
85
|
*/
|
|
76
86
|
overrideFieldExtensions: (field: Field, ctx: FieldIntentCtx) => FieldExtensionOverride | void;
|
|
77
87
|
/**
|
|
78
|
-
* This function will be called when the plugin needs to render the plugin's
|
|
88
|
+
* This function will be called when the plugin needs to render the plugin's
|
|
89
|
+
* configuration form
|
|
79
90
|
*
|
|
80
91
|
* @group configScreen
|
|
81
92
|
*/
|
|
82
93
|
renderConfigScreen: (ctx: RenderConfigScreenCtx) => void;
|
|
83
94
|
/**
|
|
84
|
-
* This function will be called when the plugin needs to render a specific
|
|
85
|
-
* `mainNavigationTabs`, `settingsAreaSidebarItemGroups` and
|
|
95
|
+
* This function will be called when the plugin needs to render a specific
|
|
96
|
+
* page (see the `mainNavigationTabs`, `settingsAreaSidebarItemGroups` and
|
|
97
|
+
* `contentAreaSidebarItems` functions)
|
|
86
98
|
*
|
|
87
99
|
* @group pages
|
|
88
100
|
*/
|
|
89
101
|
renderPage: (pageId: string, ctx: RenderPageCtx) => void;
|
|
90
102
|
/**
|
|
91
|
-
* This function will be called when the plugin requested to open a modal (see
|
|
92
|
-
* `openModal` function)
|
|
103
|
+
* This function will be called when the plugin requested to open a modal (see
|
|
104
|
+
* the `openModal` function)
|
|
93
105
|
*
|
|
94
106
|
* @group modals
|
|
95
107
|
*/
|
|
96
108
|
renderModal: (modalId: string, ctx: RenderModalCtx) => void;
|
|
97
109
|
/**
|
|
98
|
-
* This function will be called when the plugin needs to render a sidebar
|
|
99
|
-
* `itemFormSidebarPanels` function)
|
|
110
|
+
* This function will be called when the plugin needs to render a sidebar
|
|
111
|
+
* panel (see the `itemFormSidebarPanels` function)
|
|
100
112
|
*
|
|
101
113
|
* @group sidebarPanels
|
|
102
114
|
*/
|
|
103
115
|
renderItemFormSidebarPanel: (sidebarPaneId: string, ctx: RenderItemFormSidebarPanelCtx) => void;
|
|
104
116
|
/**
|
|
105
|
-
* This function will be called when the
|
|
106
|
-
*
|
|
117
|
+
* This function will be called when the user selects one of the plugin's
|
|
118
|
+
* asset sources to upload a new media file.
|
|
119
|
+
*
|
|
120
|
+
* @group assetSources
|
|
121
|
+
*/
|
|
122
|
+
renderAssetSource: (assetSourceId: string, ctx: RenderAssetSourceCtx) => void;
|
|
123
|
+
/**
|
|
124
|
+
* This function will be called when the plugin needs to render a field
|
|
125
|
+
* extension (see the `manualFieldExtensions` and `overrideFieldExtensions` functions)
|
|
107
126
|
*
|
|
108
127
|
* @group forcedFieldExtensions
|
|
109
128
|
*/
|
|
110
129
|
renderFieldExtension: (fieldExtensionId: string, ctx: RenderFieldExtensionCtx) => void;
|
|
111
130
|
/**
|
|
112
|
-
* This function will be called when the plugin needs to render the
|
|
113
|
-
* for installing a field extension inside a particular field
|
|
131
|
+
* This function will be called when the plugin needs to render the
|
|
132
|
+
* configuration form for installing a field extension inside a particular field
|
|
114
133
|
*
|
|
115
134
|
* @group manualFieldExtensions
|
|
116
135
|
*/
|
|
117
136
|
renderManualFieldExtensionConfigScreen: (fieldExtensionId: string, ctx: RenderManualFieldExtensionConfigScreenCtx) => void;
|
|
118
137
|
/**
|
|
119
|
-
* This function will be called each time the configuration object changes. It
|
|
120
|
-
* return an object containing possible validation errors
|
|
138
|
+
* This function will be called each time the configuration object changes. It
|
|
139
|
+
* must return an object containing possible validation errors
|
|
121
140
|
*
|
|
122
141
|
* @group manualFieldExtensions
|
|
123
142
|
*/
|
package/dist/types/guards.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { InitMethods, OnBootMethods, RenderPageMethods, RenderFieldExtensionMethods, RenderConfigScreenMethods, RenderManualFieldExtensionConfigScreenMethods, RenderSidebarPanelMethods, RenderModalMethods } from './types';
|
|
1
|
+
import { InitMethods, OnBootMethods, RenderPageMethods, RenderFieldExtensionMethods, RenderConfigScreenMethods, RenderManualFieldExtensionConfigScreenMethods, RenderSidebarPanelMethods, RenderModalMethods, RenderAssetSourceMethods } from './types';
|
|
2
2
|
export declare type Parent = {
|
|
3
3
|
getSettings: () => Promise<{
|
|
4
4
|
mode: string;
|
|
@@ -28,3 +28,6 @@ export declare const isRenderFieldExtensionParent: (parent: Parent, settings: {
|
|
|
28
28
|
export declare const isRenderManualFieldExtensionConfigScreenParent: (parent: Parent, settings: {
|
|
29
29
|
mode: string;
|
|
30
30
|
}) => parent is RenderManualFieldExtensionConfigScreenMethods;
|
|
31
|
+
export declare const isRenderAssetSourceParent: (parent: Parent, settings: {
|
|
32
|
+
mode: string;
|
|
33
|
+
}) => parent is RenderAssetSourceMethods;
|