@plaudit/gutenberg-api-extensions 2.63.0 → 2.64.0
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/build/blocks/SNPGroupComponent.js +13 -2
- package/build/blocks/SNPGroupComponent.js.map +1 -1
- package/build/blocks/basic-custom-block-bindings-support.d.ts +1 -10
- package/build/blocks/basic-custom-block-bindings-support.js +8 -12
- package/build/blocks/basic-custom-block-bindings-support.js.map +1 -1
- package/build/blocks/common-native-property-constructors.d.ts +17 -6
- package/build/blocks/common-native-property-constructors.js +128 -29
- package/build/blocks/common-native-property-constructors.js.map +1 -1
- package/build/blocks/data-controller.d.ts +1 -1
- package/build/blocks/data-controller.js +4 -1
- package/build/blocks/data-controller.js.map +1 -1
- package/build/blocks/layered-styles-impl.js +6 -5
- package/build/blocks/layered-styles-impl.js.map +1 -1
- package/build/blocks/layout/LaidOutProperty.d.ts +1 -0
- package/build/blocks/layout/LaidOutProperty.js +16 -5
- package/build/blocks/layout/LaidOutProperty.js.map +1 -1
- package/build/blocks/layout/LaidOutPropertyRow.d.ts +2 -1
- package/build/blocks/layout/LaidOutPropertyRow.js +3 -3
- package/build/blocks/layout/LaidOutPropertyRow.js.map +1 -1
- package/build/blocks/layout/ToolsPanelContext.d.ts +9 -0
- package/build/blocks/layout/ToolsPanelContext.js +18 -0
- package/build/blocks/layout/ToolsPanelContext.js.map +1 -0
- package/build/blocks/simple-native-property-api.js +4 -40
- package/build/blocks/simple-native-property-api.js.map +1 -1
- package/build/blocks/simple-native-property-impl.js +35 -138
- package/build/blocks/simple-native-property-impl.js.map +1 -1
- package/build/blocks/simple-native-property-internal-shared.d.ts +12 -17
- package/build/blocks/simple-native-property-internal-shared.js +0 -18
- package/build/blocks/simple-native-property-internal-shared.js.map +1 -1
- package/build/controls/PromisableComponent.d.ts +3 -2
- package/build/controls/PromisableComponent.js +13 -5
- package/build/controls/PromisableComponent.js.map +1 -1
- package/build/controls/hooks/useSortableItemsModel.js +59 -56
- package/build/controls/hooks/useSortableItemsModel.js.map +1 -1
- package/build/editor/post-featured-image.js +3 -2
- package/build/editor/post-featured-image.js.map +1 -1
- package/build/editor/simple-gutenberg-endpoints-api.d.ts +6 -0
- package/build/editor/simple-gutenberg-endpoints-api.js +15 -0
- package/build/editor/simple-gutenberg-endpoints-api.js.map +1 -0
- package/build/editor/simple-gutenberg-endpoints-impl.d.ts +23 -0
- package/build/editor/simple-gutenberg-endpoints-impl.js +47 -0
- package/build/editor/simple-gutenberg-endpoints-impl.js.map +1 -0
- package/build/index.d.ts +3 -11
- package/build/index.js +10 -4
- package/build/index.js.map +1 -1
- package/build/lib/gutenberg-api-extensions-state/custom-block-bindings-support-logic.d.ts +26 -0
- package/build/lib/gutenberg-api-extensions-state/custom-block-bindings-support-logic.js +14 -0
- package/build/lib/gutenberg-api-extensions-state/custom-block-bindings-support-logic.js.map +1 -0
- package/build/lib/gutenberg-api-extensions-state/layered-block-styles-logic.d.ts +22 -0
- package/build/lib/gutenberg-api-extensions-state/layered-block-styles-logic.js +14 -0
- package/build/lib/gutenberg-api-extensions-state/layered-block-styles-logic.js.map +1 -0
- package/build/lib/gutenberg-api-extensions-state/snp-logic.d.ts +44 -0
- package/build/lib/gutenberg-api-extensions-state/snp-logic.js +177 -0
- package/build/lib/gutenberg-api-extensions-state/snp-logic.js.map +1 -0
- package/build/lib/gutenberg-api-extensions-state.d.ts +106 -0
- package/build/lib/gutenberg-api-extensions-state.js +107 -0
- package/build/lib/gutenberg-api-extensions-state.js.map +1 -0
- package/build/lib/helpers.d.ts +1 -0
- package/build/lib/helpers.js +10 -0
- package/build/lib/helpers.js.map +1 -0
- package/build/lib/suspense.d.ts +6 -0
- package/build/lib/suspense.js +12 -0
- package/build/lib/suspense.js.map +1 -1
- package/build/lib/useful-types.d.ts +9 -0
- package/build/lib/useful-types.js +2 -0
- package/build/lib/useful-types.js.map +1 -0
- package/package.json +1 -4
- package/styles/editor.pcss +4 -0
|
@@ -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,107 @@
|
|
|
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, snpLogicResolvers, 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
|
+
resolvers: {
|
|
103
|
+
...snpLogicResolvers
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
register(store);
|
|
107
|
+
//# sourceMappingURL=gutenberg-api-extensions-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;YACtD,OAAO,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC;QACxC,CAAC;KACD;IACD,SAAS,EAAE;QACV,GAAG,iBAAiB;KACpB;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"}
|
package/build/lib/suspense.d.ts
CHANGED
|
@@ -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;
|
package/build/lib/suspense.js
CHANGED
|
@@ -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.
|
|
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 @@
|
|
|
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.
|
|
3
|
+
"version": "2.64.0",
|
|
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
|
},
|
package/styles/editor.pcss
CHANGED
|
@@ -29,6 +29,10 @@
|
|
|
29
29
|
:has(.has-validation-error) {
|
|
30
30
|
border-color: var(--plaudit-gae-validation-error-text)
|
|
31
31
|
}
|
|
32
|
+
|
|
33
|
+
.block-editor-block-inspector > * > .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 */
|