datocms-plugin-sdk 2.0.4 → 2.0.6
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/guardUtils.js +33 -0
- package/dist/cjs/guardUtils.js.map +1 -0
- package/dist/cjs/hooks/assetSources.js +24 -0
- package/dist/cjs/hooks/assetSources.js.map +1 -1
- package/dist/cjs/hooks/buildItemPresentationInfo.js +12 -0
- package/dist/cjs/hooks/buildItemPresentationInfo.js.map +1 -1
- package/dist/cjs/hooks/contentAreaSidebarItems.js +16 -0
- package/dist/cjs/hooks/contentAreaSidebarItems.js.map +1 -1
- package/dist/cjs/hooks/customBlockStylesForStructuredTextField.js +13 -0
- package/dist/cjs/hooks/customBlockStylesForStructuredTextField.js.map +1 -1
- package/dist/cjs/hooks/customMarksForStructuredTextField.js +17 -0
- package/dist/cjs/hooks/customMarksForStructuredTextField.js.map +1 -1
- package/dist/cjs/hooks/initialLocationQueryForItemSelector.js +11 -0
- package/dist/cjs/hooks/initialLocationQueryForItemSelector.js.map +1 -1
- package/dist/cjs/hooks/itemCollectionOutlets.js +12 -0
- package/dist/cjs/hooks/itemCollectionOutlets.js.map +1 -1
- package/dist/cjs/hooks/itemFormOutlets.js +12 -0
- package/dist/cjs/hooks/itemFormOutlets.js.map +1 -1
- package/dist/cjs/hooks/itemFormSidebarPanels.js +16 -0
- package/dist/cjs/hooks/itemFormSidebarPanels.js.map +1 -1
- package/dist/cjs/hooks/itemFormSidebars.js +14 -0
- package/dist/cjs/hooks/itemFormSidebars.js.map +1 -1
- package/dist/cjs/hooks/mainNavigationTabs.js +16 -0
- package/dist/cjs/hooks/mainNavigationTabs.js.map +1 -1
- package/dist/cjs/hooks/manualFieldExtensions.js +24 -0
- package/dist/cjs/hooks/manualFieldExtensions.js.map +1 -1
- package/dist/cjs/hooks/overrideFieldExtensions.js +35 -0
- package/dist/cjs/hooks/overrideFieldExtensions.js.map +1 -1
- package/dist/cjs/hooks/uploadSidebarPanels.js +16 -0
- package/dist/cjs/hooks/uploadSidebarPanels.js.map +1 -1
- package/dist/cjs/hooks/uploadSidebars.js +14 -0
- package/dist/cjs/hooks/uploadSidebars.js.map +1 -1
- package/dist/cjs/hooks/validateManualFieldExtensionParameters.js +5 -0
- package/dist/cjs/hooks/validateManualFieldExtensionParameters.js.map +1 -1
- package/dist/cjs/icon.js +9 -0
- package/dist/cjs/icon.js.map +1 -1
- package/dist/cjs/manifest.js +18 -18
- package/dist/cjs/manifest.js.map +1 -1
- package/dist/cjs/shared.js +31 -0
- package/dist/cjs/shared.js.map +1 -1
- package/dist/esm/guardUtils.d.ts +7 -0
- package/dist/esm/guardUtils.js +24 -0
- package/dist/esm/guardUtils.js.map +1 -0
- package/dist/esm/hooks/assetSources.d.ts +7 -1
- package/dist/esm/hooks/assetSources.js +22 -1
- package/dist/esm/hooks/assetSources.js.map +1 -1
- package/dist/esm/hooks/buildItemPresentationInfo.d.ts +7 -0
- package/dist/esm/hooks/buildItemPresentationInfo.js +10 -1
- package/dist/esm/hooks/buildItemPresentationInfo.js.map +1 -1
- package/dist/esm/hooks/contentAreaSidebarItems.d.ts +7 -0
- package/dist/esm/hooks/contentAreaSidebarItems.js +14 -1
- package/dist/esm/hooks/contentAreaSidebarItems.js.map +1 -1
- package/dist/esm/hooks/customBlockStylesForStructuredTextField.d.ts +7 -1
- package/dist/esm/hooks/customBlockStylesForStructuredTextField.js +11 -1
- package/dist/esm/hooks/customBlockStylesForStructuredTextField.js.map +1 -1
- package/dist/esm/hooks/customMarksForStructuredTextField.d.ts +7 -1
- package/dist/esm/hooks/customMarksForStructuredTextField.js +15 -1
- package/dist/esm/hooks/customMarksForStructuredTextField.js.map +1 -1
- package/dist/esm/hooks/initialLocationQueryForItemSelector.d.ts +7 -0
- package/dist/esm/hooks/initialLocationQueryForItemSelector.js +9 -1
- package/dist/esm/hooks/initialLocationQueryForItemSelector.js.map +1 -1
- package/dist/esm/hooks/itemCollectionOutlets.d.ts +7 -1
- package/dist/esm/hooks/itemCollectionOutlets.js +10 -1
- package/dist/esm/hooks/itemCollectionOutlets.js.map +1 -1
- package/dist/esm/hooks/itemFormOutlets.d.ts +7 -0
- package/dist/esm/hooks/itemFormOutlets.js +10 -1
- package/dist/esm/hooks/itemFormOutlets.js.map +1 -1
- package/dist/esm/hooks/itemFormSidebarPanels.d.ts +8 -0
- package/dist/esm/hooks/itemFormSidebarPanels.js +14 -1
- package/dist/esm/hooks/itemFormSidebarPanels.js.map +1 -1
- package/dist/esm/hooks/itemFormSidebars.d.ts +8 -0
- package/dist/esm/hooks/itemFormSidebars.js +12 -1
- package/dist/esm/hooks/itemFormSidebars.js.map +1 -1
- package/dist/esm/hooks/mainNavigationTabs.d.ts +7 -1
- package/dist/esm/hooks/mainNavigationTabs.js +14 -1
- package/dist/esm/hooks/mainNavigationTabs.js.map +1 -1
- package/dist/esm/hooks/manualFieldExtensions.d.ts +8 -0
- package/dist/esm/hooks/manualFieldExtensions.js +22 -1
- package/dist/esm/hooks/manualFieldExtensions.js.map +1 -1
- package/dist/esm/hooks/overrideFieldExtensions.d.ts +6 -0
- package/dist/esm/hooks/overrideFieldExtensions.js +31 -1
- package/dist/esm/hooks/overrideFieldExtensions.js.map +1 -1
- package/dist/esm/hooks/uploadSidebarPanels.d.ts +8 -0
- package/dist/esm/hooks/uploadSidebarPanels.js +14 -1
- package/dist/esm/hooks/uploadSidebarPanels.js.map +1 -1
- package/dist/esm/hooks/uploadSidebars.d.ts +8 -0
- package/dist/esm/hooks/uploadSidebars.js +12 -1
- package/dist/esm/hooks/uploadSidebars.js.map +1 -1
- package/dist/esm/hooks/validateManualFieldExtensionParameters.d.ts +1 -0
- package/dist/esm/hooks/validateManualFieldExtensionParameters.js +4 -1
- package/dist/esm/hooks/validateManualFieldExtensionParameters.js.map +1 -1
- package/dist/esm/icon.d.ts +1 -0
- package/dist/esm/icon.js +8 -1
- package/dist/esm/icon.js.map +1 -1
- package/dist/esm/manifest.js +18 -18
- package/dist/esm/manifest.js.map +1 -1
- package/dist/esm/shared.d.ts +13 -0
- package/dist/esm/shared.js +28 -1
- package/dist/esm/shared.js.map +1 -1
- package/dist/types/guardUtils.d.ts +7 -0
- package/dist/types/hooks/assetSources.d.ts +7 -1
- package/dist/types/hooks/buildItemPresentationInfo.d.ts +7 -0
- package/dist/types/hooks/contentAreaSidebarItems.d.ts +7 -0
- package/dist/types/hooks/customBlockStylesForStructuredTextField.d.ts +7 -1
- package/dist/types/hooks/customMarksForStructuredTextField.d.ts +7 -1
- package/dist/types/hooks/initialLocationQueryForItemSelector.d.ts +7 -0
- package/dist/types/hooks/itemCollectionOutlets.d.ts +7 -1
- package/dist/types/hooks/itemFormOutlets.d.ts +7 -0
- package/dist/types/hooks/itemFormSidebarPanels.d.ts +8 -0
- package/dist/types/hooks/itemFormSidebars.d.ts +8 -0
- package/dist/types/hooks/mainNavigationTabs.d.ts +7 -1
- package/dist/types/hooks/manualFieldExtensions.d.ts +8 -0
- package/dist/types/hooks/overrideFieldExtensions.d.ts +6 -0
- package/dist/types/hooks/uploadSidebarPanels.d.ts +8 -0
- package/dist/types/hooks/uploadSidebars.d.ts +8 -0
- package/dist/types/hooks/validateManualFieldExtensionParameters.d.ts +1 -0
- package/dist/types/icon.d.ts +1 -0
- package/dist/types/shared.d.ts +13 -0
- package/manifest.json +18 -18
- package/package.json +2 -2
- package/src/guardUtils.ts +34 -0
- package/src/hooks/assetSources.ts +39 -2
- package/src/hooks/buildItemPresentationInfo.ts +23 -0
- package/src/hooks/contentAreaSidebarItems.ts +34 -1
- package/src/hooks/customBlockStylesForStructuredTextField.ts +30 -1
- package/src/hooks/customMarksForStructuredTextField.ts +35 -2
- package/src/hooks/initialLocationQueryForItemSelector.ts +22 -1
- package/src/hooks/itemCollectionOutlets.ts +29 -1
- package/src/hooks/itemFormOutlets.ts +27 -0
- package/src/hooks/itemFormSidebarPanels.ts +36 -0
- package/src/hooks/itemFormSidebars.ts +30 -0
- package/src/hooks/mainNavigationTabs.ts +34 -2
- package/src/hooks/manualFieldExtensions.ts +43 -0
- package/src/hooks/overrideFieldExtensions.ts +55 -0
- package/src/hooks/uploadSidebarPanels.ts +36 -0
- package/src/hooks/uploadSidebars.ts +30 -0
- package/src/hooks/validateManualFieldExtensionParameters.ts +8 -0
- package/src/icon.ts +12 -0
- package/src/manifest.ts +18 -18
- package/src/shared.ts +58 -1
package/src/manifest.ts
CHANGED
|
@@ -22,7 +22,7 @@ export const manifest: Manifest = {
|
|
|
22
22
|
returnType: 'Record<string, unknown> | Promise<Record<string, unknown>>',
|
|
23
23
|
location: {
|
|
24
24
|
filePath: 'src/hooks/validateManualFieldExtensionParameters.ts',
|
|
25
|
-
lineNumber:
|
|
25
|
+
lineNumber: 10,
|
|
26
26
|
},
|
|
27
27
|
},
|
|
28
28
|
uploadsDropdownActions: {
|
|
@@ -60,7 +60,7 @@ export const manifest: Manifest = {
|
|
|
60
60
|
returnType: 'UploadSidebar[]',
|
|
61
61
|
location: {
|
|
62
62
|
filePath: 'src/hooks/uploadSidebars.ts',
|
|
63
|
-
lineNumber:
|
|
63
|
+
lineNumber: 17,
|
|
64
64
|
},
|
|
65
65
|
},
|
|
66
66
|
uploadSidebarPanels: {
|
|
@@ -79,7 +79,7 @@ export const manifest: Manifest = {
|
|
|
79
79
|
returnType: 'UploadSidebarPanel[]',
|
|
80
80
|
location: {
|
|
81
81
|
filePath: 'src/hooks/uploadSidebarPanels.ts',
|
|
82
|
-
lineNumber:
|
|
82
|
+
lineNumber: 19,
|
|
83
83
|
},
|
|
84
84
|
},
|
|
85
85
|
settingsAreaSidebarItemGroups: {
|
|
@@ -1601,7 +1601,7 @@ export const manifest: Manifest = {
|
|
|
1601
1601
|
itemType: {
|
|
1602
1602
|
location: {
|
|
1603
1603
|
filePath: 'src/hooks/overrideFieldExtensions.ts',
|
|
1604
|
-
lineNumber:
|
|
1604
|
+
lineNumber: 31,
|
|
1605
1605
|
},
|
|
1606
1606
|
type: 'ItemType',
|
|
1607
1607
|
},
|
|
@@ -1613,7 +1613,7 @@ export const manifest: Manifest = {
|
|
|
1613
1613
|
returnType: 'FieldExtensionOverride | undefined',
|
|
1614
1614
|
location: {
|
|
1615
1615
|
filePath: 'src/hooks/overrideFieldExtensions.ts',
|
|
1616
|
-
lineNumber:
|
|
1616
|
+
lineNumber: 24,
|
|
1617
1617
|
},
|
|
1618
1618
|
},
|
|
1619
1619
|
onBoot: {
|
|
@@ -1747,7 +1747,7 @@ export const manifest: Manifest = {
|
|
|
1747
1747
|
returnType: 'ManualFieldExtension[]',
|
|
1748
1748
|
location: {
|
|
1749
1749
|
filePath: 'src/hooks/manualFieldExtensions.ts',
|
|
1750
|
-
lineNumber:
|
|
1750
|
+
lineNumber: 18,
|
|
1751
1751
|
},
|
|
1752
1752
|
},
|
|
1753
1753
|
mainNavigationTabs: {
|
|
@@ -1766,7 +1766,7 @@ export const manifest: Manifest = {
|
|
|
1766
1766
|
returnType: 'MainNavigationTab[]',
|
|
1767
1767
|
location: {
|
|
1768
1768
|
filePath: 'src/hooks/mainNavigationTabs.ts',
|
|
1769
|
-
lineNumber:
|
|
1769
|
+
lineNumber: 19,
|
|
1770
1770
|
},
|
|
1771
1771
|
},
|
|
1772
1772
|
itemsDropdownActions: {
|
|
@@ -1826,7 +1826,7 @@ export const manifest: Manifest = {
|
|
|
1826
1826
|
returnType: 'ItemFormSidebar[]',
|
|
1827
1827
|
location: {
|
|
1828
1828
|
filePath: 'src/hooks/itemFormSidebars.ts',
|
|
1829
|
-
lineNumber:
|
|
1829
|
+
lineNumber: 20,
|
|
1830
1830
|
},
|
|
1831
1831
|
},
|
|
1832
1832
|
itemFormSidebarPanels: {
|
|
@@ -1850,7 +1850,7 @@ export const manifest: Manifest = {
|
|
|
1850
1850
|
returnType: 'ItemFormSidebarPanel[]',
|
|
1851
1851
|
location: {
|
|
1852
1852
|
filePath: 'src/hooks/itemFormSidebarPanels.ts',
|
|
1853
|
-
lineNumber:
|
|
1853
|
+
lineNumber: 23,
|
|
1854
1854
|
},
|
|
1855
1855
|
},
|
|
1856
1856
|
itemFormOutlets: {
|
|
@@ -1874,7 +1874,7 @@ export const manifest: Manifest = {
|
|
|
1874
1874
|
returnType: 'ItemFormOutlet[]',
|
|
1875
1875
|
location: {
|
|
1876
1876
|
filePath: 'src/hooks/itemFormOutlets.ts',
|
|
1877
|
-
lineNumber:
|
|
1877
|
+
lineNumber: 20,
|
|
1878
1878
|
},
|
|
1879
1879
|
},
|
|
1880
1880
|
itemFormDropdownActions: {
|
|
@@ -2017,7 +2017,7 @@ export const manifest: Manifest = {
|
|
|
2017
2017
|
returnType: 'ItemCollectionOutlet[]',
|
|
2018
2018
|
location: {
|
|
2019
2019
|
filePath: 'src/hooks/itemCollectionOutlets.ts',
|
|
2020
|
-
lineNumber:
|
|
2020
|
+
lineNumber: 20,
|
|
2021
2021
|
},
|
|
2022
2022
|
},
|
|
2023
2023
|
initialLocationQueryForItemSelector: {
|
|
@@ -2851,7 +2851,7 @@ export const manifest: Manifest = {
|
|
|
2851
2851
|
itemType: {
|
|
2852
2852
|
location: {
|
|
2853
2853
|
filePath: 'src/hooks/customMarksForStructuredTextField.ts',
|
|
2854
|
-
lineNumber:
|
|
2854
|
+
lineNumber: 30,
|
|
2855
2855
|
},
|
|
2856
2856
|
type: 'ItemType',
|
|
2857
2857
|
},
|
|
@@ -2863,7 +2863,7 @@ export const manifest: Manifest = {
|
|
|
2863
2863
|
returnType: 'StructuredTextCustomMark[] | undefined',
|
|
2864
2864
|
location: {
|
|
2865
2865
|
filePath: 'src/hooks/customMarksForStructuredTextField.ts',
|
|
2866
|
-
lineNumber:
|
|
2866
|
+
lineNumber: 23,
|
|
2867
2867
|
},
|
|
2868
2868
|
},
|
|
2869
2869
|
customBlockStylesForStructuredTextField: {
|
|
@@ -2888,7 +2888,7 @@ export const manifest: Manifest = {
|
|
|
2888
2888
|
location: {
|
|
2889
2889
|
filePath:
|
|
2890
2890
|
'src/hooks/customBlockStylesForStructuredTextField.ts',
|
|
2891
|
-
lineNumber:
|
|
2891
|
+
lineNumber: 29,
|
|
2892
2892
|
},
|
|
2893
2893
|
type: 'ItemType',
|
|
2894
2894
|
},
|
|
@@ -2900,7 +2900,7 @@ export const manifest: Manifest = {
|
|
|
2900
2900
|
returnType: 'StructuredTextCustomBlockStyle[] | undefined',
|
|
2901
2901
|
location: {
|
|
2902
2902
|
filePath: 'src/hooks/customBlockStylesForStructuredTextField.ts',
|
|
2903
|
-
lineNumber:
|
|
2903
|
+
lineNumber: 22,
|
|
2904
2904
|
},
|
|
2905
2905
|
},
|
|
2906
2906
|
contentAreaSidebarItems: {
|
|
@@ -2919,7 +2919,7 @@ export const manifest: Manifest = {
|
|
|
2919
2919
|
returnType: 'ContentAreaSidebarItem[]',
|
|
2920
2920
|
location: {
|
|
2921
2921
|
filePath: 'src/hooks/contentAreaSidebarItems.ts',
|
|
2922
|
-
lineNumber:
|
|
2922
|
+
lineNumber: 18,
|
|
2923
2923
|
},
|
|
2924
2924
|
},
|
|
2925
2925
|
buildItemPresentationInfo: {
|
|
@@ -2943,7 +2943,7 @@ export const manifest: Manifest = {
|
|
|
2943
2943
|
returnType: 'MaybePromise<ItemPresentationInfo | undefined>',
|
|
2944
2944
|
location: {
|
|
2945
2945
|
filePath: 'src/hooks/buildItemPresentationInfo.ts',
|
|
2946
|
-
lineNumber:
|
|
2946
|
+
lineNumber: 15,
|
|
2947
2947
|
},
|
|
2948
2948
|
},
|
|
2949
2949
|
assetSources: {
|
|
@@ -2962,7 +2962,7 @@ export const manifest: Manifest = {
|
|
|
2962
2962
|
returnType: 'AssetSource[] | undefined',
|
|
2963
2963
|
location: {
|
|
2964
2964
|
filePath: 'src/hooks/assetSources.ts',
|
|
2965
|
-
lineNumber:
|
|
2965
|
+
lineNumber: 18,
|
|
2966
2966
|
},
|
|
2967
2967
|
},
|
|
2968
2968
|
},
|
package/src/shared.ts
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
isArray,
|
|
3
|
+
isBoolean,
|
|
4
|
+
isNullish,
|
|
5
|
+
isNumber,
|
|
6
|
+
isRecord,
|
|
7
|
+
isString,
|
|
8
|
+
} from './guardUtils.js';
|
|
9
|
+
import { Icon, isIcon } from './icon';
|
|
2
10
|
|
|
11
|
+
/**
|
|
12
|
+
* An object expressing a dropdown action to be shown in the interface
|
|
13
|
+
*
|
|
14
|
+
* @see {isDropdownAction}
|
|
15
|
+
*/
|
|
3
16
|
export type DropdownAction = {
|
|
4
17
|
/**
|
|
5
18
|
* ID of action. Will be the first argument for the
|
|
@@ -38,6 +51,11 @@ export type DropdownAction = {
|
|
|
38
51
|
rank?: number;
|
|
39
52
|
};
|
|
40
53
|
|
|
54
|
+
/**
|
|
55
|
+
* An object expressing a dropdown submenu containing actions to be shown in the interface
|
|
56
|
+
*
|
|
57
|
+
* @see {isDropdownActionGroup}
|
|
58
|
+
*/
|
|
41
59
|
export type DropdownActionGroup = {
|
|
42
60
|
/** Label to be shown. Must be unique. */
|
|
43
61
|
label: string;
|
|
@@ -65,3 +83,42 @@ export type ItemFormSidebarPanelPlacement = [
|
|
|
65
83
|
'before' | 'after',
|
|
66
84
|
'info' | 'publishedVersion' | 'schedule' | 'links' | 'history',
|
|
67
85
|
];
|
|
86
|
+
|
|
87
|
+
export function isDropdownAction(value: unknown): value is DropdownAction {
|
|
88
|
+
if (!isRecord(value)) return false;
|
|
89
|
+
|
|
90
|
+
return (
|
|
91
|
+
isString(value.id) &&
|
|
92
|
+
(isNullish(value.parameters) || isRecord(value.parameters)) &&
|
|
93
|
+
isString(value.label) &&
|
|
94
|
+
isIcon(value.icon) &&
|
|
95
|
+
(isNullish(value.active) || isBoolean(value.active)) &&
|
|
96
|
+
(isNullish(value.alert) || isBoolean(value.alert)) &&
|
|
97
|
+
(isNullish(value.disabled) || isBoolean(value.disabled)) &&
|
|
98
|
+
(isNullish(value.closeMenuOnClick) || isBoolean(value.closeMenuOnClick)) &&
|
|
99
|
+
(isNullish(value.rank) || isNumber(value.rank))
|
|
100
|
+
);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export function isDropdownActionGroup(
|
|
104
|
+
value: unknown,
|
|
105
|
+
): value is DropdownActionGroup {
|
|
106
|
+
if (!isRecord(value)) return false;
|
|
107
|
+
|
|
108
|
+
return (
|
|
109
|
+
isString(value.label) &&
|
|
110
|
+
isIcon(value.icon) &&
|
|
111
|
+
isArray(value.actions, isDropdownAction) &&
|
|
112
|
+
(isNullish(value.rank) || isNumber(value.rank))
|
|
113
|
+
);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export function isDropdownActionOrGroupArray(
|
|
117
|
+
value: unknown,
|
|
118
|
+
): value is Array<DropdownAction | DropdownActionGroup> {
|
|
119
|
+
return isArray(
|
|
120
|
+
value,
|
|
121
|
+
(innerValue) =>
|
|
122
|
+
isDropdownAction(innerValue) || isDropdownActionGroup(innerValue),
|
|
123
|
+
);
|
|
124
|
+
}
|