@plaudit/gutenberg-api-extensions 2.80.1 → 2.81.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/CHANGELOG.md +162 -0
- package/README.md +10 -2
- package/dist/blocks/hooks/useSuspendableOptions.js.map +1 -1
- package/dist/editor/simple-gutenberg-endpoints-impl.d.ts +1 -0
- package/dist/editor/simple-gutenberg-endpoints-impl.js +6 -0
- package/dist/editor/simple-gutenberg-endpoints-impl.js.map +1 -1
- package/package.json +19 -15
- package/simple-native-properties.md +1100 -0
- package/src/blocks/hooks/useSuspendableOptions.ts +2 -2
- package/src/editor/simple-gutenberg-endpoints-impl.ts +8 -1
- package/src/schemas/README.md +1 -0
- package/src/schemas/plaudit-block-schema.json +818 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {useSelect} from "@wordpress/data";
|
|
1
|
+
import {useSelect, type MapSelect} from "@wordpress/data";
|
|
2
2
|
import {useMemo} from "@wordpress/element";
|
|
3
3
|
import {applyFilters} from "@wordpress/hooks";
|
|
4
4
|
|
|
@@ -26,7 +26,7 @@ export function useSuspendableOptions<T extends CSNPConfig&{options: PromisableP
|
|
|
26
26
|
|
|
27
27
|
// This if/else statement is present because actually passing attributes through to the selectors represents a SEVERE relative performance hit.
|
|
28
28
|
// At a minimum, it causes at leat one additional full execution pass, and, due to how data can be cached, that pass is almost guaranteed to turn into at least one full render.
|
|
29
|
-
let mapSelect: (...args: Parameters<
|
|
29
|
+
let mapSelect: (...args: Parameters<MapSelect>) => [Record<string, any>|null, string|null];
|
|
30
30
|
if (usesBlockAttributes) {
|
|
31
31
|
mapSelect = wrappedSelect => {
|
|
32
32
|
const selected = wrappedSelect(blockEditorStore);
|
|
@@ -31,7 +31,8 @@ export namespace installSimpleGutenbergApisSupport {
|
|
|
31
31
|
|
|
32
32
|
type Selectors = {
|
|
33
33
|
get(name: string, args?: ApiCallArgs): unknown,
|
|
34
|
-
resolve(name: string, args?: ApiCallArgs): Promise<unknown
|
|
34
|
+
resolve(name: string, args?: ApiCallArgs): Promise<unknown>,
|
|
35
|
+
registeredEndpoints(): string[]
|
|
35
36
|
};
|
|
36
37
|
type Actions = {
|
|
37
38
|
registerEndpoint(
|
|
@@ -94,6 +95,9 @@ export const store: ReturnType<typeof createReduxStore<{}, Actions, AddBSStateAr
|
|
|
94
95
|
},
|
|
95
96
|
resolve(name, args?) {
|
|
96
97
|
return handleCacheMiss(name, args);
|
|
98
|
+
},
|
|
99
|
+
registeredEndpoints(): string[] {
|
|
100
|
+
return Object.keys(endpoints);
|
|
97
101
|
}
|
|
98
102
|
};
|
|
99
103
|
const suspendSelectors: Selectors = {
|
|
@@ -102,6 +106,9 @@ export const store: ReturnType<typeof createReduxStore<{}, Actions, AddBSStateAr
|
|
|
102
106
|
},
|
|
103
107
|
resolve(name, args?) {
|
|
104
108
|
return useToPromise(handleCacheMiss(name, args));
|
|
109
|
+
},
|
|
110
|
+
registeredEndpoints(): string[] {
|
|
111
|
+
return Object.keys(endpoints);
|
|
105
112
|
}
|
|
106
113
|
};
|
|
107
114
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
See `Deploy Schema` section of ../README.md
|