datocms-plugin-sdk 0.3.20 → 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/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 +125 -7
- package/dist/types/connect.d.ts +45 -26
- package/dist/types/guards.d.ts +4 -1
- package/dist/types/types.d.ts +125 -7
- package/package.json +2 -2
- package/types.json +2449 -1300
package/dist/cjs/connect.js
CHANGED
|
@@ -111,7 +111,7 @@ var buildRenderUtils = function (parent) {
|
|
|
111
111
|
function connect(configuration) {
|
|
112
112
|
if (configuration === void 0) { configuration = {}; }
|
|
113
113
|
return __awaiter(this, void 0, void 0, function () {
|
|
114
|
-
var mainNavigationTabs, settingsAreaSidebarItemGroups, contentAreaSidebarItems, manualFieldExtensions, itemFormSidebarPanels, listener, penpalConnection, parent, initialSettings, render, render, renderUtils_1, render, renderUtils_2, render, renderUtils_3, render, renderUtils_4, render, renderUtils_5, render;
|
|
114
|
+
var mainNavigationTabs, settingsAreaSidebarItemGroups, contentAreaSidebarItems, manualFieldExtensions, itemFormSidebarPanels, listener, penpalConnection, parent, initialSettings, render, render, renderUtils_1, render, renderUtils_2, render, renderUtils_3, render, renderUtils_4, render, renderUtils_5, render, renderUtils_6, render;
|
|
115
115
|
return __generator(this, function (_a) {
|
|
116
116
|
switch (_a.label) {
|
|
117
117
|
case 0:
|
|
@@ -194,35 +194,46 @@ function connect(configuration) {
|
|
|
194
194
|
listener = render;
|
|
195
195
|
render(initialSettings);
|
|
196
196
|
}
|
|
197
|
-
if ((0, guards_1.
|
|
197
|
+
if ((0, guards_1.isRenderAssetSourceParent)(parent, initialSettings)) {
|
|
198
198
|
renderUtils_3 = buildRenderUtils(parent);
|
|
199
|
+
render = function (settings) {
|
|
200
|
+
if (!configuration.renderAssetSource) {
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
203
|
+
configuration.renderAssetSource(settings.assetSourceId, __assign(__assign(__assign({}, parent), settings), renderUtils_3));
|
|
204
|
+
};
|
|
205
|
+
listener = render;
|
|
206
|
+
render(initialSettings);
|
|
207
|
+
}
|
|
208
|
+
if ((0, guards_1.isRenderSidebarPaneParent)(parent, initialSettings)) {
|
|
209
|
+
renderUtils_4 = buildRenderUtils(parent);
|
|
199
210
|
render = function (settings) {
|
|
200
211
|
if (!configuration.renderItemFormSidebarPanel) {
|
|
201
212
|
return;
|
|
202
213
|
}
|
|
203
|
-
configuration.renderItemFormSidebarPanel(settings.sidebarPaneId, __assign(__assign(__assign({}, parent), settings),
|
|
214
|
+
configuration.renderItemFormSidebarPanel(settings.sidebarPaneId, __assign(__assign(__assign({}, parent), settings), renderUtils_4));
|
|
204
215
|
};
|
|
205
216
|
listener = render;
|
|
206
217
|
render(initialSettings);
|
|
207
218
|
}
|
|
208
219
|
if ((0, guards_1.isRenderFieldExtensionParent)(parent, initialSettings)) {
|
|
209
|
-
|
|
220
|
+
renderUtils_5 = buildRenderUtils(parent);
|
|
210
221
|
render = function (settings) {
|
|
211
222
|
if (!configuration.renderFieldExtension) {
|
|
212
223
|
return;
|
|
213
224
|
}
|
|
214
|
-
configuration.renderFieldExtension(settings.fieldExtensionId, __assign(__assign(__assign({}, parent), settings),
|
|
225
|
+
configuration.renderFieldExtension(settings.fieldExtensionId, __assign(__assign(__assign({}, parent), settings), renderUtils_5));
|
|
215
226
|
};
|
|
216
227
|
listener = render;
|
|
217
228
|
render(initialSettings);
|
|
218
229
|
}
|
|
219
230
|
if ((0, guards_1.isRenderManualFieldExtensionConfigScreenParent)(parent, initialSettings)) {
|
|
220
|
-
|
|
231
|
+
renderUtils_6 = buildRenderUtils(parent);
|
|
221
232
|
render = function (settings) {
|
|
222
233
|
if (!configuration.renderManualFieldExtensionConfigScreen) {
|
|
223
234
|
return;
|
|
224
235
|
}
|
|
225
|
-
configuration.renderManualFieldExtensionConfigScreen(settings.fieldExtensionId, __assign(__assign(__assign({}, parent), settings),
|
|
236
|
+
configuration.renderManualFieldExtensionConfigScreen(settings.fieldExtensionId, __assign(__assign(__assign({}, parent), settings), renderUtils_6));
|
|
226
237
|
};
|
|
227
238
|
listener = render;
|
|
228
239
|
render(initialSettings);
|
package/dist/cjs/connect.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connect.js","sourceRoot":"","sources":["../../src/connect.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+EAAyD;
|
|
1
|
+
{"version":3,"file":"connect.js","sourceRoot":"","sources":["../../src/connect.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+EAAyD;AA4BzD,mCAWkB;AA6KlB,SAAS,YAAY,CACnB,EAA+D;IAE/D,OAAO,UACL,MAAe,EACf,GAA6B;QAE7B,IAAI,CAAC,EAAE,EAAE;YACP,OAAO,EAAE,CAAC;SACX;QAED,IAAM,MAAM,GAA2B,EAAE,CAAC;QAE1C,KAAoB,UAAM,EAAN,iBAAM,EAAN,oBAAM,EAAN,IAAM,EAAE;YAAvB,IAAM,KAAK,eAAA;YACd,IAAM,QAAQ,GAAG,GAAG,CAAC,SAAS,CAC5B,KAAK,CAAC,aAAa,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CACxB,CAAC;YAChB,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,wBAAO,GAAG,KAAE,QAAQ,UAAA,IAAG,CAAC;SACpD;QAED,OAAO,MAAM,CAAC;IAChB,CAAC,CAA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C,eAA2B,CAAC,CAAC;qBACrC;oBAED,IAAI,IAAA,qCAA4B,EAAC,MAAM,EAAE,eAAe,CAAC,EAAE;wBAGnD,gBAAc,gBAAgB,CAAC,MAAM,CAAC,CAAC;wBAEvC,MAAM,GAAG,UAAC,QAAkB;4BAChC,IAAI,CAAC,aAAa,CAAC,oBAAoB,EAAE;gCACvC,OAAO;6BACR;4BAED,aAAa,CAAC,oBAAoB,CAAC,QAAQ,CAAC,gBAAgB,iCACvD,MAAM,GACN,QAAQ,GACR,aAAW,EACd,CAAC;wBACL,CAAC,CAAC;wBAEF,QAAQ,GAAG,MAAM,CAAC;wBAClB,MAAM,CAAC,eAA2B,CAAC,CAAC;qBACrC;oBAED,IAAI,IAAA,uDAA8C,EAAC,MAAM,EAAE,eAAe,CAAC,EAAE;wBAKrE,gBAAc,gBAAgB,CAAC,MAAM,CAAC,CAAC;wBAEvC,MAAM,GAAG,UAAC,QAAkB;4BAChC,IAAI,CAAC,aAAa,CAAC,sCAAsC,EAAE;gCACzD,OAAO;6BACR;4BAED,aAAa,CAAC,sCAAsC,CAClD,QAAQ,CAAC,gBAAgB,iCAEpB,MAAM,GACN,QAAQ,GACR,aAAW,EAEjB,CAAC;wBACJ,CAAC,CAAC;wBAEF,QAAQ,GAAG,MAAM,CAAC;wBAClB,MAAM,CAAC,eAA2B,CAAC,CAAC;qBACrC;;;;;CACF;AA1ND,0BA0NC"}
|
package/dist/cjs/guards.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isRenderManualFieldExtensionConfigScreenParent = exports.isRenderFieldExtensionParent = exports.isRenderSidebarPaneParent = exports.isRenderModalParent = exports.isRenderConfigScreenParent = exports.isRenderPageParent = exports.isOnBootParent = exports.isInitParent = void 0;
|
|
3
|
+
exports.isRenderAssetSourceParent = exports.isRenderManualFieldExtensionConfigScreenParent = exports.isRenderFieldExtensionParent = exports.isRenderSidebarPaneParent = exports.isRenderModalParent = exports.isRenderConfigScreenParent = exports.isRenderPageParent = exports.isOnBootParent = exports.isInitParent = void 0;
|
|
4
4
|
function buildGuard(mode) {
|
|
5
5
|
return function (parent, settings) {
|
|
6
6
|
return settings.mode === mode;
|
|
@@ -14,4 +14,5 @@ exports.isRenderModalParent = buildGuard('renderModal');
|
|
|
14
14
|
exports.isRenderSidebarPaneParent = buildGuard('renderItemFormSidebarPanel');
|
|
15
15
|
exports.isRenderFieldExtensionParent = buildGuard('renderFieldExtension');
|
|
16
16
|
exports.isRenderManualFieldExtensionConfigScreenParent = buildGuard('renderManualFieldExtensionConfigScreen');
|
|
17
|
+
exports.isRenderAssetSourceParent = buildGuard('renderAssetSource');
|
|
17
18
|
//# sourceMappingURL=guards.js.map
|
package/dist/cjs/guards.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"guards.js","sourceRoot":"","sources":["../../src/guards.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"guards.js","sourceRoot":"","sources":["../../src/guards.ts"],"names":[],"mappings":";;;AAcA,SAAS,UAAU,CAAmB,IAAY;IAChD,OAAO,UAAC,MAAc,EAAE,QAA0B;QAChD,OAAA,QAAQ,CAAC,IAAI,KAAK,IAAI;IAAtB,CAAsB,CAAC;AAC3B,CAAC;AAEY,QAAA,YAAY,GAAG,UAAU,CAAc,MAAM,CAAC,CAAC;AAE/C,QAAA,cAAc,GAAG,UAAU,CAAgB,QAAQ,CAAC,CAAC;AAErD,QAAA,kBAAkB,GAAG,UAAU,CAAoB,YAAY,CAAC,CAAC;AAEjE,QAAA,0BAA0B,GAAG,UAAU,CAClD,oBAAoB,CACrB,CAAC;AAEW,QAAA,mBAAmB,GAAG,UAAU,CAC3C,aAAa,CACd,CAAC;AAEW,QAAA,yBAAyB,GAAG,UAAU,CACjD,4BAA4B,CAC7B,CAAC;AAEW,QAAA,4BAA4B,GAAG,UAAU,CACpD,sBAAsB,CACvB,CAAC;AAEW,QAAA,8CAA8C,GAAG,UAAU,CACtE,wCAAwC,CACzC,CAAC;AAEW,QAAA,yBAAyB,GAAG,UAAU,CACjD,mBAAmB,CACpB,CAAC"}
|
package/dist/esm/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/esm/connect.js
CHANGED
|
@@ -46,7 +46,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
46
46
|
}
|
|
47
47
|
};
|
|
48
48
|
import connectToParent from 'penpal/lib/connectToParent';
|
|
49
|
-
import { isInitParent, isOnBootParent, isRenderConfigScreenParent, isRenderFieldExtensionParent, isRenderManualFieldExtensionConfigScreenParent, isRenderModalParent, isRenderPageParent, isRenderSidebarPaneParent, } from './guards';
|
|
49
|
+
import { isInitParent, isOnBootParent, isRenderAssetSourceParent, isRenderConfigScreenParent, isRenderFieldExtensionParent, isRenderManualFieldExtensionConfigScreenParent, isRenderModalParent, isRenderPageParent, isRenderSidebarPaneParent, } from './guards';
|
|
50
50
|
function toMultifield(fn) {
|
|
51
51
|
return function (fields, ctx) {
|
|
52
52
|
if (!fn) {
|
|
@@ -105,7 +105,7 @@ var buildRenderUtils = function (parent) {
|
|
|
105
105
|
export function connect(configuration) {
|
|
106
106
|
if (configuration === void 0) { configuration = {}; }
|
|
107
107
|
return __awaiter(this, void 0, void 0, function () {
|
|
108
|
-
var mainNavigationTabs, settingsAreaSidebarItemGroups, contentAreaSidebarItems, manualFieldExtensions, itemFormSidebarPanels, listener, penpalConnection, parent, initialSettings, render, render, renderUtils_1, render, renderUtils_2, render, renderUtils_3, render, renderUtils_4, render, renderUtils_5, render;
|
|
108
|
+
var mainNavigationTabs, settingsAreaSidebarItemGroups, contentAreaSidebarItems, manualFieldExtensions, itemFormSidebarPanels, listener, penpalConnection, parent, initialSettings, render, render, renderUtils_1, render, renderUtils_2, render, renderUtils_3, render, renderUtils_4, render, renderUtils_5, render, renderUtils_6, render;
|
|
109
109
|
return __generator(this, function (_a) {
|
|
110
110
|
switch (_a.label) {
|
|
111
111
|
case 0:
|
|
@@ -188,35 +188,46 @@ export function connect(configuration) {
|
|
|
188
188
|
listener = render;
|
|
189
189
|
render(initialSettings);
|
|
190
190
|
}
|
|
191
|
-
if (
|
|
191
|
+
if (isRenderAssetSourceParent(parent, initialSettings)) {
|
|
192
192
|
renderUtils_3 = buildRenderUtils(parent);
|
|
193
|
+
render = function (settings) {
|
|
194
|
+
if (!configuration.renderAssetSource) {
|
|
195
|
+
return;
|
|
196
|
+
}
|
|
197
|
+
configuration.renderAssetSource(settings.assetSourceId, __assign(__assign(__assign({}, parent), settings), renderUtils_3));
|
|
198
|
+
};
|
|
199
|
+
listener = render;
|
|
200
|
+
render(initialSettings);
|
|
201
|
+
}
|
|
202
|
+
if (isRenderSidebarPaneParent(parent, initialSettings)) {
|
|
203
|
+
renderUtils_4 = buildRenderUtils(parent);
|
|
193
204
|
render = function (settings) {
|
|
194
205
|
if (!configuration.renderItemFormSidebarPanel) {
|
|
195
206
|
return;
|
|
196
207
|
}
|
|
197
|
-
configuration.renderItemFormSidebarPanel(settings.sidebarPaneId, __assign(__assign(__assign({}, parent), settings),
|
|
208
|
+
configuration.renderItemFormSidebarPanel(settings.sidebarPaneId, __assign(__assign(__assign({}, parent), settings), renderUtils_4));
|
|
198
209
|
};
|
|
199
210
|
listener = render;
|
|
200
211
|
render(initialSettings);
|
|
201
212
|
}
|
|
202
213
|
if (isRenderFieldExtensionParent(parent, initialSettings)) {
|
|
203
|
-
|
|
214
|
+
renderUtils_5 = buildRenderUtils(parent);
|
|
204
215
|
render = function (settings) {
|
|
205
216
|
if (!configuration.renderFieldExtension) {
|
|
206
217
|
return;
|
|
207
218
|
}
|
|
208
|
-
configuration.renderFieldExtension(settings.fieldExtensionId, __assign(__assign(__assign({}, parent), settings),
|
|
219
|
+
configuration.renderFieldExtension(settings.fieldExtensionId, __assign(__assign(__assign({}, parent), settings), renderUtils_5));
|
|
209
220
|
};
|
|
210
221
|
listener = render;
|
|
211
222
|
render(initialSettings);
|
|
212
223
|
}
|
|
213
224
|
if (isRenderManualFieldExtensionConfigScreenParent(parent, initialSettings)) {
|
|
214
|
-
|
|
225
|
+
renderUtils_6 = buildRenderUtils(parent);
|
|
215
226
|
render = function (settings) {
|
|
216
227
|
if (!configuration.renderManualFieldExtensionConfigScreen) {
|
|
217
228
|
return;
|
|
218
229
|
}
|
|
219
|
-
configuration.renderManualFieldExtensionConfigScreen(settings.fieldExtensionId, __assign(__assign(__assign({}, parent), settings),
|
|
230
|
+
configuration.renderManualFieldExtensionConfigScreen(settings.fieldExtensionId, __assign(__assign(__assign({}, parent), settings), renderUtils_6));
|
|
220
231
|
};
|
|
221
232
|
listener = render;
|
|
222
233
|
render(initialSettings);
|
package/dist/esm/connect.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connect.js","sourceRoot":"","sources":["../../src/connect.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,eAAe,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"connect.js","sourceRoot":"","sources":["../../src/connect.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,eAAe,MAAM,4BAA4B,CAAC;AA4BzD,OAAO,EACL,YAAY,EACZ,cAAc,EACd,yBAAyB,EACzB,0BAA0B,EAC1B,4BAA4B,EAC5B,8CAA8C,EAC9C,mBAAmB,EACnB,kBAAkB,EAClB,yBAAyB,GAE1B,MAAM,UAAU,CAAC;AA6KlB,SAAS,YAAY,CACnB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MAAM,CAAC;wBAClB,MAAM,CAAC,eAA2B,CAAC,CAAC;qBACrC;;;;;CACF"}
|
package/dist/esm/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;
|
package/dist/esm/guards.js
CHANGED
|
@@ -11,4 +11,5 @@ export var isRenderModalParent = buildGuard('renderModal');
|
|
|
11
11
|
export var isRenderSidebarPaneParent = buildGuard('renderItemFormSidebarPanel');
|
|
12
12
|
export var isRenderFieldExtensionParent = buildGuard('renderFieldExtension');
|
|
13
13
|
export var isRenderManualFieldExtensionConfigScreenParent = buildGuard('renderManualFieldExtensionConfigScreen');
|
|
14
|
+
export var isRenderAssetSourceParent = buildGuard('renderAssetSource');
|
|
14
15
|
//# sourceMappingURL=guards.js.map
|
package/dist/esm/guards.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"guards.js","sourceRoot":"","sources":["../../src/guards.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"guards.js","sourceRoot":"","sources":["../../src/guards.ts"],"names":[],"mappings":"AAcA,SAAS,UAAU,CAAmB,IAAY;IAChD,OAAO,UAAC,MAAc,EAAE,QAA0B;QAChD,OAAA,QAAQ,CAAC,IAAI,KAAK,IAAI;IAAtB,CAAsB,CAAC;AAC3B,CAAC;AAED,MAAM,CAAC,IAAM,YAAY,GAAG,UAAU,CAAc,MAAM,CAAC,CAAC;AAE5D,MAAM,CAAC,IAAM,cAAc,GAAG,UAAU,CAAgB,QAAQ,CAAC,CAAC;AAElE,MAAM,CAAC,IAAM,kBAAkB,GAAG,UAAU,CAAoB,YAAY,CAAC,CAAC;AAE9E,MAAM,CAAC,IAAM,0BAA0B,GAAG,UAAU,CAClD,oBAAoB,CACrB,CAAC;AAEF,MAAM,CAAC,IAAM,mBAAmB,GAAG,UAAU,CAC3C,aAAa,CACd,CAAC;AAEF,MAAM,CAAC,IAAM,yBAAyB,GAAG,UAAU,CACjD,4BAA4B,CAC7B,CAAC;AAEF,MAAM,CAAC,IAAM,4BAA4B,GAAG,UAAU,CACpD,sBAAsB,CACvB,CAAC;AAEF,MAAM,CAAC,IAAM,8CAA8C,GAAG,UAAU,CACtE,wCAAwC,CACzC,CAAC;AAEF,MAAM,CAAC,IAAM,yBAAyB,GAAG,UAAU,CACjD,mBAAmB,CACpB,CAAC"}
|
package/dist/esm/types.d.ts
CHANGED
|
@@ -1,10 +1,20 @@
|
|
|
1
|
-
import { Account, Field, Item, ModelBlock, Plugin, PluginAttributes, Role, Site, SsoUser, Upload, User } from './SiteApiSchema';
|
|
1
|
+
import { Account, Field, Item, ModelBlock, Plugin, PluginAttributes, Role, Site, SsoUser, Upload, UploadCreateSchema, User } from './SiteApiSchema';
|
|
2
|
+
export declare type Icon = string | {
|
|
3
|
+
type: 'svg';
|
|
4
|
+
viewBox: string;
|
|
5
|
+
content: string;
|
|
6
|
+
};
|
|
2
7
|
/** A tab to be displayed in the top-bar of the UI */
|
|
3
8
|
export declare type MainNavigationTab = {
|
|
4
9
|
/** Label to be shown. Must be unique. */
|
|
5
10
|
label: string;
|
|
6
|
-
/**
|
|
7
|
-
|
|
11
|
+
/**
|
|
12
|
+
* Icon to be shown alongside the label. Can be a FontAwesome icon name (ie.
|
|
13
|
+
* `"address-book"`) or a custom SVG definition. To maintain visual
|
|
14
|
+
* consistency with the rest of the interface, try to use FontAwesome icons
|
|
15
|
+
* whenever possible.
|
|
16
|
+
*/
|
|
17
|
+
icon: Icon;
|
|
8
18
|
/** ID of the page linked to the tab */
|
|
9
19
|
pointsTo: {
|
|
10
20
|
pageId: string;
|
|
@@ -30,8 +40,13 @@ export declare type MainNavigationTab = {
|
|
|
30
40
|
export declare type SettingsAreaSidebarItem = {
|
|
31
41
|
/** Label to be shown. Must be unique. */
|
|
32
42
|
label: string;
|
|
33
|
-
/**
|
|
34
|
-
|
|
43
|
+
/**
|
|
44
|
+
* Icon to be shown alongside the label. Can be a FontAwesome icon name (ie.
|
|
45
|
+
* `"address-book"`) or a custom SVG definition. To maintain visual
|
|
46
|
+
* consistency with the rest of the interface, try to use FontAwesome icons
|
|
47
|
+
* whenever possible.
|
|
48
|
+
*/
|
|
49
|
+
icon: Icon;
|
|
35
50
|
/** ID of the page linked to the item */
|
|
36
51
|
pointsTo: {
|
|
37
52
|
pageId: string;
|
|
@@ -72,8 +87,13 @@ export declare type SettingsAreaSidebarItemGroup = {
|
|
|
72
87
|
export declare type ContentAreaSidebarItem = {
|
|
73
88
|
/** Label to be shown. Must be unique. */
|
|
74
89
|
label: string;
|
|
75
|
-
/**
|
|
76
|
-
|
|
90
|
+
/**
|
|
91
|
+
* Icon to be shown alongside the label. Can be a FontAwesome icon name (ie.
|
|
92
|
+
* `"address-book"`) or a custom SVG definition. To maintain visual
|
|
93
|
+
* consistency with the rest of the interface, try to use FontAwesome icons
|
|
94
|
+
* whenever possible.
|
|
95
|
+
*/
|
|
96
|
+
icon: Icon;
|
|
77
97
|
/** ID of the page linked to the item */
|
|
78
98
|
pointsTo: {
|
|
79
99
|
pageId: string;
|
|
@@ -276,6 +296,28 @@ export declare type Modal = {
|
|
|
276
296
|
/** The initial height to set for the iframe that will render the modal content */
|
|
277
297
|
initialHeight?: number;
|
|
278
298
|
};
|
|
299
|
+
/** An additional asset source */
|
|
300
|
+
export declare type AssetSource = {
|
|
301
|
+
/**
|
|
302
|
+
* ID of the asset source. Will be the first argument for the
|
|
303
|
+
* `renderAssetSource` function
|
|
304
|
+
*/
|
|
305
|
+
id: string;
|
|
306
|
+
/** Name of the asset that will be shown to the user */
|
|
307
|
+
name: string;
|
|
308
|
+
/**
|
|
309
|
+
* Icon to be shown alongside the name. Can be a FontAwesome icon name (ie.
|
|
310
|
+
* `"address-book"`) or a custom SVG definition. To maintain visual
|
|
311
|
+
* consistency with the rest of the interface, try to use FontAwesome icons
|
|
312
|
+
* whenever possible.
|
|
313
|
+
*/
|
|
314
|
+
icon: Icon;
|
|
315
|
+
/**
|
|
316
|
+
* Configuration options for the modal that will be opened to select a media
|
|
317
|
+
* file from this source
|
|
318
|
+
*/
|
|
319
|
+
modal: Pick<Modal, 'width' | 'initialHeight'>;
|
|
320
|
+
};
|
|
279
321
|
/** A toast notification to present to the user */
|
|
280
322
|
export declare type Toast<CtaValue = unknown> = {
|
|
281
323
|
/** Message of the notification */
|
|
@@ -1027,6 +1069,82 @@ export declare type RenderModalAdditionalMethods = {
|
|
|
1027
1069
|
};
|
|
1028
1070
|
export declare type RenderModalMethods = RenderMethods & IframeMethods & RenderModalAdditionalMethods;
|
|
1029
1071
|
export declare type RenderModalPropertiesAndMethods = RenderModalMethods & RenderModalProperties;
|
|
1072
|
+
/** Information regarding the specific asset source browser that you need to render */
|
|
1073
|
+
export declare type RenderAssetSourceAdditionalProperties = {
|
|
1074
|
+
mode: 'renderAssetSource';
|
|
1075
|
+
/** The ID of the assetSource that needs to be rendered */
|
|
1076
|
+
assetSourceId: string;
|
|
1077
|
+
};
|
|
1078
|
+
export declare type RenderAssetSourceProperties = RenderProperties & RenderAssetSourceAdditionalProperties;
|
|
1079
|
+
export declare type NewUploadResourceAsUrl = {
|
|
1080
|
+
/**
|
|
1081
|
+
* URL for the resource. The URL must respond with a
|
|
1082
|
+
* `Access-Control-Allow-Origin` header — for instance `*`, which will allow
|
|
1083
|
+
* all hosts — allowing the image to be read by DatoCMS
|
|
1084
|
+
*/
|
|
1085
|
+
url: string;
|
|
1086
|
+
/**
|
|
1087
|
+
* Optional filename to be used to generate the final DatoCMS URL. If not
|
|
1088
|
+
* passed, the URL will be used
|
|
1089
|
+
*/
|
|
1090
|
+
filename?: string;
|
|
1091
|
+
};
|
|
1092
|
+
export declare type NewUploadResourceAsBase64 = {
|
|
1093
|
+
/**
|
|
1094
|
+
* Base64 encoded data URI for the resource.
|
|
1095
|
+
*
|
|
1096
|
+
* Format:
|
|
1097
|
+
*
|
|
1098
|
+
* `data:[<mime type>][;charset=<charset>];base64,<encoded data>`
|
|
1099
|
+
*/
|
|
1100
|
+
base64: string;
|
|
1101
|
+
/** Filename to be used to generate the final DatoCMS URL */
|
|
1102
|
+
filename: string;
|
|
1103
|
+
};
|
|
1104
|
+
export declare type NewUpload = {
|
|
1105
|
+
/** The actual resource that will be uploaded */
|
|
1106
|
+
resource: NewUploadResourceAsUrl | NewUploadResourceAsBase64;
|
|
1107
|
+
/** Copyright to apply to the asset */
|
|
1108
|
+
copyright?: string;
|
|
1109
|
+
/** Author to apply to the asset */
|
|
1110
|
+
author?: string;
|
|
1111
|
+
/** Notes to apply to the asset */
|
|
1112
|
+
notes?: string;
|
|
1113
|
+
/** Tags to apply to the asset */
|
|
1114
|
+
tags?: string[];
|
|
1115
|
+
/**
|
|
1116
|
+
* An hash containing, for each locale of the project, the default metadata to
|
|
1117
|
+
* apply to the asset
|
|
1118
|
+
*/
|
|
1119
|
+
defaultFieldMetadata?: NonNullable<Record<string, UploadCreateSchema['data']['attributes']['default_field_metadata']>>;
|
|
1120
|
+
};
|
|
1121
|
+
/** Use these methods to confirm */
|
|
1122
|
+
export declare type RenderAssetSourceAdditionalMethods = {
|
|
1123
|
+
getSettings: () => Promise<RenderAssetSourceProperties>;
|
|
1124
|
+
/**
|
|
1125
|
+
* Function to be called when the user selects the asset: it will trigger the
|
|
1126
|
+
* creation of a new `Upload` that will be added in the Media Area.
|
|
1127
|
+
*
|
|
1128
|
+
* @example
|
|
1129
|
+
*
|
|
1130
|
+
* ```js
|
|
1131
|
+
* await ctx.select({
|
|
1132
|
+
* resource: {
|
|
1133
|
+
* url:
|
|
1134
|
+
* 'https://images.unsplash.com/photo-1416339306562-f3d12fefd36f',
|
|
1135
|
+
* filename: 'man-drinking-coffee.jpg',
|
|
1136
|
+
* },
|
|
1137
|
+
* copyright: 'Royalty free (Unsplash)',
|
|
1138
|
+
* author: 'Jeff Sheldon',
|
|
1139
|
+
* notes: 'A man drinking a coffee',
|
|
1140
|
+
* tags: ['man', 'coffee'],
|
|
1141
|
+
* });
|
|
1142
|
+
* ```
|
|
1143
|
+
*/
|
|
1144
|
+
select: (newUpload: NewUpload) => Promise<void>;
|
|
1145
|
+
};
|
|
1146
|
+
export declare type RenderAssetSourceMethods = RenderMethods & IframeMethods & RenderAssetSourceAdditionalMethods;
|
|
1147
|
+
export declare type RenderAssetSourcePropertiesAndMethods = RenderAssetSourceMethods & RenderAssetSourceProperties;
|
|
1030
1148
|
/** Information regarding the specific page that you need to render */
|
|
1031
1149
|
export declare type RenderPageAdditionalProperties = {
|
|
1032
1150
|
mode: 'renderPage';
|