@wordpress/data 6.10.0 → 6.13.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/CHANGELOG.md +10 -0
- package/README.md +55 -36
- package/build/components/async-mode-provider/context.js +2 -1
- package/build/components/async-mode-provider/context.js.map +1 -1
- package/build/components/use-dispatch/use-dispatch.js +3 -2
- package/build/components/use-dispatch/use-dispatch.js.map +1 -1
- package/build/components/use-select/index.js +32 -19
- package/build/components/use-select/index.js.map +1 -1
- package/build/components/with-dispatch/index.js +5 -3
- package/build/components/with-dispatch/index.js.map +1 -1
- package/build/components/with-registry/index.js.map +1 -1
- package/build/components/with-select/index.js +2 -1
- package/build/components/with-select/index.js.map +1 -1
- package/build/controls.js +8 -9
- package/build/controls.js.map +1 -1
- package/build/factory.js +5 -2
- package/build/factory.js.map +1 -1
- package/build/index.js +26 -20
- package/build/index.js.map +1 -1
- package/build/plugins/persistence/index.js.map +1 -1
- package/build/redux-store/index.js +14 -7
- package/build/redux-store/index.js.map +1 -1
- package/build/redux-store/metadata/utils.js.map +1 -1
- package/build/registry.js +21 -16
- package/build/registry.js.map +1 -1
- package/build/resolvers-cache-middleware.js.map +1 -1
- package/build/store/index.js.map +1 -1
- package/build-module/components/async-mode-provider/context.js +2 -1
- package/build-module/components/async-mode-provider/context.js.map +1 -1
- package/build-module/components/use-dispatch/use-dispatch.js +3 -2
- package/build-module/components/use-dispatch/use-dispatch.js.map +1 -1
- package/build-module/components/use-select/index.js +33 -20
- package/build-module/components/use-select/index.js.map +1 -1
- package/build-module/components/with-dispatch/index.js +5 -3
- package/build-module/components/with-dispatch/index.js.map +1 -1
- package/build-module/components/with-registry/index.js.map +1 -1
- package/build-module/components/with-select/index.js +2 -1
- package/build-module/components/with-select/index.js.map +1 -1
- package/build-module/controls.js +5 -5
- package/build-module/controls.js.map +1 -1
- package/build-module/factory.js +5 -2
- package/build-module/factory.js.map +1 -1
- package/build-module/index.js +26 -20
- package/build-module/index.js.map +1 -1
- package/build-module/plugins/persistence/index.js.map +1 -1
- package/build-module/redux-store/index.js +14 -7
- package/build-module/redux-store/index.js.map +1 -1
- package/build-module/redux-store/metadata/utils.js.map +1 -1
- package/build-module/registry.js +17 -12
- package/build-module/registry.js.map +1 -1
- package/build-module/resolvers-cache-middleware.js.map +1 -1
- package/build-module/store/index.js.map +1 -1
- package/build-types/components/async-mode-provider/context.d.ts +5 -0
- package/build-types/components/async-mode-provider/context.d.ts.map +1 -0
- package/build-types/components/async-mode-provider/index.d.ts +3 -0
- package/build-types/components/async-mode-provider/index.d.ts.map +1 -0
- package/build-types/components/async-mode-provider/use-async-mode.d.ts +2 -0
- package/build-types/components/async-mode-provider/use-async-mode.d.ts.map +1 -0
- package/build-types/components/registry-provider/context.d.ts +36 -0
- package/build-types/components/registry-provider/context.d.ts.map +1 -0
- package/build-types/components/registry-provider/index.d.ts +3 -0
- package/build-types/components/registry-provider/index.d.ts.map +1 -0
- package/build-types/components/registry-provider/use-registry.d.ts +41 -0
- package/build-types/components/registry-provider/use-registry.d.ts.map +1 -0
- package/build-types/components/use-dispatch/index.d.ts +3 -0
- package/build-types/components/use-dispatch/index.d.ts.map +1 -0
- package/build-types/components/use-dispatch/use-dispatch-with-map.d.ts +17 -0
- package/build-types/components/use-dispatch/use-dispatch-with-map.d.ts.map +1 -0
- package/build-types/components/use-dispatch/use-dispatch.d.ts +50 -0
- package/build-types/components/use-dispatch/use-dispatch.d.ts.map +1 -0
- package/build-types/components/use-select/index.d.ts +99 -0
- package/build-types/components/use-select/index.d.ts.map +1 -0
- package/build-types/components/with-dispatch/index.d.ts +84 -0
- package/build-types/components/with-dispatch/index.d.ts.map +1 -0
- package/build-types/components/with-registry/index.d.ts +11 -0
- package/build-types/components/with-registry/index.d.ts.map +1 -0
- package/build-types/components/with-select/index.d.ts +43 -0
- package/build-types/components/with-select/index.d.ts.map +1 -0
- package/build-types/controls.d.ts +83 -0
- package/build-types/controls.d.ts.map +1 -0
- package/build-types/default-registry.d.ts +3 -0
- package/build-types/default-registry.d.ts.map +1 -0
- package/build-types/factory.d.ts +63 -0
- package/build-types/factory.d.ts.map +1 -0
- package/build-types/index.d.ts +156 -0
- package/build-types/index.d.ts.map +1 -0
- package/build-types/plugins/index.d.ts +2 -0
- package/build-types/plugins/index.d.ts.map +1 -0
- package/build-types/plugins/persistence/index.d.ts +41 -0
- package/build-types/plugins/persistence/index.d.ts.map +1 -0
- package/build-types/plugins/persistence/storage/default.d.ts +3 -0
- package/build-types/plugins/persistence/storage/default.d.ts.map +1 -0
- package/build-types/plugins/persistence/storage/object.d.ts +10 -0
- package/build-types/plugins/persistence/storage/object.d.ts.map +1 -0
- package/build-types/redux-store/index.d.ts +29 -0
- package/build-types/redux-store/index.d.ts.map +1 -0
- package/build-types/redux-store/metadata/utils.d.ts.map +1 -1
- package/build-types/redux-store/thunk-middleware.d.ts +2 -0
- package/build-types/redux-store/thunk-middleware.d.ts.map +1 -0
- package/build-types/registry.d.ts +56 -0
- package/build-types/registry.d.ts.map +1 -0
- package/build-types/resolvers-cache-middleware.d.ts +15 -0
- package/build-types/resolvers-cache-middleware.d.ts.map +1 -0
- package/build-types/store/index.d.ts +23 -0
- package/build-types/store/index.d.ts.map +1 -0
- package/build-types/types.d.ts +18 -1
- package/build-types/types.d.ts.map +1 -1
- package/package.json +8 -8
- package/src/components/async-mode-provider/context.js +2 -1
- package/src/components/use-dispatch/use-dispatch.js +3 -2
- package/src/components/use-select/index.js +37 -20
- package/src/components/use-select/test/suspense.js +15 -11
- package/src/components/with-dispatch/index.js +5 -3
- package/src/components/with-dispatch/test/index.js +4 -5
- package/src/components/with-registry/index.js +8 -7
- package/src/components/with-select/index.js +2 -1
- package/src/components/with-select/test/index.js +12 -18
- package/src/controls.js +20 -16
- package/src/factory.js +5 -2
- package/src/index.js +26 -20
- package/src/plugins/persistence/index.js +2 -4
- package/src/redux-store/index.js +22 -12
- package/src/redux-store/metadata/test/utils.js +1 -2
- package/src/redux-store/metadata/utils.ts +24 -24
- package/src/redux-store/test/index.js +4 -3
- package/src/registry.js +17 -12
- package/src/resolvers-cache-middleware.js +33 -34
- package/src/store/index.js +10 -6
- package/src/test/registry.js +19 -23
- package/src/types.ts +39 -6
- package/tsconfig.json +4 -2
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
export namespace controls {
|
|
2
|
+
export { select };
|
|
3
|
+
export { resolveSelect };
|
|
4
|
+
export { dispatch };
|
|
5
|
+
}
|
|
6
|
+
export const builtinControls: {
|
|
7
|
+
"@@data/SELECT": Function;
|
|
8
|
+
"@@data/RESOLVE_SELECT": Function;
|
|
9
|
+
"@@data/DISPATCH": Function;
|
|
10
|
+
};
|
|
11
|
+
export type StoreDescriptor = import("./types").StoreDescriptor<any>;
|
|
12
|
+
/**
|
|
13
|
+
* Dispatches a control action for triggering a synchronous registry select.
|
|
14
|
+
*
|
|
15
|
+
* Note: This control synchronously returns the current selector value, triggering the
|
|
16
|
+
* resolution, but not waiting for it.
|
|
17
|
+
*
|
|
18
|
+
* @param {string|StoreDescriptor} storeNameOrDescriptor Unique namespace identifier for the store
|
|
19
|
+
* @param {string} selectorName The name of the selector.
|
|
20
|
+
* @param {Array} args Arguments for the selector.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```js
|
|
24
|
+
* import { controls } from '@wordpress/data';
|
|
25
|
+
*
|
|
26
|
+
* // Action generator using `select`.
|
|
27
|
+
* export function* myAction() {
|
|
28
|
+
* const isEditorSideBarOpened = yield controls.select( 'core/edit-post', 'isEditorSideBarOpened' );
|
|
29
|
+
* // Do stuff with the result from the `select`.
|
|
30
|
+
* }
|
|
31
|
+
* ```
|
|
32
|
+
*
|
|
33
|
+
* @return {Object} The control descriptor.
|
|
34
|
+
*/
|
|
35
|
+
declare function select(storeNameOrDescriptor: string | import("./types").StoreDescriptor<any>, selectorName: string, ...args: any[]): Object;
|
|
36
|
+
/**
|
|
37
|
+
* Dispatches a control action for triggering and resolving a registry select.
|
|
38
|
+
*
|
|
39
|
+
* Note: when this control action is handled, it automatically considers
|
|
40
|
+
* selectors that may have a resolver. In such case, it will return a `Promise` that resolves
|
|
41
|
+
* after the selector finishes resolving, with the final result value.
|
|
42
|
+
*
|
|
43
|
+
* @param {string|StoreDescriptor} storeNameOrDescriptor Unique namespace identifier for the store
|
|
44
|
+
* @param {string} selectorName The name of the selector
|
|
45
|
+
* @param {Array} args Arguments for the selector.
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* ```js
|
|
49
|
+
* import { controls } from '@wordpress/data';
|
|
50
|
+
*
|
|
51
|
+
* // Action generator using resolveSelect
|
|
52
|
+
* export function* myAction() {
|
|
53
|
+
* const isSidebarOpened = yield controls.resolveSelect( 'core/edit-post', 'isEditorSideBarOpened' );
|
|
54
|
+
* // do stuff with the result from the select.
|
|
55
|
+
* }
|
|
56
|
+
* ```
|
|
57
|
+
*
|
|
58
|
+
* @return {Object} The control descriptor.
|
|
59
|
+
*/
|
|
60
|
+
declare function resolveSelect(storeNameOrDescriptor: string | import("./types").StoreDescriptor<any>, selectorName: string, ...args: any[]): Object;
|
|
61
|
+
/**
|
|
62
|
+
* Dispatches a control action for triggering a registry dispatch.
|
|
63
|
+
*
|
|
64
|
+
* @param {string|StoreDescriptor} storeNameOrDescriptor Unique namespace identifier for the store
|
|
65
|
+
* @param {string} actionName The name of the action to dispatch
|
|
66
|
+
* @param {Array} args Arguments for the dispatch action.
|
|
67
|
+
*
|
|
68
|
+
* @example
|
|
69
|
+
* ```js
|
|
70
|
+
* import { controls } from '@wordpress/data-controls';
|
|
71
|
+
*
|
|
72
|
+
* // Action generator using dispatch
|
|
73
|
+
* export function* myAction() {
|
|
74
|
+
* yield controls.dispatch( 'core/edit-post', 'togglePublishSidebar' );
|
|
75
|
+
* // do some other things.
|
|
76
|
+
* }
|
|
77
|
+
* ```
|
|
78
|
+
*
|
|
79
|
+
* @return {Object} The control descriptor.
|
|
80
|
+
*/
|
|
81
|
+
declare function dispatch(storeNameOrDescriptor: string | import("./types").StoreDescriptor<any>, actionName: string, ...args: any[]): Object;
|
|
82
|
+
export {};
|
|
83
|
+
//# sourceMappingURL=controls.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"controls.d.ts","sourceRoot":"","sources":["../src/controls.js"],"names":[],"mappings":";;;;;AAqHA;;;;EAuBE;;AA7HF;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,+CAjBW,MAAM,yCAAgB,gBACtB,MAAM,mBAcL,MAAM,CAWjB;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,sDAjBW,MAAM,yCAAgB,gBACtB,MAAM,mBAcL,MAAM,CAWjB;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,iDAjBW,MAAM,yCAAgB,cACtB,MAAM,mBAcL,MAAM,CAWjB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"default-registry.d.ts","sourceRoot":"","sources":["../src/default-registry.js"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates a selector function that takes additional curried argument with the
|
|
3
|
+
* registry `select` function. While a regular selector has signature
|
|
4
|
+
* ```js
|
|
5
|
+
* ( state, ...selectorArgs ) => ( result )
|
|
6
|
+
* ```
|
|
7
|
+
* that allows to select data from the store's `state`, a registry selector
|
|
8
|
+
* has signature:
|
|
9
|
+
* ```js
|
|
10
|
+
* ( select ) => ( state, ...selectorArgs ) => ( result )
|
|
11
|
+
* ```
|
|
12
|
+
* that supports also selecting from other registered stores.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```js
|
|
16
|
+
* import { store as coreStore } from '@wordpress/core-data';
|
|
17
|
+
* import { store as editorStore } from '@wordpress/editor';
|
|
18
|
+
*
|
|
19
|
+
* const getCurrentPostId = createRegistrySelector( ( select ) => ( state ) => {
|
|
20
|
+
* return select( editorStore ).getCurrentPostId();
|
|
21
|
+
* } );
|
|
22
|
+
*
|
|
23
|
+
* const getPostEdits = createRegistrySelector( ( select ) => ( state ) => {
|
|
24
|
+
* // calling another registry selector just like any other function
|
|
25
|
+
* const postType = getCurrentPostType( state );
|
|
26
|
+
* const postId = getCurrentPostId( state );
|
|
27
|
+
* return select( coreStore ).getEntityRecordEdits( 'postType', postType, postId );
|
|
28
|
+
* } );
|
|
29
|
+
* ```
|
|
30
|
+
*
|
|
31
|
+
* Note how the `getCurrentPostId` selector can be called just like any other function,
|
|
32
|
+
* (it works even inside a regular non-registry selector) and we don't need to pass the
|
|
33
|
+
* registry as argument. The registry binding happens automatically when registering the selector
|
|
34
|
+
* with a store.
|
|
35
|
+
*
|
|
36
|
+
* @param {Function} registrySelector Function receiving a registry `select`
|
|
37
|
+
* function and returning a state selector.
|
|
38
|
+
*
|
|
39
|
+
* @return {Function} Registry selector that can be registered with a store.
|
|
40
|
+
*/
|
|
41
|
+
export function createRegistrySelector(registrySelector: Function): Function;
|
|
42
|
+
/**
|
|
43
|
+
* Creates a control function that takes additional curried argument with the `registry` object.
|
|
44
|
+
* While a regular control has signature
|
|
45
|
+
* ```js
|
|
46
|
+
* ( action ) => ( iteratorOrPromise )
|
|
47
|
+
* ```
|
|
48
|
+
* where the control works with the `action` that it's bound to, a registry control has signature:
|
|
49
|
+
* ```js
|
|
50
|
+
* ( registry ) => ( action ) => ( iteratorOrPromise )
|
|
51
|
+
* ```
|
|
52
|
+
* A registry control is typically used to select data or dispatch an action to a registered
|
|
53
|
+
* store.
|
|
54
|
+
*
|
|
55
|
+
* When registering a control created with `createRegistryControl` with a store, the store
|
|
56
|
+
* knows which calling convention to use when executing the control.
|
|
57
|
+
*
|
|
58
|
+
* @param {Function} registryControl Function receiving a registry object and returning a control.
|
|
59
|
+
*
|
|
60
|
+
* @return {Function} Registry control that can be registered with a store.
|
|
61
|
+
*/
|
|
62
|
+
export function createRegistryControl(registryControl: Function): Function;
|
|
63
|
+
//# sourceMappingURL=factory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../src/factory.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,6EAiBC;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,2EAIC"}
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
export { default as withSelect } from "./components/with-select";
|
|
2
|
+
export { default as withDispatch } from "./components/with-dispatch";
|
|
3
|
+
export { default as withRegistry } from "./components/with-registry";
|
|
4
|
+
export { useDispatch } from "./components/use-dispatch";
|
|
5
|
+
export { AsyncModeProvider } from "./components/async-mode-provider";
|
|
6
|
+
export { createRegistry } from "./registry";
|
|
7
|
+
export { controls } from "./controls";
|
|
8
|
+
export { default as createReduxStore } from "./redux-store";
|
|
9
|
+
/**
|
|
10
|
+
* Given a store descriptor, returns an object of the store's selectors.
|
|
11
|
+
* The selector functions are been pre-bound to pass the current state automatically.
|
|
12
|
+
* As a consumer, you need only pass arguments of the selector, if applicable.
|
|
13
|
+
*
|
|
14
|
+
* @param {StoreDescriptor|string} storeNameOrDescriptor The store descriptor. The legacy calling
|
|
15
|
+
* convention of passing the store name is
|
|
16
|
+
* also supported.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```js
|
|
20
|
+
* import { select } from '@wordpress/data';
|
|
21
|
+
* import { store as myCustomStore } from 'my-custom-store';
|
|
22
|
+
*
|
|
23
|
+
* select( myCustomStore ).getPrice( 'hammer' );
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* @return {Object} Object containing the store's selectors.
|
|
27
|
+
*/
|
|
28
|
+
export const select: Function;
|
|
29
|
+
/**
|
|
30
|
+
* Given a store descriptor, returns an object containing the store's selectors pre-bound to state
|
|
31
|
+
* so that you only need to supply additional arguments, and modified so that they return promises
|
|
32
|
+
* that resolve to their eventual values, after any resolvers have ran.
|
|
33
|
+
*
|
|
34
|
+
* @param {StoreDescriptor|string} storeNameOrDescriptor The store descriptor. The legacy calling
|
|
35
|
+
* convention of passing the store name is
|
|
36
|
+
* also supported.
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* ```js
|
|
40
|
+
* import { resolveSelect } from '@wordpress/data';
|
|
41
|
+
* import { store as myCustomStore } from 'my-custom-store';
|
|
42
|
+
*
|
|
43
|
+
* resolveSelect( myCustomStore ).getPrice( 'hammer' ).then(console.log)
|
|
44
|
+
* ```
|
|
45
|
+
*
|
|
46
|
+
* @return {Object} Object containing the store's promise-wrapped selectors.
|
|
47
|
+
*/
|
|
48
|
+
export const resolveSelect: any;
|
|
49
|
+
/**
|
|
50
|
+
* Given a store descriptor, returns an object containing the store's selectors pre-bound to state
|
|
51
|
+
* so that you only need to supply additional arguments, and modified so that they throw promises
|
|
52
|
+
* in case the selector is not resolved yet.
|
|
53
|
+
*
|
|
54
|
+
* @param {StoreDescriptor|string} storeNameOrDescriptor The store descriptor. The legacy calling
|
|
55
|
+
* convention of passing the store name is
|
|
56
|
+
* also supported.
|
|
57
|
+
*
|
|
58
|
+
* @return {Object} Object containing the store's suspense-wrapped selectors.
|
|
59
|
+
*/
|
|
60
|
+
export const suspendSelect: any;
|
|
61
|
+
/**
|
|
62
|
+
* Given a store descriptor, returns an object of the store's action creators.
|
|
63
|
+
* Calling an action creator will cause it to be dispatched, updating the state value accordingly.
|
|
64
|
+
*
|
|
65
|
+
* Note: Action creators returned by the dispatch will return a promise when
|
|
66
|
+
* they are called.
|
|
67
|
+
*
|
|
68
|
+
* @param {StoreDescriptor|string} storeNameOrDescriptor The store descriptor. The legacy calling
|
|
69
|
+
* convention of passing the store name is
|
|
70
|
+
* also supported.
|
|
71
|
+
*
|
|
72
|
+
* @example
|
|
73
|
+
* ```js
|
|
74
|
+
* import { dispatch } from '@wordpress/data';
|
|
75
|
+
* import { store as myCustomStore } from 'my-custom-store';
|
|
76
|
+
*
|
|
77
|
+
* dispatch( myCustomStore ).setPrice( 'hammer', 9.75 );
|
|
78
|
+
* ```
|
|
79
|
+
* @return {Object} Object containing the action creators.
|
|
80
|
+
*/
|
|
81
|
+
export const dispatch: Function;
|
|
82
|
+
/**
|
|
83
|
+
* Given a listener function, the function will be called any time the state value
|
|
84
|
+
* of one of the registered stores has changed. This function returns a `unsubscribe`
|
|
85
|
+
* function used to stop the subscription.
|
|
86
|
+
*
|
|
87
|
+
* @param {Function} listener Callback function.
|
|
88
|
+
*
|
|
89
|
+
* @example
|
|
90
|
+
* ```js
|
|
91
|
+
* import { subscribe } from '@wordpress/data';
|
|
92
|
+
*
|
|
93
|
+
* const unsubscribe = subscribe( () => {
|
|
94
|
+
* // You could use this opportunity to test whether the derived result of a
|
|
95
|
+
* // selector has subsequently changed as the result of a state update.
|
|
96
|
+
* } );
|
|
97
|
+
*
|
|
98
|
+
* // Later, if necessary...
|
|
99
|
+
* unsubscribe();
|
|
100
|
+
* ```
|
|
101
|
+
*/
|
|
102
|
+
export const subscribe: Function;
|
|
103
|
+
/**
|
|
104
|
+
* Registers a generic store instance.
|
|
105
|
+
*
|
|
106
|
+
* @deprecated Use `register( storeDescriptor )` instead.
|
|
107
|
+
*
|
|
108
|
+
* @param {string} name Store registry name.
|
|
109
|
+
* @param {Object} store Store instance (`{ getSelectors, getActions, subscribe }`).
|
|
110
|
+
*/
|
|
111
|
+
export const registerGenericStore: Function;
|
|
112
|
+
/**
|
|
113
|
+
* Registers a standard `@wordpress/data` store.
|
|
114
|
+
*
|
|
115
|
+
* @deprecated Use `register` instead.
|
|
116
|
+
*
|
|
117
|
+
* @param {string} storeName Unique namespace identifier for the store.
|
|
118
|
+
* @param {Object} options Store description (reducer, actions, selectors, resolvers).
|
|
119
|
+
*
|
|
120
|
+
* @return {Object} Registered store object.
|
|
121
|
+
*/
|
|
122
|
+
export const registerStore: Function;
|
|
123
|
+
/**
|
|
124
|
+
* Extends a registry to inherit functionality provided by a given plugin. A
|
|
125
|
+
* plugin is an object with properties aligning to that of a registry, merged
|
|
126
|
+
* to extend the default registry behavior.
|
|
127
|
+
*
|
|
128
|
+
* @param {Object} plugin Plugin object.
|
|
129
|
+
*/
|
|
130
|
+
export const use: any;
|
|
131
|
+
/**
|
|
132
|
+
* Registers a standard `@wordpress/data` store descriptor.
|
|
133
|
+
*
|
|
134
|
+
* @example
|
|
135
|
+
* ```js
|
|
136
|
+
* import { createReduxStore, register } from '@wordpress/data';
|
|
137
|
+
*
|
|
138
|
+
* const store = createReduxStore( 'demo', {
|
|
139
|
+
* reducer: ( state = 'OK' ) => state,
|
|
140
|
+
* selectors: {
|
|
141
|
+
* getValue: ( state ) => state,
|
|
142
|
+
* },
|
|
143
|
+
* } );
|
|
144
|
+
* register( store );
|
|
145
|
+
* ```
|
|
146
|
+
*
|
|
147
|
+
* @param {StoreDescriptor} store Store descriptor.
|
|
148
|
+
*/
|
|
149
|
+
export const register: any;
|
|
150
|
+
export type StoreDescriptor = import("./types").StoreDescriptor<any>;
|
|
151
|
+
import * as plugins from "./plugins";
|
|
152
|
+
export { plugins, combineReducers };
|
|
153
|
+
export { RegistryProvider, RegistryConsumer, useRegistry } from "./components/registry-provider";
|
|
154
|
+
export { default as useSelect, useSuspenseSelect } from "./components/use-select";
|
|
155
|
+
export { createRegistrySelector, createRegistryControl } from "./factory";
|
|
156
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.js"],"names":[],"mappings":";;;;;;;;AAiFA;;;;;;;;;;;;;;;;;;GAkBG;AACH,8BAA6C;AAE7C;;;;;;;;;;;;;;;;;;GAkBG;AACH,gCAA2D;AAE3D;;;;;;;;;;GAUG;AACH,gCAA2D;AAE3D;;;;;;;;;;;;;;;;;;;GAmBG;AACH,gCAAiD;AAEjD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,iCAAmD;AAEnD;;;;;;;GAOG;AACH,4CAAyE;AAEzE;;;;;;;;;GASG;AACH,qCAA2D;AAE3D;;;;;;GAMG;AACH,sBAAuC;AAEvC;;;;;;;;;;;;;;;;;GAiBG;AACH,2BAAiD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/plugins/index.js"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates a persistence interface, exposing getter and setter methods (`get`
|
|
3
|
+
* and `set` respectively).
|
|
4
|
+
*
|
|
5
|
+
* @param {WPDataPersistencePluginOptions} options Plugin options.
|
|
6
|
+
*
|
|
7
|
+
* @return {Object} Persistence interface.
|
|
8
|
+
*/
|
|
9
|
+
export function createPersistenceInterface(options: WPDataPersistencePluginOptions): Object;
|
|
10
|
+
export function withLazySameState(reducer: Function): Function;
|
|
11
|
+
export default persistencePlugin;
|
|
12
|
+
export type WPDataRegistry = import('../../registry').WPDataRegistry;
|
|
13
|
+
export type WPDataPlugin = import('../../registry').WPDataPlugin;
|
|
14
|
+
/**
|
|
15
|
+
* Persistence plugin options.
|
|
16
|
+
*/
|
|
17
|
+
export type WPDataPersistencePluginOptions = {
|
|
18
|
+
/**
|
|
19
|
+
* Persistent storage implementation. This must
|
|
20
|
+
* at least implement `getItem` and `setItem` of
|
|
21
|
+
* the Web Storage API.
|
|
22
|
+
*/
|
|
23
|
+
storage: Storage;
|
|
24
|
+
/**
|
|
25
|
+
* Key on which to set in persistent storage.
|
|
26
|
+
*/
|
|
27
|
+
storageKey: string;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Data plugin to persist store state into a single storage key.
|
|
31
|
+
*
|
|
32
|
+
* @param {WPDataRegistry} registry Data registry.
|
|
33
|
+
* @param {?WPDataPersistencePluginOptions} pluginOptions Plugin options.
|
|
34
|
+
*
|
|
35
|
+
* @return {WPDataPlugin} Data plugin.
|
|
36
|
+
*/
|
|
37
|
+
declare function persistencePlugin(registry: WPDataRegistry, pluginOptions: WPDataPersistencePluginOptions | null): WPDataPlugin;
|
|
38
|
+
declare namespace persistencePlugin {
|
|
39
|
+
function __unstableMigrate(): void;
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/persistence/index.js"],"names":[],"mappings":"AAwDA;;;;;;;GAOG;AACH,oDAJW,8BAA8B,GAE7B,MAAM,CAiDjB;AA/DM,+DAMN;;6BA3Ca,OAAO,gBAAgB,EAAE,cAAc;2BAEvC,OAAO,gBAAgB,EAAE,YAAY;;;;;;;;;;aAKrC,OAAO;;;;gBAGP,MAAM;;AA4FpB;;;;;;;GAOG;AACH,6CALW,cAAc,iBACb,8BAA8B,UAE9B,YAAY,CAqGvB;;IAED,mCAA8C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"default.d.ts","sourceRoot":"","sources":["../../../../src/plugins/persistence/storage/default.js"],"names":[],"mappings":";AAKA,yBAAY"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export default storage;
|
|
2
|
+
declare namespace storage {
|
|
3
|
+
function getItem(key: any): any;
|
|
4
|
+
function getItem(key: any): any;
|
|
5
|
+
function setItem(key: any, value: any): void;
|
|
6
|
+
function setItem(key: any, value: any): void;
|
|
7
|
+
function clear(): void;
|
|
8
|
+
function clear(): void;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=object.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"object.d.ts","sourceRoot":"","sources":["../../../../src/plugins/persistence/storage/object.js"],"names":[],"mappings":";;IAGC,gCAMC;IAND,gCAMC;IACD,6CAMC;IAND,6CAMC;IACD,uBAEC;IAFD,uBAEC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates a data store descriptor for the provided Redux store configuration containing
|
|
3
|
+
* properties describing reducer, actions, selectors, controls and resolvers.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```js
|
|
7
|
+
* import { createReduxStore } from '@wordpress/data';
|
|
8
|
+
*
|
|
9
|
+
* const store = createReduxStore( 'demo', {
|
|
10
|
+
* reducer: ( state = 'OK' ) => state,
|
|
11
|
+
* selectors: {
|
|
12
|
+
* getValue: ( state ) => state,
|
|
13
|
+
* },
|
|
14
|
+
* } );
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* @template State,Actions,Selectors
|
|
18
|
+
* @param {string} key Unique namespace identifier.
|
|
19
|
+
* @param {ReduxStoreConfig<State,Actions,Selectors>} options Registered store options, with properties
|
|
20
|
+
* describing reducer, actions, selectors,
|
|
21
|
+
* and resolvers.
|
|
22
|
+
*
|
|
23
|
+
* @return {StoreDescriptor<ReduxStoreConfig<State,Actions,Selectors>>} Store Object.
|
|
24
|
+
*/
|
|
25
|
+
export default function createReduxStore<State, Actions, Selectors>(key: string, options: import("../types").ReduxStoreConfig<State, Actions, Selectors>): import("../types").StoreDescriptor<import("../types").ReduxStoreConfig<State, Actions, Selectors>>;
|
|
26
|
+
export type DataRegistry = import('../types').DataRegistry;
|
|
27
|
+
export type StoreDescriptor<C> = import('../types').StoreDescriptor<C>;
|
|
28
|
+
export type ReduxStoreConfig<State, Actions, Selectors> = import('../types').ReduxStoreConfig<State, Actions, Selectors>;
|
|
29
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/redux-store/index.js"],"names":[],"mappings":"AA2EA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,yEAPW,MAAM,+KA8HhB;2BAlMa,OAAO,UAAU,EAAE,YAAY;iCAEhC,OAAO,UAAU,EAAE,eAAe,CAAC,CAAC,CAAC;0DAIrC,OAAO,UAAU,EAAE,gBAAgB,CAAC,KAAK,EAAC,OAAO,EAAC,SAAS,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/redux-store/metadata/utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAEhD;;;;;;GAMG;AACH,eAAO,MAAM,QAAQ,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/redux-store/metadata/utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAEhD;;;;;;GAMG;AACH,eAAO,MAAM,QAAQ,sEAEH,MAAM,oFAwBtB,CAAC;AAEH;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CAAE,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,GAAG,SAAS,aAWzE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"thunk-middleware.d.ts","sourceRoot":"","sources":["../../src/redux-store/thunk-middleware.js"],"names":[],"mappings":"AAAA,oGAQC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates a new store registry, given an optional object of initial store
|
|
3
|
+
* configurations.
|
|
4
|
+
*
|
|
5
|
+
* @param {Object} storeConfigs Initial store configurations.
|
|
6
|
+
* @param {Object?} parent Parent registry.
|
|
7
|
+
*
|
|
8
|
+
* @return {WPDataRegistry} Data registry.
|
|
9
|
+
*/
|
|
10
|
+
export function createRegistry(storeConfigs?: Object, parent?: Object | null): WPDataRegistry;
|
|
11
|
+
export type StoreDescriptor = import("./types").StoreDescriptor<any>;
|
|
12
|
+
/**
|
|
13
|
+
* An isolated orchestrator of store registrations.
|
|
14
|
+
*/
|
|
15
|
+
export type WPDataRegistry = {
|
|
16
|
+
/**
|
|
17
|
+
* Given a namespace key and settings
|
|
18
|
+
* object, registers a new generic
|
|
19
|
+
* store.
|
|
20
|
+
*/
|
|
21
|
+
registerGenericStore: Function;
|
|
22
|
+
/**
|
|
23
|
+
* Given a namespace key and settings
|
|
24
|
+
* object, registers a new namespace
|
|
25
|
+
* store.
|
|
26
|
+
*/
|
|
27
|
+
registerStore: Function;
|
|
28
|
+
/**
|
|
29
|
+
* Given a function callback, invokes
|
|
30
|
+
* the callback on any change to state
|
|
31
|
+
* within any registered store.
|
|
32
|
+
*/
|
|
33
|
+
subscribe: Function;
|
|
34
|
+
/**
|
|
35
|
+
* Given a namespace key, returns an
|
|
36
|
+
* object of the store's registered
|
|
37
|
+
* selectors.
|
|
38
|
+
*/
|
|
39
|
+
select: Function;
|
|
40
|
+
/**
|
|
41
|
+
* Given a namespace key, returns an
|
|
42
|
+
* object of the store's registered
|
|
43
|
+
* action dispatchers.
|
|
44
|
+
*/
|
|
45
|
+
dispatch: Function;
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* An object of registry function overrides.
|
|
49
|
+
*/
|
|
50
|
+
export type WPDataPlugin = {
|
|
51
|
+
/**
|
|
52
|
+
* registers store.
|
|
53
|
+
*/
|
|
54
|
+
registerStore: Function;
|
|
55
|
+
};
|
|
56
|
+
//# sourceMappingURL=registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../src/registry.js"],"names":[],"mappings":"AAiDA;;;;;;;;GAQG;AACH,8CALW,MAAM,WACN,MAAM,UAEL,cAAc,CAiSzB"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export default createResolversCacheMiddleware;
|
|
2
|
+
export type WPDataRegistry = import('./registry').WPDataRegistry;
|
|
3
|
+
/** @typedef {import('./registry').WPDataRegistry} WPDataRegistry */
|
|
4
|
+
/**
|
|
5
|
+
* Creates a middleware handling resolvers cache invalidation.
|
|
6
|
+
*
|
|
7
|
+
* @param {WPDataRegistry} registry The registry reference for which to create
|
|
8
|
+
* the middleware.
|
|
9
|
+
* @param {string} reducerKey The namespace for which to create the
|
|
10
|
+
* middleware.
|
|
11
|
+
*
|
|
12
|
+
* @return {Function} Middleware function.
|
|
13
|
+
*/
|
|
14
|
+
declare function createResolversCacheMiddleware(registry: WPDataRegistry, reducerKey: string): Function;
|
|
15
|
+
//# sourceMappingURL=resolvers-cache-middleware.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolvers-cache-middleware.d.ts","sourceRoot":"","sources":["../src/resolvers-cache-middleware.js"],"names":[],"mappings":";6BAUc,OAAO,YAAY,EAAE,cAAc;AAAjD,oEAAoE;AAEpE;;;;;;;;;GASG;AACH,0DAPW,cAAc,cAEd,MAAM,YAwCf"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export default coreDataStore;
|
|
2
|
+
declare namespace coreDataStore {
|
|
3
|
+
const name: string;
|
|
4
|
+
function instantiate(registry: any): {
|
|
5
|
+
getSelectors(): {
|
|
6
|
+
[k: string]: (key: any, ...args: any[]) => any;
|
|
7
|
+
};
|
|
8
|
+
getActions(): {
|
|
9
|
+
[k: string]: (key: any, ...args: any[]) => any;
|
|
10
|
+
};
|
|
11
|
+
subscribe(): () => () => void;
|
|
12
|
+
};
|
|
13
|
+
function instantiate(registry: any): {
|
|
14
|
+
getSelectors(): {
|
|
15
|
+
[k: string]: (key: any, ...args: any[]) => any;
|
|
16
|
+
};
|
|
17
|
+
getActions(): {
|
|
18
|
+
[k: string]: (key: any, ...args: any[]) => any;
|
|
19
|
+
};
|
|
20
|
+
subscribe(): () => () => void;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/store/index.js"],"names":[],"mappings":";;;IAEC;;;;;;;;MAoDC;IApDD;;;;;;;;MAoDC"}
|
package/build-types/types.d.ts
CHANGED
|
@@ -20,7 +20,7 @@ export interface StoreDescriptor<Config extends AnyConfig> {
|
|
|
20
20
|
*/
|
|
21
21
|
instantiate: (registry: DataRegistry) => StoreInstance<Config>;
|
|
22
22
|
}
|
|
23
|
-
export interface ReduxStoreConfig<State, ActionCreators extends MapOf<ActionCreator>, Selectors
|
|
23
|
+
export interface ReduxStoreConfig<State, ActionCreators extends MapOf<ActionCreator>, Selectors> {
|
|
24
24
|
initialState?: State;
|
|
25
25
|
reducer: (state: any, action: any) => any;
|
|
26
26
|
actions?: ActionCreators;
|
|
@@ -28,6 +28,23 @@ export interface ReduxStoreConfig<State, ActionCreators extends MapOf<ActionCrea
|
|
|
28
28
|
selectors?: Selectors;
|
|
29
29
|
controls?: MapOf<Function>;
|
|
30
30
|
}
|
|
31
|
+
export declare type UseSelectReturn<F extends MapSelect | StoreDescriptor<any>> = F extends MapSelect ? ReturnType<F> : F extends StoreDescriptor<any> ? CurriedSelectorsOf<F> : never;
|
|
32
|
+
export declare type MapSelect = (select: SelectFunction) => any;
|
|
33
|
+
export declare type SelectFunction = <S>(store: S) => CurriedSelectorsOf<S>;
|
|
34
|
+
export declare type CurriedSelectorsOf<S> = S extends StoreDescriptor<ReduxStoreConfig<any, any, infer Selectors>> ? {
|
|
35
|
+
[key in keyof Selectors]: CurriedState<Selectors[key]>;
|
|
36
|
+
} : never;
|
|
37
|
+
/**
|
|
38
|
+
* Removes the first argument from a function
|
|
39
|
+
*
|
|
40
|
+
* This is designed to remove the `state` parameter from
|
|
41
|
+
* registered selectors since that argument is supplied
|
|
42
|
+
* by the editor when calling `select(…)`.
|
|
43
|
+
*
|
|
44
|
+
* For functions with no arguments, which some selectors
|
|
45
|
+
* are free to define, returns the original function.
|
|
46
|
+
*/
|
|
47
|
+
export declare type CurriedState<F> = F extends (state: any, ...args: infer P) => infer R ? (...args: P) => R : F;
|
|
31
48
|
export interface DataRegistry {
|
|
32
49
|
register: (store: StoreDescriptor<any>) => void;
|
|
33
50
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,aAAK,KAAK,CAAE,CAAC,IAAK;IAAE,CAAE,IAAI,EAAE,MAAM,GAAI,CAAC,CAAA;CAAE,CAAC;AAE1C,oBAAY,aAAa,GAAG,QAAQ,GAAG,SAAS,CAAC;AACjD,oBAAY,QAAQ,GAAG,QAAQ,GAAG,SAAS,CAAC;AAC5C,oBAAY,QAAQ,GAAG,QAAQ,CAAC;AAEhC,oBAAY,SAAS,GAAG,gBAAgB,CAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAE,CAAC;AAE1D,MAAM,WAAW,aAAa,CAAE,MAAM,SAAS,SAAS;IACvD,YAAY,EAAE,MAAM,WAAW,CAAE,MAAM,CAAE,CAAC;IAC1C,UAAU,EAAE,MAAM,gBAAgB,CAAE,MAAM,CAAE,CAAC;IAC7C,SAAS,EAAE,CAAE,QAAQ,EAAE,MAAM,IAAI,KAAM,MAAM,IAAI,CAAC;CAClD;AAED,MAAM,WAAW,eAAe,CAAE,MAAM,SAAS,SAAS;IACzD;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,WAAW,EAAE,CAAE,QAAQ,EAAE,YAAY,KAAM,aAAa,CAAE,MAAM,CAAE,CAAC;CACnE;AAED,MAAM,WAAW,gBAAgB,CAChC,KAAK,EACL,cAAc,SAAS,KAAK,CAAE,aAAa,CAAE,EAC7C,SAAS
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"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"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/data",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.13.0",
|
|
4
4
|
"description": "Data module for WordPress.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -28,12 +28,12 @@
|
|
|
28
28
|
"sideEffects": false,
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@babel/runtime": "^7.16.0",
|
|
31
|
-
"@wordpress/compose": "^5.
|
|
32
|
-
"@wordpress/deprecated": "^3.
|
|
33
|
-
"@wordpress/element": "^4.
|
|
34
|
-
"@wordpress/is-shallow-equal": "^4.
|
|
35
|
-
"@wordpress/priority-queue": "^2.
|
|
36
|
-
"@wordpress/redux-routine": "^4.
|
|
31
|
+
"@wordpress/compose": "^5.11.0",
|
|
32
|
+
"@wordpress/deprecated": "^3.13.0",
|
|
33
|
+
"@wordpress/element": "^4.11.0",
|
|
34
|
+
"@wordpress/is-shallow-equal": "^4.13.0",
|
|
35
|
+
"@wordpress/priority-queue": "^2.13.0",
|
|
36
|
+
"@wordpress/redux-routine": "^4.13.0",
|
|
37
37
|
"equivalent-key-map": "^0.2.2",
|
|
38
38
|
"is-promise": "^4.0.0",
|
|
39
39
|
"lodash": "^4.17.21",
|
|
@@ -47,5 +47,5 @@
|
|
|
47
47
|
"publishConfig": {
|
|
48
48
|
"access": "public"
|
|
49
49
|
},
|
|
50
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "9d9d33bbdf317a4381b8ca1713e43bb50df653b3"
|
|
51
51
|
}
|
|
@@ -17,10 +17,11 @@ export const AsyncModeConsumer = Consumer;
|
|
|
17
17
|
*
|
|
18
18
|
* ```js
|
|
19
19
|
* import { useSelect, AsyncModeProvider } from '@wordpress/data';
|
|
20
|
+
* import { store as blockEditorStore } from '@wordpress/block-editor';
|
|
20
21
|
*
|
|
21
22
|
* function BlockCount() {
|
|
22
23
|
* const count = useSelect( ( select ) => {
|
|
23
|
-
* return select(
|
|
24
|
+
* return select( blockEditorStore ).getBlockCount()
|
|
24
25
|
* }, [] );
|
|
25
26
|
*
|
|
26
27
|
* return count;
|