@plaudit/gutenberg-api-extensions 2.63.0 → 2.64.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.
Files changed (69) hide show
  1. package/build/blocks/SNPGroupComponent.js +13 -2
  2. package/build/blocks/SNPGroupComponent.js.map +1 -1
  3. package/build/blocks/basic-custom-block-bindings-support.d.ts +1 -10
  4. package/build/blocks/basic-custom-block-bindings-support.js +8 -12
  5. package/build/blocks/basic-custom-block-bindings-support.js.map +1 -1
  6. package/build/blocks/common-native-property-constructors.d.ts +17 -6
  7. package/build/blocks/common-native-property-constructors.js +128 -29
  8. package/build/blocks/common-native-property-constructors.js.map +1 -1
  9. package/build/blocks/data-controller.d.ts +3 -2
  10. package/build/blocks/data-controller.js +21 -2
  11. package/build/blocks/data-controller.js.map +1 -1
  12. package/build/blocks/layered-styles-impl.js +6 -5
  13. package/build/blocks/layered-styles-impl.js.map +1 -1
  14. package/build/blocks/layout/LaidOutProperty.d.ts +1 -0
  15. package/build/blocks/layout/LaidOutProperty.js +16 -5
  16. package/build/blocks/layout/LaidOutProperty.js.map +1 -1
  17. package/build/blocks/layout/LaidOutPropertyRow.d.ts +2 -1
  18. package/build/blocks/layout/LaidOutPropertyRow.js +3 -3
  19. package/build/blocks/layout/LaidOutPropertyRow.js.map +1 -1
  20. package/build/blocks/layout/ToolsPanelContext.d.ts +9 -0
  21. package/build/blocks/layout/ToolsPanelContext.js +18 -0
  22. package/build/blocks/layout/ToolsPanelContext.js.map +1 -0
  23. package/build/blocks/simple-native-property-api.d.ts +2 -0
  24. package/build/blocks/simple-native-property-api.js +4 -40
  25. package/build/blocks/simple-native-property-api.js.map +1 -1
  26. package/build/blocks/simple-native-property-impl.js +43 -138
  27. package/build/blocks/simple-native-property-impl.js.map +1 -1
  28. package/build/blocks/simple-native-property-internal-shared.d.ts +12 -17
  29. package/build/blocks/simple-native-property-internal-shared.js +0 -18
  30. package/build/blocks/simple-native-property-internal-shared.js.map +1 -1
  31. package/build/controls/PromisableComponent.d.ts +3 -2
  32. package/build/controls/PromisableComponent.js +13 -5
  33. package/build/controls/PromisableComponent.js.map +1 -1
  34. package/build/controls/hooks/useSortableItemsModel.js +59 -56
  35. package/build/controls/hooks/useSortableItemsModel.js.map +1 -1
  36. package/build/editor/post-featured-image.js +3 -2
  37. package/build/editor/post-featured-image.js.map +1 -1
  38. package/build/editor/simple-gutenberg-endpoints-api.d.ts +6 -0
  39. package/build/editor/simple-gutenberg-endpoints-api.js +15 -0
  40. package/build/editor/simple-gutenberg-endpoints-api.js.map +1 -0
  41. package/build/editor/simple-gutenberg-endpoints-impl.d.ts +23 -0
  42. package/build/editor/simple-gutenberg-endpoints-impl.js +47 -0
  43. package/build/editor/simple-gutenberg-endpoints-impl.js.map +1 -0
  44. package/build/index.d.ts +3 -11
  45. package/build/index.js +10 -4
  46. package/build/index.js.map +1 -1
  47. package/build/lib/gutenberg-api-extensions-state/custom-block-bindings-support-logic.d.ts +26 -0
  48. package/build/lib/gutenberg-api-extensions-state/custom-block-bindings-support-logic.js +14 -0
  49. package/build/lib/gutenberg-api-extensions-state/custom-block-bindings-support-logic.js.map +1 -0
  50. package/build/lib/gutenberg-api-extensions-state/layered-block-styles-logic.d.ts +22 -0
  51. package/build/lib/gutenberg-api-extensions-state/layered-block-styles-logic.js +14 -0
  52. package/build/lib/gutenberg-api-extensions-state/layered-block-styles-logic.js.map +1 -0
  53. package/build/lib/gutenberg-api-extensions-state/snp-logic.d.ts +41 -0
  54. package/build/lib/gutenberg-api-extensions-state/snp-logic.js +168 -0
  55. package/build/lib/gutenberg-api-extensions-state/snp-logic.js.map +1 -0
  56. package/build/lib/gutenberg-api-extensions-state.d.ts +106 -0
  57. package/build/lib/gutenberg-api-extensions-state.js +104 -0
  58. package/build/lib/gutenberg-api-extensions-state.js.map +1 -0
  59. package/build/lib/helpers.d.ts +1 -0
  60. package/build/lib/helpers.js +10 -0
  61. package/build/lib/helpers.js.map +1 -0
  62. package/build/lib/suspense.d.ts +6 -0
  63. package/build/lib/suspense.js +12 -0
  64. package/build/lib/suspense.js.map +1 -1
  65. package/build/lib/useful-types.d.ts +9 -0
  66. package/build/lib/useful-types.js +2 -0
  67. package/build/lib/useful-types.js.map +1 -0
  68. package/package.json +1 -4
  69. package/styles/editor.pcss +4 -0
