datocms-plugin-sdk 0.2.0-alpha.65

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.
@@ -0,0 +1,126 @@
1
+ import { Field, ModelBlock } from './SiteApiSchema';
2
+ import { ContentAreaSidebarItem, FieldExtensionOverride, InitPropertiesAndMethods, ItemFormSidebarPanel, MainNavigationTab, ManualFieldExtension, OnBootPropertiesAndMethods, RenderConfigScreenPropertiesAndMethods, RenderFieldExtensionPropertiesAndMethods, RenderManualFieldExtensionConfigScreenPropertiesAndMethods, RenderModalPropertiesAndMethods, RenderPagePropertiesAndMethods, RenderSidebarPanePropertiesAndMethods, SettingsAreaSidebarItemGroup } from './types';
3
+ export declare type SizingUtilities = {
4
+ /** Listens for DOM changes and automatically calls `setHeight` when it detects a change */
5
+ startAutoResizer: () => void;
6
+ /** Stops resizing the iframe automatically */
7
+ stopAutoResizer: () => void;
8
+ /**
9
+ * Triggers a change in the size of the iframe. If you don't explicitely pass
10
+ * a `newHeight` it will be automatically calculated using the iframe content
11
+ * at the moment
12
+ */
13
+ updateHeight: (newHeight?: number) => void;
14
+ };
15
+ export type { Field, ModelBlock };
16
+ export declare type IntentCtx = InitPropertiesAndMethods;
17
+ export declare type OnBootCtx = OnBootPropertiesAndMethods;
18
+ export declare type FieldIntentCtx = InitPropertiesAndMethods & {
19
+ itemType: ModelBlock;
20
+ };
21
+ export declare type RenderPageCtx = RenderPagePropertiesAndMethods;
22
+ export declare type RenderModalCtx = RenderModalPropertiesAndMethods & SizingUtilities;
23
+ export declare type RenderItemFormSidebarPanelCtx = RenderSidebarPanePropertiesAndMethods & SizingUtilities;
24
+ export declare type RenderFieldExtensionCtx = RenderFieldExtensionPropertiesAndMethods & SizingUtilities;
25
+ export declare type RenderManualFieldExtensionConfigScreenCtx = RenderManualFieldExtensionConfigScreenPropertiesAndMethods & SizingUtilities;
26
+ export declare type RenderConfigScreenCtx = RenderConfigScreenPropertiesAndMethods & SizingUtilities;
27
+ /** The full options you can pass to the `connect` function */
28
+ export declare type FullConnectParameters = {
29
+ /**
30
+ * This function will be called once at boot time and can be used to perform
31
+ * ie. some initial integrity checks on the configuration.
32
+ *
33
+ * @group boot
34
+ */
35
+ onBoot: (ctx: OnBootCtx) => void;
36
+ /**
37
+ * Use this function to declare new tabs you want to add in the top-bar of the UI
38
+ *
39
+ * @group pages
40
+ */
41
+ mainNavigationTabs: (ctx: IntentCtx) => MainNavigationTab[];
42
+ /**
43
+ * Use this function to declare new navigation sections in the Settings Area sidebar
44
+ *
45
+ * @group pages
46
+ */
47
+ settingsAreaSidebarItemGroups: (ctx: IntentCtx) => SettingsAreaSidebarItemGroup[];
48
+ /**
49
+ * Use this function to declare new navigation items in the Content Area sidebar
50
+ *
51
+ * @group pages
52
+ */
53
+ contentAreaSidebarItems: (ctx: IntentCtx) => ContentAreaSidebarItem[];
54
+ /**
55
+ * Use this function to declare new field extensions that users will be able
56
+ * to install manually in some field
57
+ *
58
+ * @group manualFieldExtensions
59
+ */
60
+ manualFieldExtensions: (ctx: IntentCtx) => ManualFieldExtension[];
61
+ /**
62
+ * Use this function to declare new sidebar panels to be shown when the user
63
+ * edits records of a particular model
64
+ *
65
+ * @group sidebarPanels
66
+ */
67
+ itemFormSidebarPanels: (itemType: ModelBlock, ctx: IntentCtx) => ItemFormSidebarPanel[];
68
+ /**
69
+ * Use this function to automatically force one or more field extensions to a
70
+ * particular field
71
+ *
72
+ * @group forcedFieldExtensions
73
+ */
74
+ overrideFieldExtensions: (field: Field, ctx: FieldIntentCtx) => FieldExtensionOverride | void;
75
+ /**
76
+ * This function will be called when the plugin needs to render the plugin's
77
+ * configuration form
78
+ *
79
+ * @group configScreen
80
+ */
81
+ renderConfigScreen: (ctx: RenderConfigScreenCtx) => void;
82
+ /**
83
+ * This function will be called when the plugin needs to render a specific
84
+ * page (see the `mainNavigationTabs`, `settingsAreaSidebarItemGroups` and
85
+ * `contentAreaSidebarItems` functions)
86
+ *
87
+ * @group pages
88
+ */
89
+ renderPage: (pageId: string, ctx: RenderPageCtx) => void;
90
+ /**
91
+ * This function will be called when the plugin requested to open a modal (see
92
+ * the `openModal` function)
93
+ *
94
+ * @group modals
95
+ */
96
+ renderModal: (modalId: string, ctx: RenderModalCtx) => void;
97
+ /**
98
+ * This function will be called when the plugin needs to render a sidebar
99
+ * panel (see the `itemFormSidebarPanels` function)
100
+ *
101
+ * @group sidebarPanels
102
+ */
103
+ renderItemFormSidebarPanel: (sidebarPaneId: string, ctx: RenderItemFormSidebarPanelCtx) => void;
104
+ /**
105
+ * This function will be called when the plugin needs to render a field
106
+ * extension (see the `manualFieldExtensions` and `overrideFieldExtensions` functions)
107
+ *
108
+ * @group forcedFieldExtensions
109
+ */
110
+ renderFieldExtension: (fieldExtensionId: string, ctx: RenderFieldExtensionCtx) => void;
111
+ /**
112
+ * This function will be called when the plugin needs to render the
113
+ * configuration form for installing a field extension inside a particular field
114
+ *
115
+ * @group manualFieldExtensions
116
+ */
117
+ renderManualFieldExtensionConfigScreen: (fieldExtensionId: string, ctx: RenderManualFieldExtensionConfigScreenCtx) => void;
118
+ /**
119
+ * This function will be called each time the configuration object changes. It
120
+ * must return an object containing possible validation errors
121
+ *
122
+ * @group manualFieldExtensions
123
+ */
124
+ validateManualFieldExtensionParameters: (fieldExtensionId: string, parameters: Record<string, unknown>) => Record<string, unknown> | Promise<Record<string, unknown>>;
125
+ };
126
+ export declare function connect(configuration?: Partial<FullConnectParameters>): Promise<void>;
@@ -0,0 +1,30 @@
1
+ import { InitMethods, OnBootMethods, RenderPageMethods, RenderFieldExtensionMethods, RenderConfigScreenMethods, RenderManualFieldExtensionConfigScreenMethods, RenderSidebarPanelMethods, RenderModalMethods } from './types';
2
+ export declare type Parent = {
3
+ getSettings: () => Promise<{
4
+ mode: string;
5
+ }>;
6
+ };
7
+ export declare const isInitParent: (parent: Parent, settings: {
8
+ mode: string;
9
+ }) => parent is InitMethods;
10
+ export declare const isOnBootParent: (parent: Parent, settings: {
11
+ mode: string;
12
+ }) => parent is OnBootMethods;
13
+ export declare const isRenderPageParent: (parent: Parent, settings: {
14
+ mode: string;
15
+ }) => parent is RenderPageMethods;
16
+ export declare const isRenderConfigScreenParent: (parent: Parent, settings: {
17
+ mode: string;
18
+ }) => parent is RenderConfigScreenMethods;
19
+ export declare const isRenderModalParent: (parent: Parent, settings: {
20
+ mode: string;
21
+ }) => parent is RenderModalMethods;
22
+ export declare const isRenderSidebarPaneParent: (parent: Parent, settings: {
23
+ mode: string;
24
+ }) => parent is RenderSidebarPanelMethods;
25
+ export declare const isRenderFieldExtensionParent: (parent: Parent, settings: {
26
+ mode: string;
27
+ }) => parent is RenderFieldExtensionMethods;
28
+ export declare const isRenderManualFieldExtensionConfigScreenParent: (parent: Parent, settings: {
29
+ mode: string;
30
+ }) => parent is RenderManualFieldExtensionConfigScreenMethods;
@@ -0,0 +1,4 @@
1
+ import { Account, Field, Item, ModelBlock, Plugin, Site, SsoUser, Upload, User, Role } from './SiteApiSchema';
2
+ export type { Account, Field, Item, ModelBlock, Plugin, Site, SsoUser, Upload, User, Role, };
3
+ export * from './connect';
4
+ export * from './types';