@@ -0,0 +1,168 @@
1
+ import { getBlockType } from "@wordpress/blocks";
2
+ import { dispatch } from "@wordpress/data";
3
+ import { hydrateSimpleNativeProperty } from "../../blocks/common-native-property-constructors";
4
+ import { isBlockJsonNativePropsConfig } from "../../blocks/snp-api";
5
+ import { store } from "../gutenberg-api-extensions-state";
6
+ export const snpLogicActions = {
7
+ addProperties(blockName, properties) {
8
+ return { type: 'ADD_PROPERTIES', blockName, properties };
9
+ },
10
+ addOrUpdateExtraPropTransform(blockName, propPath, extraPropTransform) {
11
+ return { type: 'ADD_OR_UPDATE_EXTRA_PROP_TRANSFORM', blockName, propPath, extraPropTransform };
12
+ },
13
+ setComputedExtraPropTransforms(blockName, computedExtraPropTransforms) {
14
+ return { type: 'SET_COMPUTED_EXTRA_PROP_TRANSFORMS', blockName, computedExtraPropTransforms };
15
+ },
16
+ setPreppedProperties(blockName, properties) {
17
+ return { type: 'SET_PREPPED_PROPERTIES', blockName, properties };
18
+ }
19
+ };
20
+ export const snpLogicSelectors = {
21
+ desiccatedProperties(state, blockName) {
22
+ return state.desiccatedProperties[blockName];
23
+ },
24
+ preppedProperties(state, blockName) {
25
+ let res = state.preppedProperties[blockName];
26
+ if (res === undefined) {
27
+ res = prepSimpleNativePanelsAndTabs(blockName, state.desiccatedProperties[blockName]);
28
+ dispatch(store).setPreppedProperties(blockName, res);
29
+ }
30
+ return res;
31
+ },
32
+ extraPropTransforms(state, blockName) {
33
+ return state.extraPropTransforms[blockName];
34
+ },
35
+ computedExtraPropTransforms(state, blockName) {
36
+ let res = state.computedExtraPropTransforms[blockName];
37
+ if (res === undefined) {
38
+ res = computeExtraPropTransforms(getBlockType(blockName), state.extraPropTransforms[blockName]);
39
+ dispatch(store).setComputedExtraPropTransforms(blockName, res);
40
+ }
41
+ return res;
42
+ }
43
+ };
44
+ export function addProperties(block, properties, simpleNativePanelsAndTabs) {
45
+ const panels = (simpleNativePanelsAndTabs[block] ?? (simpleNativePanelsAndTabs[block] = []));
46
+ if ('title' in properties) {
47
+ panels.push(properties);
48
+ return;
49
+ }
50
+ let rawProperties = [];
51
+ for (const prop of properties) {
52
+ if ('title' in prop) {
53
+ if (rawProperties.length) {
54
+ panels.push({
55
+ title: "",
56
+ properties: rawProperties
57
+ });
58
+ rawProperties = [];
59
+ }
60
+ panels.push(prop);
61
+ }
62
+ else {
63
+ rawProperties.push(prop);
64
+ }
65
+ }
66
+ if (rawProperties.length) {
67
+ panels.push({
68
+ title: "",
69
+ properties: rawProperties
70
+ });
71
+ }
72
+ }
73
+ function normalizeTabItems(items, outsideHydrationInfo) {
74
+ let bareProperties = [];
75
+ const normalizedItems = [];
76
+ for (const item of items) {
77
+ if (Array.isArray(item)) {
78
+ bareProperties.push(item.map(prp => hydrateSimpleNativeProperty(prp, "", outsideHydrationInfo, [])));
79
+ }
80
+ else if ('title' in item && 'properties' in item) {
81
+ if (bareProperties.length) {
82
+ normalizedItems.push({ title: "", properties: bareProperties, initialOpen: true });
83
+ bareProperties = [];
84
+ }
85
+ normalizedItems.push(hydrateSimpleNativePanel(item, outsideHydrationInfo));
86
+ }
87
+ else {
88
+ bareProperties.push(hydrateSimpleNativeProperty(item, "", outsideHydrationInfo, []));
89
+ }
90
+ }
91
+ if (bareProperties.length) {
92
+ normalizedItems.push({ title: "", properties: bareProperties, initialOpen: true });
93
+ }
94
+ return normalizedItems;
95
+ }
96
+ function hydrateSimpleNativePanel(panel, outsideHydrationInfo) {
97
+ return {
98
+ ...panel, properties: panel.properties.map(prop => Array.isArray(prop)
99
+ ? prop.map(prp => hydrateSimpleNativeProperty(prp, "", outsideHydrationInfo, []))
100
+ : hydrateSimpleNativeProperty(prop, "", outsideHydrationInfo, []))
101
+ };
102
+ }
103
+ /**
104
+ * This performs the one-time prep for rendering the registered SNP panels and tabs for a Block.
105
+ *
106
+ * @param block the name of the block to prep
107
+ * @param items the properties sourced from the datastore
108
+ * @returns either false or an object with at least one declared panel or tab.
109
+ * This guarantee is made in order to avoid having to perform more convoluted checks in the render methods
110
+ */
111
+ export function prepSimpleNativePanelsAndTabs(block, items) {
112
+ if (items === undefined) {
113
+ return false;
114
+ }
115
+ const ungroupedTabs = [];
116
+ const panels = [];
117
+ for (const item of items) {
118
+ const isTab = 'items' in item;
119
+ if (item.group === 'layered-styles') {
120
+ const props = (isTab
121
+ ? item.items.flatMap(propsOrPanel => 'title' in propsOrPanel ? propsOrPanel.properties : propsOrPanel)
122
+ : item.properties).flat();
123
+ dispatch(store).addLayeredBlockStyles(block, props);
124
+ }
125
+ if (isTab) {
126
+ ungroupedTabs.push(item);
127
+ }
128
+ else {
129
+ panels.push(item);
130
+ }
131
+ }
132
+ if (!panels.length && !ungroupedTabs.length) {
133
+ return false;
134
+ }
135
+ const groupedTabs = {};
136
+ for (const tab of ungroupedTabs) {
137
+ const tabGroupName = tab.group ?? 'default';
138
+ const groupedTabsForName = groupedTabs[tabGroupName] ?? (groupedTabs[tabGroupName] = {});
139
+ // If a tab with that title already exists, we append its properties to the existing ones
140
+ const existingGroupedTabsForName = groupedTabsForName[tab.title];
141
+ groupedTabsForName[tab.title] = {
142
+ title: tab.title, group: tabGroupName,
143
+ items: existingGroupedTabsForName
144
+ ? [...existingGroupedTabsForName.items, ...normalizeTabItems(tab.items, { forLayeredStyles: tab.group === "layered-styles", blockName: block })]
145
+ : normalizeTabItems(tab.items, { forLayeredStyles: tab.group === "layered-styles", blockName: block })
146
+ };
147
+ }
148
+ return {
149
+ // Because JavaScript's Array sorting methods are stable, we can just sort once at the end
150
+ panels: panels.map(panel => hydrateSimpleNativePanel(panel, { forLayeredStyles: panel.group === "layered-styles", blockName: block }))
151
+ .sort(({ position: aPosition = 10 }, { position: bPosition = 10 }) => aPosition - bPosition),
152
+ // We sort tab groups by name in order to force SNP styles to be added after layered-styles
153
+ // We don't need to check for equality in the group comparator because Object-keys are guaranteed to be distinct
154
+ tabs: Object.fromEntries(Object.entries(groupedTabs)
155
+ .sort(([aName], [bName]) => aName > bName ? 1 : -1))
156
+ };
157
+ }
158
+ export function computeExtraPropTransforms(blockType, extraPropTransforms) {
159
+ if (extraPropTransforms === undefined) {
160
+ return false;
161
+ }
162
+ const rawTransforms = Object.entries(extraPropTransforms);
163
+ const transforms = rawTransforms.length
164
+ ? rawTransforms.map(transform => [transform[0].split("."), transform[1]])
165
+ : false;
166
+ return transforms ? { transforms, appliesInEditor: !isBlockJsonNativePropsConfig(blockType.plaudit) } : false;
167
+ }
168
+ //# sourceMappingURL=snp-logic.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"snp-logic.js","sourceRoot":"","sources":["../../../src/lib/gutenberg-api-extensions-state/snp-logic.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAC,QAAQ,EAAC,MAAM,iBAAiB,CAAC;AAGzC,OAAO,EAAC,2BAA2B,EAAuB,MAAM,kDAAkD,CAAC;AAQnH,OAAO,EAAC,4BAA4B,EAAqB,MAAM,sBAAsB,CAAC;AACtF,OAAO,EAA0C,KAAK,EAAC,MAAM,mCAAmC,CAAC;AAQjG,MAAM,CAAC,MAAM,eAAe,GAAG;IAC9B,aAAa,CAAC,SAAgC,EAAE,UAA0B;QACzE,OAAO,EAAC,IAAI,EAAE,gBAAgB,EAAE,SAAS,EAAE,UAAU,EAAC,CAAC;IACxD,CAAC;IACD,6BAA6B,CAAC,SAAoB,EAAE,QAAgB,EAAE,kBAAqD;QAC1H,OAAO,EAAC,IAAI,EAAE,oCAAoC,EAAE,SAAS,EAAE,QAAQ,EAAE,kBAAkB,EAAC,CAAC;IAC9F,CAAC;IACD,8BAA8B,CAAC,SAAoB,EAAE,2BAA8D;QAClH,OA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E,EAAE,CAAC,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;KACrD,CAAC;AACH,CAAC;AAED,MAAM,UAAU,0BAA0B,CAAC,SAA6B,EAAE,mBAAwD;IACjI,IAAI,mBAAmB,KAAK,SAAS,EAAE,CAAC;QACvC,OAAO,KAAK,CAAC;IACd,CAAC;IACD,MAAM,aAAa,GAAG,MAAM,CAAC,OAAO,CAAC,mBAAmB,CAAC,CAAC;IAC1D,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM;QACtC,CAAC,CAAC,aAAa,CAAC,GAAG,CAAoD,SAAS,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAA0B,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;QACrJ,CAAC,CAAC,KAAK,CAAC;IACT,OAAO,UAAU,CAAC,CAAC,CAAC,EAAC,UAAU,EAAE,eAAe,EAAE,CAAC,4BAA4B,CAAC,SAAS,CAAC,OAAO,CAAC,EAAC,CAAC,CAAC,CAAC,KAAK,CAAC;AAC7G,CAAC"}
@@ -0,0 +1,106 @@
1
+ import { dispatch, select, StoreDescriptor } from "@wordpress/data";
2
+ import type { BlockName, DbSource, LaidOutProperties, PDSimpleNativeProperty, SimpleNativePanel, SimpleNativeTab } from "../blocks";
3
+ import type { ExtraPropTransformsConfig, PerBlockExtraPropTransforms, PreppedSimpleNativePanelsAndTabs } from "../blocks/simple-native-property-internal-shared";
4
+ import type { RegisterBlockAttrs } from "../blocks/snp-api";
5
+ import { LayeredBlockStylesLogicActions } from "./gutenberg-api-extensions-state/layered-block-styles-logic";
6
+ import { SNPLogicActions } from "./gutenberg-api-extensions-state/snp-logic";
7
+ import { CustomBlockBindingsSupportLogicActions } from "./gutenberg-api-extensions-state/custom-block-bindings-support-logic";
8
+ import type { WordPressMetaActions } from "./useful-types";
9
+ export type State = {
10
+ customBlockBindingsSupport: {
11
+ [name in string]?: {
12
+ dbSources?: DbSource[];
13
+ };
14
+ };
15
+ layeredBlockStyles: {
16
+ [blockName in BlockName]?: {
17
+ [name in string]: PDSimpleNativeProperty;
18
+ };
19
+ };
20
+ desiccatedProperties: {
21
+ [blockName in BlockName]?: Array<SimpleNativePanel | SimpleNativeTab>;
22
+ };
23
+ preppedProperties: {
24
+ [blockName in BlockName]?: PreppedSimpleNativePanelsAndTabs | false;
25
+ };
26
+ extraPropTransforms: {
27
+ [blockName in BlockName]?: ExtraPropTransformsConfig;
28
+ };
29
+ computedExtraPropTransforms: {
30
+ [blockName in BlockName]?: PerBlockExtraPropTransforms | false;
31
+ };
32
+ baselineBlockAttrs: {
33
+ [blockName in BlockName]?: RegisterBlockAttrs<Record<string, any>>;
34
+ };
35
+ features: {
36
+ [name in string]?: {
37
+ [prop in string]: any;
38
+ };
39
+ };
40
+ };
41
+ export type BareProperties = SimpleNativePanel | SimpleNativeTab | Array<LaidOutProperties[number] | SimpleNativePanel | SimpleNativeTab>;
42
+ export type NamedBlockAction<A extends string, P = {}> = {
43
+ type: A;
44
+ blockName: BlockName;
45
+ } & P;
46
+ export type MinThunkParams = {
47
+ dispatch(action: ReducerActions | WordPressMetaActions): Promise<unknown>;
48
+ };
49
+ export type ThunkParams<T extends StoreDescriptor> = {
50
+ select: ReturnType<typeof select<T>>;
51
+ dispatch: ReturnType<typeof dispatch<T>> & {
52
+ (action: ReducerActions | WordPressMetaActions): Promise<unknown>;
53
+ };
54
+ resolveSelect: PromisifyFunctionReturns<ReturnType<typeof select<T>>>;
55
+ };
56
+ export type PromisifyFunctionReturns<T extends {
57
+ [K in string]: (...args: any[]) => any;
58
+ }> = {
59
+ [K in keyof T]: (...args: Parameters<T[K]>) => Promise<ReturnType<T[K]>>;
60
+ };
61
+ type ReducerActions = CustomBlockBindingsSupportLogicActions | LayeredBlockStylesLogicActions | SNPLogicActions | {
62
+ type: 'RECORD_BASELINE_BLOCK_ATTRS';
63
+ attrs: RegisterBlockAttrs<Record<string, any>>;
64
+ } | {
65
+ type: "SET_FEATURE_PROP";
66
+ feature: string;
67
+ prop: string;
68
+ value: any;
69
+ };
70
+ export declare const store: import("@wordpress/data/build-types/types").StoreDescriptor<import("@wordpress/data/build-types/types").ReduxStoreConfig<State, {
71
+ recordBaselineBlockAttrs(attrs: RegisterBlockAttrs<Record<string, any>>): ReducerActions;
72
+ setFeatureProp(feature: string, prop: string, value: any): ReducerActions;
73
+ addProperties(blockName: BlockName | BlockName[], properties: BareProperties): SNPLogicActions;
74
+ addOrUpdateExtraPropTransform(blockName: BlockName, propPath: string, extraPropTransform: ExtraPropTransformsConfig[string]): SNPLogicActions;
75
+ setComputedExtraPropTransforms(blockName: BlockName, computedExtraPropTransforms: PerBlockExtraPropTransforms | false): SNPLogicActions;
76
+ setPreppedProperties(blockName: BlockName, properties: PreppedSimpleNativePanelsAndTabs | false): SNPLogicActions;
77
+ addLayeredBlockStyles(blockName: BlockName, properties: PDSimpleNativeProperty[]): {
78
+ type: string;
79
+ blockName: `${string}/${string}`;
80
+ properties: PDSimpleNativeProperty[];
81
+ };
82
+ registerCustomBlockBindingsSource(args: Parameters<typeof import("@wordpress/blocks").registerBlockBindingsSource>[0] & {
83
+ dbSources?: DbSource[];
84
+ }): {
85
+ type: string;
86
+ name: string;
87
+ value: {
88
+ dbSources: (DBSource[] & DbSource[]) | undefined;
89
+ };
90
+ };
91
+ }, {
92
+ baselineBlockAttrs(state: State, blockName: BlockName): RegisterBlockAttrs<Record<string, any>> | undefined;
93
+ featureProp(state: State, feature: string, prop: string): any;
94
+ desiccatedProperties(state: State, blockName: BlockName): (SimpleNativePanel | SimpleNativeTab)[] | undefined;
95
+ preppedProperties(state: State, blockName: BlockName): false | PreppedSimpleNativePanelsAndTabs;
96
+ extraPropTransforms(state: State, blockName: BlockName): ExtraPropTransformsConfig | undefined;
97
+ computedExtraPropTransforms(state: State, blockName: BlockName): false | PerBlockExtraPropTransforms;
98
+ blockStylesLayer(state: State, blockName: BlockName, layerName: string): PDSimpleNativeProperty | undefined;
99
+ blockStylesLayers(state: State, blockName: BlockName): {
100
+ [x: string]: PDSimpleNativeProperty;
101
+ } | undefined;
102
+ customBlockBindingsSource(state: State, name: string): {
103
+ dbSources?: DbSource[];
104
+ } | undefined;
105
+ }>>;
106
+ export {};
@@ -0,0 +1,104 @@
1
+ import { createReduxStore, register } from "@wordpress/data";
2
+ import { produce } from "immer";
3
+ import { layeredBlockStylesLogicActions, layeredBlockStylesLogicSelectors } from "./gutenberg-api-extensions-state/layered-block-styles-logic";
4
+ import { addProperties, snpLogicActions, snpLogicSelectors } from "./gutenberg-api-extensions-state/snp-logic";
5
+ import { customBlockBindingsSupportLogicActions, customBlockBindingsSupportLogicSelectors } from "./gutenberg-api-extensions-state/custom-block-bindings-support-logic";
6
+ import { clone } from "./helpers";
7
+ const DEFAULT_STATE = {
8
+ customBlockBindingsSupport: {}, layeredBlockStyles: {}, desiccatedProperties: {}, preppedProperties: {}, extraPropTransforms: {},
9
+ computedExtraPropTransforms: {}, baselineBlockAttrs: {}, features: {}
10
+ };
11
+ export const store = createReduxStore('gutenberg-api-extensions-state', {
12
+ initialState: DEFAULT_STATE,
13
+ reducer(state, action) {
14
+ switch (action.type) {
15
+ case "ADD_CUSTOM_BLOCK_BINDINGS_SOURCE":
16
+ return produce(state, (result) => {
17
+ result.customBlockBindingsSupport[action.name] = action.value;
18
+ });
19
+ case "ADD_LAYERED_BLOCK_STYLES":
20
+ return produce(state, (result) => {
21
+ const blockLayeredStyles = result.layeredBlockStyles[action.blockName] ?? (result.layeredBlockStyles[action.blockName] = {});
22
+ for (const layer of action.properties) {
23
+ blockLayeredStyles[layer.name] = layer;
24
+ }
25
+ });
26
+ case "SET_LAYERED_BLOCK_STYLES":
27
+ return produce(state, (result) => {
28
+ result.layeredBlockStyles[action.blockName] = action.properties;
29
+ });
30
+ case "ADD_PROPERTIES":
31
+ return produce(state, (result) => {
32
+ if (Array.isArray(action.blockName)) {
33
+ for (const bn of action.blockName) {
34
+ addProperties(bn, action.properties, result.desiccatedProperties);
35
+ result.preppedProperties[bn] = undefined;
36
+ result.extraPropTransforms[bn] = undefined;
37
+ result.computedExtraPropTransforms[bn] = undefined;
38
+ }
39
+ }
40
+ else {
41
+ addProperties(action.blockName, action.properties, result.desiccatedProperties);
42
+ }
43
+ });
44
+ case "ADD_OR_UPDATE_EXTRA_PROP_TRANSFORM":
45
+ return produce(state, (result) => {
46
+ const blockTransforms = result.extraPropTransforms[action.blockName] ?? (result.extraPropTransforms[action.blockName] = {});
47
+ if (blockTransforms[action.propPath]) {
48
+ blockTransforms[action.propPath].styleProperty = action.extraPropTransform.styleProperty;
49
+ }
50
+ else {
51
+ blockTransforms[action.propPath] = action.extraPropTransform;
52
+ }
53
+ result.computedExtraPropTransforms[action.blockName] = undefined;
54
+ });
55
+ case "SET_PREPPED_PROPERTIES":
56
+ return produce(state, (result) => {
57
+ result.preppedProperties[action.blockName] = action.properties;
58
+ });
59
+ case "SET_EXTRA_PROP_TRANSFORMS":
60
+ return produce(state, (result) => {
61
+ result.extraPropTransforms[action.blockName] = action.extraPropTransforms;
62
+ });
63
+ case "SET_COMPUTED_EXTRA_PROP_TRANSFORMS":
64
+ return produce(state, (result) => {
65
+ result.computedExtraPropTransforms[action.blockName] = action.computedExtraPropTransforms;
66
+ });
67
+ case "RECORD_BASELINE_BLOCK_ATTRS":
68
+ return produce(state, (result) => {
69
+ if (!(action.attrs.name in result.baselineBlockAttrs)) {
70
+ result.baselineBlockAttrs[action.attrs.name] = clone(action.attrs);
71
+ }
72
+ });
73
+ case "SET_FEATURE_PROP":
74
+ return produce(state, (result) => {
75
+ (result.features[action.feature] ?? (result.features[action.feature] = {}))[action.prop] = action.value;
76
+ });
77
+ }
78
+ return state;
79
+ },
80
+ actions: {
81
+ ...customBlockBindingsSupportLogicActions,
82
+ ...layeredBlockStylesLogicActions,
83
+ ...snpLogicActions,
84
+ recordBaselineBlockAttrs(attrs) {
85
+ return { type: "RECORD_BASELINE_BLOCK_ATTRS", attrs };
86
+ },
87
+ setFeatureProp(feature, prop, value) {
88
+ return { type: "SET_FEATURE_PROP", feature, prop, value };
89
+ }
90
+ },
91
+ selectors: {
92
+ ...customBlockBindingsSupportLogicSelectors,
93
+ ...layeredBlockStylesLogicSelectors,
94
+ ...snpLogicSelectors,
95
+ baselineBlockAttrs(state, blockName) {
96
+ return state.baselineBlockAttrs[blockName];
97
+ },
98
+ featureProp(state, feature, prop) {
99
+ return state.features[feature]?.[prop];
100
+ }
101
+ }
102
+ });
103
+ register(store);
104
+ //# sourceMappingURL=gutenberg-api-extensions-state.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gutenberg-api-extensions-state.js","sourceRoot":"","sources":["../../src/lib/gutenberg-api-extensions-state.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,gBAAgB,EAAY,QAAQ,EAA0B,MAAM,iBAAiB,CAAC;AAE9F,OAAO,EAAC,OAAO,EAAC,MAAM,OAAO,CAAC;AAK9B,OAAO,EAAC,8BAA8B,EAAkC,gCAAgC,EAAC,MAAM,6DAA6D,CAAC;AAC7K,OAAO,EAAC,aAAa,EAAE,eAAe,EAAmB,iBAAiB,EAAC,MAAM,4CAA4C,CAAC;AAC9H,OAAO,EACN,sCAAsC,EAA0C,wCAAwC,EACxH,MAAM,sEAAsE,CAAC;AAC9E,OAAO,EAAC,KAAK,EAAC,MAAM,WAAW,CAAC;AAgBhC,MAAM,aAAa,GAAU;IAC5B,0BAA0B,EAAE,EAAE,EAAE,kBAAkB,EAAE,EAAE,EAAE,oBAAoB,EAAE,EAAE,EAAE,iBAAiB,EAAE,EAAE,EAAE,mBAAmB,EAAE,EAAE;IAChI,2BAA2B,EAAE,EAAE,EAAE,kBAAkB,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE;CACrE,CAAC;AAWF,MAAM,CAAC,MAAM,KAAK,GAAG,gBAAgB,CAAC,gCAAgC,EAAE;IACvE,YAAY,EAAE,aAAa;IAC3B,O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IAAY,EAAE,KAAU;YACvD,OAAO,EAAC,IAAI,EAAE,kBAAkB,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAC,CAAC;QACzD,CAAC;KACD;IACD,SAAS,EAAE;QACV,GAAG,wCAAwC;QAC3C,GAAG,gCAAgC;QACnC,GAAG,iBAAiB;QACpB,kBAAkB,CAAC,KAAY,EAAE,SAAoB;YACpD,OAAO,KAAK,CAAC,kBAAkB,CAAC,SAAS,CAAC,CAAC;QAC5C,CAAC;QACD,WAAW,CAAC,KAAY,EAAE,OAAe,EAAE,IAAY;YACtD,OAAO,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC;QACxC,CAAC;KACD;CACD,CAAC,CAAC;AACH,QAAQ,CAAC,KAAK,CAAC,CAAC"}
@@ -0,0 +1 @@
1
+ export declare function clone(value: any): any;
@@ -0,0 +1,10 @@
1
+ export function clone(value) {
2
+ if (value === null || value === undefined) {
3
+ return value;
4
+ }
5
+ else if (Array.isArray(value)) {
6
+ return value.map(v => clone(v));
7
+ }
8
+ return typeof value === 'object' ? Object.fromEntries(Object.entries(value).map(([k, v]) => [k, clone(v)])) : value;
9
+ }
10
+ //# sourceMappingURL=helpers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../src/lib/helpers.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,KAAK,CAAC,KAAU;IAC/B,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QAC3C,OAAO,KAAK,CAAC;IACd,CAAC;SAAM,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACjC,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IACjC,CAAC;IACD,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;AACrH,CAAC"}
@@ -1 +1,7 @@
1
1
  export * from "./suspense/promise-handlers";
2
+ import React, { type ReactNode, type SuspenseProps } from "react";
3
+ type OptionallySuspensefulProps = Omit<SuspenseProps, 'children'> & {
4
+ children: ReactNode | (() => ReactNode);
5
+ hasSuspensefulOptions: (() => boolean) | boolean;
6
+ };
7
+ export declare function OptionallySuspenseful({ children: Children, hasSuspensefulOptions, ...props }: OptionallySuspensefulProps): string | number | boolean | import("react/jsx-runtime").JSX.Element | Iterable<React.ReactNode> | null | undefined;
@@ -1,2 +1,14 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Spinner } from "@wordpress/components";
3
+ import { InspectorPanel } from "../controls";
1
4
  export * from "./suspense/promise-handlers";
5
+ import { Suspense } from "react";
6
+ export function OptionallySuspenseful({ children: Children, hasSuspensefulOptions, ...props }) {
7
+ if (typeof hasSuspensefulOptions === 'function' ? hasSuspensefulOptions() : hasSuspensefulOptions) {
8
+ return _jsx(Suspense, { fallback: _jsxs(InspectorPanel, { opened: true, initialOpen: true, children: [_jsx(Spinner, {}), " Loading options"] }), ...props, children: typeof Children === 'function' ? _jsx(Children, {}) : Children });
9
+ }
10
+ else {
11
+ return typeof Children === 'function' ? _jsx(Children, {}) : Children;
12
+ }
13
+ }
2
14
  //# sourceMappingURL=suspense.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"suspense.js","sourceRoot":"","sources":["../../src/lib/suspense.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAC"}
1
+ {"version":3,"file":"suspense.js","sourceRoot":"","sources":["../../src/lib/suspense.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,uBAAuB,CAAC;AAE9C,OAAO,EAAC,cAAc,EAAC,MAAM,aAAa,CAAC;AAE3C,cAAc,6BAA6B,CAAC;AAE5C,OAAc,EAAiB,QAAQ,EAAqB,MAAM,OAAO,CAAC;AAG1E,MAAM,UAAU,qBAAqB,CAAC,EAAC,QAAQ,EAAE,QAAQ,EAAE,qBAAqB,EAAE,GAAG,KAAK,EAA6B;IACtH,IAAI,OAAO,qBAAqB,KAAK,UAAU,CAAC,CAAC,CAAC,qBAAqB,EAAE,CAAC,CAAC,CAAC,qBAAqB,EAAE,CAAC;QACnG,OAAO,KAAC,QAAQ,IAAC,QAAQ,EAAE,MAAC,cAAc,IAAC,MAAM,QAAC,WAAW,mBAAC,KAAC,OAAO,KAAE,wBAAiC,KAAM,KAAK,YACnH,OAAO,QAAQ,KAAK,UAAU,CAAC,CAAC,CAAC,KAAC,QAAQ,KAAE,CAAC,CAAC,CAAC,QAAQ,GAC5C,CAAC;IACd,CAAC;SAAM,CAAC;QACP,OAAO,OAAO,QAAQ,KAAK,UAAU,CAAC,CAAC,CAAC,KAAC,QAAQ,KAAE,CAAC,CAAC,CAAC,QAAQ,CAAC;IAChE,CAAC;AACF,CAAC"}
@@ -0,0 +1,9 @@
1
+ import type * as MetaActions from '@wordpress/data/build-types/redux-store/metadata/actions';
2
+ export type NormalizedReduxActionExtractor<V> = V extends {
3
+ [key in string]: (...args: any[]) => unknown;
4
+ } ? NormalizedReduxActionExtractor<ReturnType<V[keyof V]>> : V extends {
5
+ type: string;
6
+ } ? V : (V extends (...args: any[]) => {
7
+ type: string;
8
+ } ? ReturnType<V> : never);
9
+ export type WordPressMetaActions = NormalizedReduxActionExtractor<typeof MetaActions>;
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=useful-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useful-types.js","sourceRoot":"","sources":["../../src/lib/useful-types.ts"],"names":[],"mappings":""}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plaudit/gutenberg-api-extensions",
3
- "version": "2.63.0",
3
+ "version": "2.64.1",
4
4
  "license": "UNLICENSED",
5
5
  "scripts": {
6
6
  "prepublishOnly": "rm -rf build && mkdir build && tsc",
@@ -19,9 +19,6 @@
19
19
  "./lib/plaudit-icons": {
20
20
  "default": "./build/lib/plaudit-icons.js"
21
21
  },
22
- "./lib/suspense": {
23
- "default": "./build/lib/suspense.js"
24
- },
25
22
  "./blocks": {
26
23
  "default": "./build/blocks/index.js"
27
24
  },
@@ -29,6 +29,10 @@
29
29
  :has(.has-validation-error) {
30
30
  border-color: var(--plaudit-gae-validation-error-text)
31
31
  }
32
+
33
+ [class="block-editor-block-inspector"] > :where(*, * > [role="tabpanel"] > *) > .plaudit-snp-laid-out-property:has(> &.components-tools-panel) {
34
+ margin-block-end: 0;
35
+ }
32
36
  }
33
37
 
34
38
  /* This accounts for WordPress' version of Gutenberg being maddeningly out of date */