@wordpress/data 10.31.1-next.f56bd8138.0 → 10.32.1-next.47f435fc9.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.
Files changed (158) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/components/async-mode-provider/context.js +35 -54
  3. package/build/components/async-mode-provider/context.js.map +7 -1
  4. package/build/components/async-mode-provider/index.js +40 -25
  5. package/build/components/async-mode-provider/index.js.map +7 -1
  6. package/build/components/async-mode-provider/use-async-mode.js +25 -16
  7. package/build/components/async-mode-provider/use-async-mode.js.map +7 -1
  8. package/build/components/registry-provider/context.js +46 -64
  9. package/build/components/registry-provider/context.js.map +7 -1
  10. package/build/components/registry-provider/index.js +40 -25
  11. package/build/components/registry-provider/index.js.map +7 -1
  12. package/build/components/registry-provider/use-registry.js +25 -55
  13. package/build/components/registry-provider/use-registry.js.map +7 -1
  14. package/build/components/use-dispatch/index.js +38 -17
  15. package/build/components/use-dispatch/index.js.map +7 -1
  16. package/build/components/use-dispatch/use-dispatch-with-map.js +59 -44
  17. package/build/components/use-dispatch/use-dispatch-with-map.js.map +7 -1
  18. package/build/components/use-dispatch/use-dispatch.js +36 -71
  19. package/build/components/use-dispatch/use-dispatch.js.map +7 -1
  20. package/build/components/use-select/index.js +79 -208
  21. package/build/components/use-select/index.js.map +7 -1
  22. package/build/components/with-dispatch/index.js +34 -107
  23. package/build/components/with-dispatch/index.js.map +7 -1
  24. package/build/components/with-registry/index.js +30 -30
  25. package/build/components/with-registry/index.js.map +7 -1
  26. package/build/components/with-select/index.js +44 -67
  27. package/build/components/with-select/index.js.map +7 -1
  28. package/build/controls.js +49 -110
  29. package/build/controls.js.map +7 -1
  30. package/build/create-selector.js +36 -11
  31. package/build/create-selector.js.map +7 -1
  32. package/build/default-registry.js +24 -10
  33. package/build/default-registry.js.map +7 -1
  34. package/build/dispatch.js +38 -31
  35. package/build/dispatch.js.map +7 -1
  36. package/build/factory.js +29 -85
  37. package/build/factory.js.map +7 -1
  38. package/build/index.js +114 -301
  39. package/build/index.js.map +7 -1
  40. package/build/lock-unlock.js +31 -14
  41. package/build/lock-unlock.js.map +7 -1
  42. package/build/plugins/index.js +36 -11
  43. package/build/plugins/index.js.map +7 -1
  44. package/build/plugins/persistence/index.js +74 -139
  45. package/build/plugins/persistence/index.js.map +7 -1
  46. package/build/plugins/persistence/storage/default.js +37 -18
  47. package/build/plugins/persistence/storage/default.js.map +7 -1
  48. package/build/plugins/persistence/storage/object.js +24 -7
  49. package/build/plugins/persistence/storage/object.js.map +7 -1
  50. package/build/promise-middleware.js +37 -20
  51. package/build/promise-middleware.js.map +7 -1
  52. package/build/redux-store/combine-reducers.js +26 -5
  53. package/build/redux-store/combine-reducers.js.map +7 -1
  54. package/build/redux-store/index.js +221 -331
  55. package/build/redux-store/index.js.map +7 -1
  56. package/build/redux-store/metadata/actions.js +51 -112
  57. package/build/redux-store/metadata/actions.js.map +7 -1
  58. package/build/redux-store/metadata/equivalent-key-map.d.js +1 -1
  59. package/build/redux-store/metadata/equivalent-key-map.d.js.map +7 -1
  60. package/build/redux-store/metadata/reducer.js +111 -115
  61. package/build/redux-store/metadata/reducer.js.map +7 -1
  62. package/build/redux-store/metadata/selectors.js +109 -181
  63. package/build/redux-store/metadata/selectors.js.map +7 -1
  64. package/build/redux-store/metadata/utils.js +32 -35
  65. package/build/redux-store/metadata/utils.js.map +7 -1
  66. package/build/redux-store/thunk-middleware.js +24 -7
  67. package/build/redux-store/thunk-middleware.js.map +7 -1
  68. package/build/registry.js +94 -198
  69. package/build/registry.js.map +7 -1
  70. package/build/resolvers-cache-middleware.js +26 -27
  71. package/build/resolvers-cache-middleware.js.map +7 -1
  72. package/build/select.js +38 -31
  73. package/build/select.js.map +7 -1
  74. package/build/store/index.js +52 -16
  75. package/build/store/index.js.map +7 -1
  76. package/build/types.js +16 -5
  77. package/build/types.js.map +7 -1
  78. package/build/utils/emitter.js +33 -16
  79. package/build/utils/emitter.js.map +7 -1
  80. package/build-module/components/async-mode-provider/context.js +12 -49
  81. package/build-module/components/async-mode-provider/context.js.map +7 -1
  82. package/build-module/components/async-mode-provider/index.js +8 -3
  83. package/build-module/components/async-mode-provider/index.js.map +7 -1
  84. package/build-module/components/async-mode-provider/use-async-mode.js +7 -11
  85. package/build-module/components/async-mode-provider/use-async-mode.js.map +7 -1
  86. package/build-module/components/registry-provider/context.js +13 -58
  87. package/build-module/components/registry-provider/context.js.map +7 -1
  88. package/build-module/components/registry-provider/index.js +8 -3
  89. package/build-module/components/registry-provider/index.js.map +7 -1
  90. package/build-module/components/registry-provider/use-registry.js +7 -51
  91. package/build-module/components/registry-provider/use-registry.js.map +7 -1
  92. package/build-module/components/use-dispatch/index.js +7 -3
  93. package/build-module/components/use-dispatch/index.js.map +7 -1
  94. package/build-module/components/use-dispatch/use-dispatch-with-map.js +27 -35
  95. package/build-module/components/use-dispatch/use-dispatch-with-map.js.map +7 -1
  96. package/build-module/components/use-dispatch/use-dispatch.js +8 -66
  97. package/build-module/components/use-dispatch/use-dispatch.js.map +7 -1
  98. package/build-module/components/use-select/index.js +45 -193
  99. package/build-module/components/use-select/index.js.map +7 -1
  100. package/build-module/components/with-dispatch/index.js +16 -104
  101. package/build-module/components/with-dispatch/index.js.map +7 -1
  102. package/build-module/components/with-registry/index.js +12 -27
  103. package/build-module/components/with-registry/index.js.map +7 -1
  104. package/build-module/components/with-select/index.js +16 -63
  105. package/build-module/components/with-select/index.js.map +7 -1
  106. package/build-module/controls.js +25 -105
  107. package/build-module/controls.js.map +7 -1
  108. package/build-module/create-selector.js +5 -8
  109. package/build-module/create-selector.js.map +7 -1
  110. package/build-module/default-registry.js +6 -6
  111. package/build-module/default-registry.js.map +7 -1
  112. package/build-module/dispatch.js +6 -27
  113. package/build-module/dispatch.js.map +7 -1
  114. package/build-module/factory.js +8 -82
  115. package/build-module/factory.js.map +7 -1
  116. package/build-module/index.js +62 -185
  117. package/build-module/index.js.map +7 -1
  118. package/build-module/lock-unlock.js +8 -7
  119. package/build-module/lock-unlock.js.map +7 -1
  120. package/build-module/plugins/index.js +5 -2
  121. package/build-module/plugins/index.js.map +7 -1
  122. package/build-module/plugins/persistence/index.js +38 -129
  123. package/build-module/plugins/persistence/index.js.map +7 -1
  124. package/build-module/plugins/persistence/storage/default.js +8 -11
  125. package/build-module/plugins/persistence/storage/default.js.map +7 -1
  126. package/build-module/plugins/persistence/storage/object.js +6 -3
  127. package/build-module/plugins/persistence/storage/object.js.map +7 -1
  128. package/build-module/promise-middleware.js +8 -14
  129. package/build-module/promise-middleware.js.map +7 -1
  130. package/build-module/redux-store/combine-reducers.js +5 -2
  131. package/build-module/redux-store/combine-reducers.js.map +7 -1
  132. package/build-module/redux-store/index.js +180 -310
  133. package/build-module/redux-store/index.js.map +7 -1
  134. package/build-module/redux-store/metadata/actions.js +30 -109
  135. package/build-module/redux-store/metadata/actions.js.map +7 -1
  136. package/build-module/redux-store/metadata/equivalent-key-map.d.js +1 -2
  137. package/build-module/redux-store/metadata/equivalent-key-map.d.js.map +7 -1
  138. package/build-module/redux-store/metadata/reducer.js +83 -108
  139. package/build-module/redux-store/metadata/reducer.js.map +7 -1
  140. package/build-module/redux-store/metadata/selectors.js +76 -175
  141. package/build-module/redux-store/metadata/selectors.js.map +7 -1
  142. package/build-module/redux-store/metadata/utils.js +10 -30
  143. package/build-module/redux-store/metadata/utils.js.map +7 -1
  144. package/build-module/redux-store/thunk-middleware.js +7 -4
  145. package/build-module/redux-store/thunk-middleware.js.map +7 -1
  146. package/build-module/registry.js +56 -187
  147. package/build-module/registry.js.map +7 -1
  148. package/build-module/resolvers-cache-middleware.js +8 -23
  149. package/build-module/resolvers-cache-middleware.js.map +7 -1
  150. package/build-module/select.js +6 -27
  151. package/build-module/select.js.map +7 -1
  152. package/build-module/store/index.js +34 -12
  153. package/build-module/store/index.js.map +7 -1
  154. package/build-module/types.js +1 -2
  155. package/build-module/types.js.map +7 -1
  156. package/build-module/utils/emitter.js +12 -13
  157. package/build-module/utils/emitter.js.map +7 -1
  158. package/package.json +17 -10
@@ -1 +1,7 @@
1
- {"version":3,"names":["_compose","require","_useDispatch","_jsxRuntime","withDispatch","mapDispatchToProps","createHigherOrderComponent","WrappedComponent","ownProps","mapDispatch","dispatch","registry","dispatchProps","useDispatchWithMap","jsx","_default","exports","default"],"sources":["@wordpress/data/src/components/with-dispatch/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createHigherOrderComponent } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { useDispatchWithMap } from '../use-dispatch';\n\n/** @typedef {import('react').ComponentType} ComponentType */\n\n/**\n * Higher-order component used to add dispatch props using registered action\n * creators.\n *\n * @param {Function} mapDispatchToProps A function of returning an object of\n * prop names where value is a\n * dispatch-bound action creator, or a\n * function to be called with the\n * component's props and returning an\n * action creator.\n *\n * @example\n * ```jsx\n * function Button( { onClick, children } ) {\n * return <button type=\"button\" onClick={ onClick }>{ children }</button>;\n * }\n *\n * import { withDispatch } from '@wordpress/data';\n * import { store as myCustomStore } from 'my-custom-store';\n *\n * const SaleButton = withDispatch( ( dispatch, ownProps ) => {\n * const { startSale } = dispatch( myCustomStore );\n * const { discountPercent } = ownProps;\n *\n * return {\n * onClick() {\n * startSale( discountPercent );\n * },\n * };\n * } )( Button );\n *\n * // Rendered in the application:\n * //\n * // <SaleButton discountPercent=\"20\">Start Sale!</SaleButton>\n * ```\n *\n * @example\n * In the majority of cases, it will be sufficient to use only two first params\n * passed to `mapDispatchToProps` as illustrated in the previous example.\n * However, there might be some very advanced use cases where using the\n * `registry` object might be used as a tool to optimize the performance of\n * your component. Using `select` function from the registry might be useful\n * when you need to fetch some dynamic data from the store at the time when the\n * event is fired, but at the same time, you never use it to render your\n * component. In such scenario, you can avoid using the `withSelect` higher\n * order component to compute such prop, which might lead to unnecessary\n * re-renders of your component caused by its frequent value change.\n * Keep in mind, that `mapDispatchToProps` must return an object with functions\n * only.\n *\n * ```jsx\n * function Button( { onClick, children } ) {\n * return <button type=\"button\" onClick={ onClick }>{ children }</button>;\n * }\n *\n * import { withDispatch } from '@wordpress/data';\n * import { store as myCustomStore } from 'my-custom-store';\n *\n * const SaleButton = withDispatch( ( dispatch, ownProps, { select } ) => {\n * // Stock number changes frequently.\n * const { getStockNumber } = select( myCustomStore );\n * const { startSale } = dispatch( myCustomStore );\n * return {\n * onClick() {\n * const discountPercent = getStockNumber() > 50 ? 10 : 20;\n * startSale( discountPercent );\n * },\n * };\n * } )( Button );\n *\n * // Rendered in the application:\n * //\n * // <SaleButton>Start Sale!</SaleButton>\n * ```\n *\n * _Note:_ It is important that the `mapDispatchToProps` function always\n * returns an object with the same keys. For example, it should not contain\n * conditions under which a different value would be returned.\n *\n * @return {ComponentType} Enhanced component with merged dispatcher props.\n */\nconst withDispatch = ( mapDispatchToProps ) =>\n\tcreateHigherOrderComponent(\n\t\t( WrappedComponent ) => ( ownProps ) => {\n\t\t\tconst mapDispatch = ( dispatch, registry ) =>\n\t\t\t\tmapDispatchToProps( dispatch, ownProps, registry );\n\t\t\tconst dispatchProps = useDispatchWithMap( mapDispatch, [] );\n\t\t\treturn <WrappedComponent { ...ownProps } { ...dispatchProps } />;\n\t\t},\n\t\t'withDispatch'\n\t);\n\nexport default withDispatch;\n"],"mappings":";;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AAKA,IAAAC,YAAA,GAAAD,OAAA;AAAqD,IAAAE,WAAA,GAAAF,OAAA;AARrD;AACA;AACA;;AAGA;AACA;AACA;;AAGA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GACA,MAAMG,YAAY,GAAKC,kBAAkB,IACxC,IAAAC,mCAA0B,EACvBC,gBAAgB,IAAQC,QAAQ,IAAM;EACvC,MAAMC,WAAW,GAAGA,CAAEC,QAAQ,EAAEC,QAAQ,KACvCN,kBAAkB,CAAEK,QAAQ,EAAEF,QAAQ,EAAEG,QAAS,CAAC;EACnD,MAAMC,aAAa,GAAG,IAAAC,+BAAkB,EAAEJ,WAAW,EAAE,EAAG,CAAC;EAC3D,oBAAO,IAAAN,WAAA,CAAAW,GAAA,EAACP,gBAAgB;IAAA,GAAMC,QAAQ;IAAA,GAAQI;EAAa,CAAI,CAAC;AACjE,CAAC,EACD,cACD,CAAC;AAAC,IAAAG,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEYb,YAAY","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/components/with-dispatch/index.js"],
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { createHigherOrderComponent } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { useDispatchWithMap } from '../use-dispatch';\n\n/** @typedef {import('react').ComponentType} ComponentType */\n\n/**\n * Higher-order component used to add dispatch props using registered action\n * creators.\n *\n * @param {Function} mapDispatchToProps A function of returning an object of\n * prop names where value is a\n * dispatch-bound action creator, or a\n * function to be called with the\n * component's props and returning an\n * action creator.\n *\n * @example\n * ```jsx\n * function Button( { onClick, children } ) {\n * return <button type=\"button\" onClick={ onClick }>{ children }</button>;\n * }\n *\n * import { withDispatch } from '@wordpress/data';\n * import { store as myCustomStore } from 'my-custom-store';\n *\n * const SaleButton = withDispatch( ( dispatch, ownProps ) => {\n * const { startSale } = dispatch( myCustomStore );\n * const { discountPercent } = ownProps;\n *\n * return {\n * onClick() {\n * startSale( discountPercent );\n * },\n * };\n * } )( Button );\n *\n * // Rendered in the application:\n * //\n * // <SaleButton discountPercent=\"20\">Start Sale!</SaleButton>\n * ```\n *\n * @example\n * In the majority of cases, it will be sufficient to use only two first params\n * passed to `mapDispatchToProps` as illustrated in the previous example.\n * However, there might be some very advanced use cases where using the\n * `registry` object might be used as a tool to optimize the performance of\n * your component. Using `select` function from the registry might be useful\n * when you need to fetch some dynamic data from the store at the time when the\n * event is fired, but at the same time, you never use it to render your\n * component. In such scenario, you can avoid using the `withSelect` higher\n * order component to compute such prop, which might lead to unnecessary\n * re-renders of your component caused by its frequent value change.\n * Keep in mind, that `mapDispatchToProps` must return an object with functions\n * only.\n *\n * ```jsx\n * function Button( { onClick, children } ) {\n * return <button type=\"button\" onClick={ onClick }>{ children }</button>;\n * }\n *\n * import { withDispatch } from '@wordpress/data';\n * import { store as myCustomStore } from 'my-custom-store';\n *\n * const SaleButton = withDispatch( ( dispatch, ownProps, { select } ) => {\n * // Stock number changes frequently.\n * const { getStockNumber } = select( myCustomStore );\n * const { startSale } = dispatch( myCustomStore );\n * return {\n * onClick() {\n * const discountPercent = getStockNumber() > 50 ? 10 : 20;\n * startSale( discountPercent );\n * },\n * };\n * } )( Button );\n *\n * // Rendered in the application:\n * //\n * // <SaleButton>Start Sale!</SaleButton>\n * ```\n *\n * _Note:_ It is important that the `mapDispatchToProps` function always\n * returns an object with the same keys. For example, it should not contain\n * conditions under which a different value would be returned.\n *\n * @return {ComponentType} Enhanced component with merged dispatcher props.\n */\nconst withDispatch = ( mapDispatchToProps ) =>\n\tcreateHigherOrderComponent(\n\t\t( WrappedComponent ) => ( ownProps ) => {\n\t\t\tconst mapDispatch = ( dispatch, registry ) =>\n\t\t\t\tmapDispatchToProps( dispatch, ownProps, registry );\n\t\t\tconst dispatchProps = useDispatchWithMap( mapDispatch, [] );\n\t\t\treturn <WrappedComponent { ...ownProps } { ...dispatchProps } />;\n\t\t},\n\t\t'withDispatch'\n\t);\n\nexport default withDispatch;\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAmGU;AAhGV,qBAA2C;AAK3C,0BAAmC;AAqFnC,MAAM,eAAe,CAAE,2BACtB;AAAA,EACC,CAAE,qBAAsB,CAAE,aAAc;AACvC,UAAM,cAAc,CAAE,UAAU,aAC/B,mBAAoB,UAAU,UAAU,QAAS;AAClD,UAAM,oBAAgB,wCAAoB,aAAa,CAAC,CAAE;AAC1D,WAAO,4CAAC,oBAAmB,GAAG,UAAa,GAAG,eAAgB;AAAA,EAC/D;AAAA,EACA;AACD;AAED,IAAO,wBAAQ;",
6
+ "names": []
7
+ }
@@ -1,32 +1,32 @@
1
1
  "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var with_registry_exports = {};
20
+ __export(with_registry_exports, {
21
+ default: () => with_registry_default
5
22
  });
6
- exports.default = void 0;
7
- var _compose = require("@wordpress/compose");
8
- var _registryProvider = require("../registry-provider");
9
- var _jsxRuntime = require("react/jsx-runtime");
10
- /**
11
- * WordPress dependencies
12
- */
13
-
14
- /**
15
- * Internal dependencies
16
- */
17
-
18
- /**
19
- * Higher-order component which renders the original component with the current
20
- * registry context passed as its `registry` prop.
21
- *
22
- * @param {Component} OriginalComponent Original component.
23
- *
24
- * @return {Component} Enhanced component.
25
- */const withRegistry = (0, _compose.createHigherOrderComponent)(OriginalComponent => props => /*#__PURE__*/(0, _jsxRuntime.jsx)(_registryProvider.RegistryConsumer, {
26
- children: registry => /*#__PURE__*/(0, _jsxRuntime.jsx)(OriginalComponent, {
27
- ...props,
28
- registry: registry
29
- })
30
- }), 'withRegistry');
31
- var _default = exports.default = withRegistry;
32
- //# sourceMappingURL=index.js.map
23
+ module.exports = __toCommonJS(with_registry_exports);
24
+ var import_jsx_runtime = require("react/jsx-runtime");
25
+ var import_compose = require("@wordpress/compose");
26
+ var import_registry_provider = require("../registry-provider");
27
+ const withRegistry = (0, import_compose.createHigherOrderComponent)(
28
+ (OriginalComponent) => (props) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_registry_provider.RegistryConsumer, { children: (registry) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(OriginalComponent, { ...props, registry }) }),
29
+ "withRegistry"
30
+ );
31
+ var with_registry_default = withRegistry;
32
+ //# sourceMappingURL=index.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["_compose","require","_registryProvider","_jsxRuntime","withRegistry","createHigherOrderComponent","OriginalComponent","props","jsx","RegistryConsumer","children","registry","_default","exports","default"],"sources":["@wordpress/data/src/components/with-registry/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createHigherOrderComponent } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { RegistryConsumer } from '../registry-provider';\n\n/**\n * Higher-order component which renders the original component with the current\n * registry context passed as its `registry` prop.\n *\n * @param {Component} OriginalComponent Original component.\n *\n * @return {Component} Enhanced component.\n */\nconst withRegistry = createHigherOrderComponent(\n\t( OriginalComponent ) => ( props ) => (\n\t\t<RegistryConsumer>\n\t\t\t{ ( registry ) => (\n\t\t\t\t<OriginalComponent { ...props } registry={ registry } />\n\t\t\t) }\n\t\t</RegistryConsumer>\n\t),\n\t'withRegistry'\n);\n\nexport default withRegistry;\n"],"mappings":";;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AAKA,IAAAC,iBAAA,GAAAD,OAAA;AAAwD,IAAAE,WAAA,GAAAF,OAAA;AARxD;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GACA,MAAMG,YAAY,GAAG,IAAAC,mCAA0B,EAC5CC,iBAAiB,IAAQC,KAAK,iBAC/B,IAAAJ,WAAA,CAAAK,GAAA,EAACN,iBAAA,CAAAO,gBAAgB;EAAAC,QAAA,EACZC,QAAQ,iBACX,IAAAR,WAAA,CAAAK,GAAA,EAACF,iBAAiB;IAAA,GAAMC,KAAK;IAAGI,QAAQ,EAAGA;EAAU,CAAE;AACvD,CACgB,CAClB,EACD,cACD,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEaV,YAAY","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/components/with-registry/index.js"],
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { createHigherOrderComponent } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { RegistryConsumer } from '../registry-provider';\n\n/**\n * Higher-order component which renders the original component with the current\n * registry context passed as its `registry` prop.\n *\n * @param {Component} OriginalComponent Original component.\n *\n * @return {Component} Enhanced component.\n */\nconst withRegistry = createHigherOrderComponent(\n\t( OriginalComponent ) => ( props ) => (\n\t\t<RegistryConsumer>\n\t\t\t{ ( registry ) => (\n\t\t\t\t<OriginalComponent { ...props } registry={ registry } />\n\t\t\t) }\n\t\t</RegistryConsumer>\n\t),\n\t'withRegistry'\n);\n\nexport default withRegistry;\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAsBI;AAnBJ,qBAA2C;AAK3C,+BAAiC;AAUjC,MAAM,mBAAe;AAAA,EACpB,CAAE,sBAAuB,CAAE,UAC1B,4CAAC,6CACE,WAAE,aACH,4CAAC,qBAAoB,GAAG,OAAQ,UAAsB,GAExD;AAAA,EAED;AACD;AAEA,IAAO,wBAAQ;",
6
+ "names": []
7
+ }
@@ -1,69 +1,46 @@
1
1
  "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var with_select_exports = {};
30
+ __export(with_select_exports, {
31
+ default: () => with_select_default
6
32
  });
7
- exports.default = void 0;
8
- var _compose = require("@wordpress/compose");
9
- var _useSelect = _interopRequireDefault(require("../use-select"));
10
- var _jsxRuntime = require("react/jsx-runtime");
11
- /**
12
- * WordPress dependencies
13
- */
14
-
15
- /**
16
- * Internal dependencies
17
- */
18
-
19
- /** @typedef {import('react').ComponentType} ComponentType */
20
-
21
- /**
22
- * Higher-order component used to inject state-derived props using registered
23
- * selectors.
24
- *
25
- * @param {Function} mapSelectToProps Function called on every state change,
26
- * expected to return object of props to
27
- * merge with the component's own props.
28
- *
29
- * @example
30
- * ```js
31
- * import { withSelect } from '@wordpress/data';
32
- * import { store as myCustomStore } from 'my-custom-store';
33
- *
34
- * function PriceDisplay( { price, currency } ) {
35
- * return new Intl.NumberFormat( 'en-US', {
36
- * style: 'currency',
37
- * currency,
38
- * } ).format( price );
39
- * }
40
- *
41
- * const HammerPriceDisplay = withSelect( ( select, ownProps ) => {
42
- * const { getPrice } = select( myCustomStore );
43
- * const { currency } = ownProps;
44
- *
45
- * return {
46
- * price: getPrice( 'hammer', currency ),
47
- * };
48
- * } )( PriceDisplay );
49
- *
50
- * // Rendered in the application:
51
- * //
52
- * // <HammerPriceDisplay currency="USD" />
53
- * ```
54
- * In the above example, when `HammerPriceDisplay` is rendered into an
55
- * application, it will pass the price into the underlying `PriceDisplay`
56
- * component and update automatically if the price of a hammer ever changes in
57
- * the store.
58
- *
59
- * @return {ComponentType} Enhanced component with merged state data props.
60
- */const withSelect = mapSelectToProps => (0, _compose.createHigherOrderComponent)(WrappedComponent => (0, _compose.pure)(ownProps => {
61
- const mapSelect = (select, registry) => mapSelectToProps(select, ownProps, registry);
62
- const mergeProps = (0, _useSelect.default)(mapSelect);
63
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(WrappedComponent, {
64
- ...ownProps,
65
- ...mergeProps
66
- });
67
- }), 'withSelect');
68
- var _default = exports.default = withSelect;
69
- //# sourceMappingURL=index.js.map
33
+ module.exports = __toCommonJS(with_select_exports);
34
+ var import_jsx_runtime = require("react/jsx-runtime");
35
+ var import_compose = require("@wordpress/compose");
36
+ var import_use_select = __toESM(require("../use-select"));
37
+ const withSelect = (mapSelectToProps) => (0, import_compose.createHigherOrderComponent)(
38
+ (WrappedComponent) => (0, import_compose.pure)((ownProps) => {
39
+ const mapSelect = (select, registry) => mapSelectToProps(select, ownProps, registry);
40
+ const mergeProps = (0, import_use_select.default)(mapSelect);
41
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(WrappedComponent, { ...ownProps, ...mergeProps });
42
+ }),
43
+ "withSelect"
44
+ );
45
+ var with_select_default = withSelect;
46
+ //# sourceMappingURL=index.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["_compose","require","_useSelect","_interopRequireDefault","_jsxRuntime","withSelect","mapSelectToProps","createHigherOrderComponent","WrappedComponent","pure","ownProps","mapSelect","select","registry","mergeProps","useSelect","jsx","_default","exports","default"],"sources":["@wordpress/data/src/components/with-select/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createHigherOrderComponent, pure } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport useSelect from '../use-select';\n\n/** @typedef {import('react').ComponentType} ComponentType */\n\n/**\n * Higher-order component used to inject state-derived props using registered\n * selectors.\n *\n * @param {Function} mapSelectToProps Function called on every state change,\n * expected to return object of props to\n * merge with the component's own props.\n *\n * @example\n * ```js\n * import { withSelect } from '@wordpress/data';\n * import { store as myCustomStore } from 'my-custom-store';\n *\n * function PriceDisplay( { price, currency } ) {\n * \treturn new Intl.NumberFormat( 'en-US', {\n * \t\tstyle: 'currency',\n * \t\tcurrency,\n * \t} ).format( price );\n * }\n *\n * const HammerPriceDisplay = withSelect( ( select, ownProps ) => {\n * \tconst { getPrice } = select( myCustomStore );\n * \tconst { currency } = ownProps;\n *\n * \treturn {\n * \t\tprice: getPrice( 'hammer', currency ),\n * \t};\n * } )( PriceDisplay );\n *\n * // Rendered in the application:\n * //\n * // <HammerPriceDisplay currency=\"USD\" />\n * ```\n * In the above example, when `HammerPriceDisplay` is rendered into an\n * application, it will pass the price into the underlying `PriceDisplay`\n * component and update automatically if the price of a hammer ever changes in\n * the store.\n *\n * @return {ComponentType} Enhanced component with merged state data props.\n */\nconst withSelect = ( mapSelectToProps ) =>\n\tcreateHigherOrderComponent(\n\t\t( WrappedComponent ) =>\n\t\t\tpure( ( ownProps ) => {\n\t\t\t\tconst mapSelect = ( select, registry ) =>\n\t\t\t\t\tmapSelectToProps( select, ownProps, registry );\n\t\t\t\tconst mergeProps = useSelect( mapSelect );\n\t\t\t\treturn <WrappedComponent { ...ownProps } { ...mergeProps } />;\n\t\t\t} ),\n\t\t'withSelect'\n\t);\n\nexport default withSelect;\n"],"mappings":";;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AAKA,IAAAC,UAAA,GAAAC,sBAAA,CAAAF,OAAA;AAAsC,IAAAG,WAAA,GAAAH,OAAA;AARtC;AACA;AACA;;AAGA;AACA;AACA;;AAGA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GACA,MAAMI,UAAU,GAAKC,gBAAgB,IACpC,IAAAC,mCAA0B,EACvBC,gBAAgB,IACjB,IAAAC,aAAI,EAAIC,QAAQ,IAAM;EACrB,MAAMC,SAAS,GAAGA,CAAEC,MAAM,EAAEC,QAAQ,KACnCP,gBAAgB,CAAEM,MAAM,EAAEF,QAAQ,EAAEG,QAAS,CAAC;EAC/C,MAAMC,UAAU,GAAG,IAAAC,kBAAS,EAAEJ,SAAU,CAAC;EACzC,oBAAO,IAAAP,WAAA,CAAAY,GAAA,EAACR,gBAAgB;IAAA,GAAME,QAAQ;IAAA,GAAQI;EAAU,CAAI,CAAC;AAC9D,CAAE,CAAC,EACJ,YACD,CAAC;AAAC,IAAAG,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEYd,UAAU","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/components/with-select/index.js"],
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { createHigherOrderComponent, pure } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport useSelect from '../use-select';\n\n/** @typedef {import('react').ComponentType} ComponentType */\n\n/**\n * Higher-order component used to inject state-derived props using registered\n * selectors.\n *\n * @param {Function} mapSelectToProps Function called on every state change,\n * expected to return object of props to\n * merge with the component's own props.\n *\n * @example\n * ```js\n * import { withSelect } from '@wordpress/data';\n * import { store as myCustomStore } from 'my-custom-store';\n *\n * function PriceDisplay( { price, currency } ) {\n * \treturn new Intl.NumberFormat( 'en-US', {\n * \t\tstyle: 'currency',\n * \t\tcurrency,\n * \t} ).format( price );\n * }\n *\n * const HammerPriceDisplay = withSelect( ( select, ownProps ) => {\n * \tconst { getPrice } = select( myCustomStore );\n * \tconst { currency } = ownProps;\n *\n * \treturn {\n * \t\tprice: getPrice( 'hammer', currency ),\n * \t};\n * } )( PriceDisplay );\n *\n * // Rendered in the application:\n * //\n * // <HammerPriceDisplay currency=\"USD\" />\n * ```\n * In the above example, when `HammerPriceDisplay` is rendered into an\n * application, it will pass the price into the underlying `PriceDisplay`\n * component and update automatically if the price of a hammer ever changes in\n * the store.\n *\n * @return {ComponentType} Enhanced component with merged state data props.\n */\nconst withSelect = ( mapSelectToProps ) =>\n\tcreateHigherOrderComponent(\n\t\t( WrappedComponent ) =>\n\t\t\tpure( ( ownProps ) => {\n\t\t\t\tconst mapSelect = ( select, registry ) =>\n\t\t\t\t\tmapSelectToProps( select, ownProps, registry );\n\t\t\t\tconst mergeProps = useSelect( mapSelect );\n\t\t\t\treturn <WrappedComponent { ...ownProps } { ...mergeProps } />;\n\t\t\t} ),\n\t\t'withSelect'\n\t);\n\nexport default withSelect;\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA2DW;AAxDX,qBAAiD;AAKjD,wBAAsB;AA4CtB,MAAM,aAAa,CAAE,yBACpB;AAAA,EACC,CAAE,yBACD,qBAAM,CAAE,aAAc;AACrB,UAAM,YAAY,CAAE,QAAQ,aAC3B,iBAAkB,QAAQ,UAAU,QAAS;AAC9C,UAAM,iBAAa,kBAAAA,SAAW,SAAU;AACxC,WAAO,4CAAC,oBAAmB,GAAG,UAAa,GAAG,YAAa;AAAA,EAC5D,CAAE;AAAA,EACH;AACD;AAED,IAAO,sBAAQ;",
6
+ "names": ["useSelect"]
7
+ }
package/build/controls.js CHANGED
@@ -1,46 +1,34 @@
1
1
  "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var controls_exports = {};
20
+ __export(controls_exports, {
21
+ builtinControls: () => builtinControls,
22
+ controls: () => controls
5
23
  });
6
- exports.controls = exports.builtinControls = void 0;
7
- var _factory = require("./factory");
8
- /**
9
- * Internal dependencies
10
- */
11
-
12
- /** @typedef {import('./types').StoreDescriptor} StoreDescriptor */
13
-
14
- const SELECT = '@@data/SELECT';
15
- const RESOLVE_SELECT = '@@data/RESOLVE_SELECT';
16
- const DISPATCH = '@@data/DISPATCH';
24
+ module.exports = __toCommonJS(controls_exports);
25
+ var import_factory = require("./factory");
26
+ const SELECT = "@@data/SELECT";
27
+ const RESOLVE_SELECT = "@@data/RESOLVE_SELECT";
28
+ const DISPATCH = "@@data/DISPATCH";
17
29
  function isObject(object) {
18
- return object !== null && typeof object === 'object';
30
+ return object !== null && typeof object === "object";
19
31
  }
20
-
21
- /**
22
- * Dispatches a control action for triggering a synchronous registry select.
23
- *
24
- * Note: This control synchronously returns the current selector value, triggering the
25
- * resolution, but not waiting for it.
26
- *
27
- * @param {string|StoreDescriptor} storeNameOrDescriptor Unique namespace identifier for the store
28
- * @param {string} selectorName The name of the selector.
29
- * @param {Array} args Arguments for the selector.
30
- *
31
- * @example
32
- * ```js
33
- * import { controls } from '@wordpress/data';
34
- *
35
- * // Action generator using `select`.
36
- * export function* myAction() {
37
- * const isEditorSideBarOpened = yield controls.select( 'core/edit-post', 'isEditorSideBarOpened' );
38
- * // Do stuff with the result from the `select`.
39
- * }
40
- * ```
41
- *
42
- * @return {Object} The control descriptor.
43
- */
44
32
  function select(storeNameOrDescriptor, selectorName, ...args) {
45
33
  return {
46
34
  type: SELECT,
@@ -49,31 +37,6 @@ function select(storeNameOrDescriptor, selectorName, ...args) {
49
37
  args
50
38
  };
51
39
  }
52
-
53
- /**
54
- * Dispatches a control action for triggering and resolving a registry select.
55
- *
56
- * Note: when this control action is handled, it automatically considers
57
- * selectors that may have a resolver. In such case, it will return a `Promise` that resolves
58
- * after the selector finishes resolving, with the final result value.
59
- *
60
- * @param {string|StoreDescriptor} storeNameOrDescriptor Unique namespace identifier for the store
61
- * @param {string} selectorName The name of the selector
62
- * @param {Array} args Arguments for the selector.
63
- *
64
- * @example
65
- * ```js
66
- * import { controls } from '@wordpress/data';
67
- *
68
- * // Action generator using resolveSelect
69
- * export function* myAction() {
70
- * const isSidebarOpened = yield controls.resolveSelect( 'core/edit-post', 'isEditorSideBarOpened' );
71
- * // do stuff with the result from the select.
72
- * }
73
- * ```
74
- *
75
- * @return {Object} The control descriptor.
76
- */
77
40
  function resolveSelect(storeNameOrDescriptor, selectorName, ...args) {
78
41
  return {
79
42
  type: RESOLVE_SELECT,
@@ -82,27 +45,6 @@ function resolveSelect(storeNameOrDescriptor, selectorName, ...args) {
82
45
  args
83
46
  };
84
47
  }
85
-
86
- /**
87
- * Dispatches a control action for triggering a registry dispatch.
88
- *
89
- * @param {string|StoreDescriptor} storeNameOrDescriptor Unique namespace identifier for the store
90
- * @param {string} actionName The name of the action to dispatch
91
- * @param {Array} args Arguments for the dispatch action.
92
- *
93
- * @example
94
- * ```js
95
- * import { controls } from '@wordpress/data-controls';
96
- *
97
- * // Action generator using dispatch
98
- * export function* myAction() {
99
- * yield controls.dispatch( 'core/editor', 'togglePublishSidebar' );
100
- * // do some other things.
101
- * }
102
- * ```
103
- *
104
- * @return {Object} The control descriptor.
105
- */
106
48
  function dispatch(storeNameOrDescriptor, actionName, ...args) {
107
49
  return {
108
50
  type: DISPATCH,
@@ -111,29 +53,26 @@ function dispatch(storeNameOrDescriptor, actionName, ...args) {
111
53
  args
112
54
  };
113
55
  }
114
- const controls = exports.controls = {
115
- select,
116
- resolveSelect,
117
- dispatch
118
- };
119
- const builtinControls = exports.builtinControls = {
120
- [SELECT]: (0, _factory.createRegistryControl)(registry => ({
121
- storeKey,
122
- selectorName,
123
- args
124
- }) => registry.select(storeKey)[selectorName](...args)),
125
- [RESOLVE_SELECT]: (0, _factory.createRegistryControl)(registry => ({
126
- storeKey,
127
- selectorName,
128
- args
129
- }) => {
130
- const method = registry.select(storeKey)[selectorName].hasResolver ? 'resolveSelect' : 'select';
131
- return registry[method](storeKey)[selectorName](...args);
132
- }),
133
- [DISPATCH]: (0, _factory.createRegistryControl)(registry => ({
134
- storeKey,
135
- actionName,
136
- args
137
- }) => registry.dispatch(storeKey)[actionName](...args))
56
+ const controls = { select, resolveSelect, dispatch };
57
+ const builtinControls = {
58
+ [SELECT]: (0, import_factory.createRegistryControl)(
59
+ (registry) => ({ storeKey, selectorName, args }) => registry.select(storeKey)[selectorName](...args)
60
+ ),
61
+ [RESOLVE_SELECT]: (0, import_factory.createRegistryControl)(
62
+ (registry) => ({ storeKey, selectorName, args }) => {
63
+ const method = registry.select(storeKey)[selectorName].hasResolver ? "resolveSelect" : "select";
64
+ return registry[method](storeKey)[selectorName](
65
+ ...args
66
+ );
67
+ }
68
+ ),
69
+ [DISPATCH]: (0, import_factory.createRegistryControl)(
70
+ (registry) => ({ storeKey, actionName, args }) => registry.dispatch(storeKey)[actionName](...args)
71
+ )
138
72
  };
139
- //# sourceMappingURL=controls.js.map
73
+ // Annotate the CommonJS export names for ESM import in node:
74
+ 0 && (module.exports = {
75
+ builtinControls,
76
+ controls
77
+ });
78
+ //# sourceMappingURL=controls.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["_factory","require","SELECT","RESOLVE_SELECT","DISPATCH","isObject","object","select","storeNameOrDescriptor","selectorName","args","type","storeKey","name","resolveSelect","dispatch","actionName","controls","exports","builtinControls","createRegistryControl","registry","method","hasResolver"],"sources":["@wordpress/data/src/controls.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport { createRegistryControl } from './factory';\n\n/** @typedef {import('./types').StoreDescriptor} StoreDescriptor */\n\nconst SELECT = '@@data/SELECT';\nconst RESOLVE_SELECT = '@@data/RESOLVE_SELECT';\nconst DISPATCH = '@@data/DISPATCH';\n\nfunction isObject( object ) {\n\treturn object !== null && typeof object === 'object';\n}\n\n/**\n * Dispatches a control action for triggering a synchronous registry select.\n *\n * Note: This control synchronously returns the current selector value, triggering the\n * resolution, but not waiting for it.\n *\n * @param {string|StoreDescriptor} storeNameOrDescriptor Unique namespace identifier for the store\n * @param {string} selectorName The name of the selector.\n * @param {Array} args Arguments for the selector.\n *\n * @example\n * ```js\n * import { controls } from '@wordpress/data';\n *\n * // Action generator using `select`.\n * export function* myAction() {\n * const isEditorSideBarOpened = yield controls.select( 'core/edit-post', 'isEditorSideBarOpened' );\n * // Do stuff with the result from the `select`.\n * }\n * ```\n *\n * @return {Object} The control descriptor.\n */\nfunction select( storeNameOrDescriptor, selectorName, ...args ) {\n\treturn {\n\t\ttype: SELECT,\n\t\tstoreKey: isObject( storeNameOrDescriptor )\n\t\t\t? storeNameOrDescriptor.name\n\t\t\t: storeNameOrDescriptor,\n\t\tselectorName,\n\t\targs,\n\t};\n}\n\n/**\n * Dispatches a control action for triggering and resolving a registry select.\n *\n * Note: when this control action is handled, it automatically considers\n * selectors that may have a resolver. In such case, it will return a `Promise` that resolves\n * after the selector finishes resolving, with the final result value.\n *\n * @param {string|StoreDescriptor} storeNameOrDescriptor Unique namespace identifier for the store\n * @param {string} selectorName The name of the selector\n * @param {Array} args Arguments for the selector.\n *\n * @example\n * ```js\n * import { controls } from '@wordpress/data';\n *\n * // Action generator using resolveSelect\n * export function* myAction() {\n * \tconst isSidebarOpened = yield controls.resolveSelect( 'core/edit-post', 'isEditorSideBarOpened' );\n * \t// do stuff with the result from the select.\n * }\n * ```\n *\n * @return {Object} The control descriptor.\n */\nfunction resolveSelect( storeNameOrDescriptor, selectorName, ...args ) {\n\treturn {\n\t\ttype: RESOLVE_SELECT,\n\t\tstoreKey: isObject( storeNameOrDescriptor )\n\t\t\t? storeNameOrDescriptor.name\n\t\t\t: storeNameOrDescriptor,\n\t\tselectorName,\n\t\targs,\n\t};\n}\n\n/**\n * Dispatches a control action for triggering a registry dispatch.\n *\n * @param {string|StoreDescriptor} storeNameOrDescriptor Unique namespace identifier for the store\n * @param {string} actionName The name of the action to dispatch\n * @param {Array} args Arguments for the dispatch action.\n *\n * @example\n * ```js\n * import { controls } from '@wordpress/data-controls';\n *\n * // Action generator using dispatch\n * export function* myAction() {\n * yield controls.dispatch( 'core/editor', 'togglePublishSidebar' );\n * // do some other things.\n * }\n * ```\n *\n * @return {Object} The control descriptor.\n */\nfunction dispatch( storeNameOrDescriptor, actionName, ...args ) {\n\treturn {\n\t\ttype: DISPATCH,\n\t\tstoreKey: isObject( storeNameOrDescriptor )\n\t\t\t? storeNameOrDescriptor.name\n\t\t\t: storeNameOrDescriptor,\n\t\tactionName,\n\t\targs,\n\t};\n}\n\nexport const controls = { select, resolveSelect, dispatch };\n\nexport const builtinControls = {\n\t[ SELECT ]: createRegistryControl(\n\t\t( registry ) =>\n\t\t\t( { storeKey, selectorName, args } ) =>\n\t\t\t\tregistry.select( storeKey )[ selectorName ]( ...args )\n\t),\n\t[ RESOLVE_SELECT ]: createRegistryControl(\n\t\t( registry ) =>\n\t\t\t( { storeKey, selectorName, args } ) => {\n\t\t\t\tconst method = registry.select( storeKey )[ selectorName ]\n\t\t\t\t\t.hasResolver\n\t\t\t\t\t? 'resolveSelect'\n\t\t\t\t\t: 'select';\n\t\t\t\treturn registry[ method ]( storeKey )[ selectorName ](\n\t\t\t\t\t...args\n\t\t\t\t);\n\t\t\t}\n\t),\n\t[ DISPATCH ]: createRegistryControl(\n\t\t( registry ) =>\n\t\t\t( { storeKey, actionName, args } ) =>\n\t\t\t\tregistry.dispatch( storeKey )[ actionName ]( ...args )\n\t),\n};\n"],"mappings":";;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGA;;AAEA,MAAMC,MAAM,GAAG,eAAe;AAC9B,MAAMC,cAAc,GAAG,uBAAuB;AAC9C,MAAMC,QAAQ,GAAG,iBAAiB;AAElC,SAASC,QAAQA,CAAEC,MAAM,EAAG;EAC3B,OAAOA,MAAM,KAAK,IAAI,IAAI,OAAOA,MAAM,KAAK,QAAQ;AACrD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,MAAMA,CAAEC,qBAAqB,EAAEC,YAAY,EAAE,GAAGC,IAAI,EAAG;EAC/D,OAAO;IACNC,IAAI,EAAET,MAAM;IACZU,QAAQ,EAAEP,QAAQ,CAAEG,qBAAsB,CAAC,GACxCA,qBAAqB,CAACK,IAAI,GAC1BL,qBAAqB;IACxBC,YAAY;IACZC;EACD,CAAC;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASI,aAAaA,CAAEN,qBAAqB,EAAEC,YAAY,EAAE,GAAGC,IAAI,EAAG;EACtE,OAAO;IACNC,IAAI,EAAER,cAAc;IACpBS,QAAQ,EAAEP,QAAQ,CAAEG,qBAAsB,CAAC,GACxCA,qBAAqB,CAACK,IAAI,GAC1BL,qBAAqB;IACxBC,YAAY;IACZC;EACD,CAAC;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASK,QAAQA,CAAEP,qBAAqB,EAAEQ,UAAU,EAAE,GAAGN,IAAI,EAAG;EAC/D,OAAO;IACNC,IAAI,EAAEP,QAAQ;IACdQ,QAAQ,EAAEP,QAAQ,CAAEG,qBAAsB,CAAC,GACxCA,qBAAqB,CAACK,IAAI,GAC1BL,qBAAqB;IACxBQ,UAAU;IACVN;EACD,CAAC;AACF;AAEO,MAAMO,QAAQ,GAAAC,OAAA,CAAAD,QAAA,GAAG;EAAEV,MAAM;EAAEO,aAAa;EAAEC;AAAS,CAAC;AAEpD,MAAMI,eAAe,GAAAD,OAAA,CAAAC,eAAA,GAAG;EAC9B,CAAEjB,MAAM,GAAI,IAAAkB,8BAAqB,EAC9BC,QAAQ,IACT,CAAE;IAAET,QAAQ;IAAEH,YAAY;IAAEC;EAAK,CAAC,KACjCW,QAAQ,CAACd,MAAM,CAAEK,QAAS,CAAC,CAAEH,YAAY,CAAE,CAAE,GAAGC,IAAK,CACxD,CAAC;EACD,CAAEP,cAAc,GAAI,IAAAiB,8BAAqB,EACtCC,QAAQ,IACT,CAAE;IAAET,QAAQ;IAAEH,YAAY;IAAEC;EAAK,CAAC,KAAM;IACvC,MAAMY,MAAM,GAAGD,QAAQ,CAACd,MAAM,CAAEK,QAAS,CAAC,CAAEH,YAAY,CAAE,CACxDc,WAAW,GACV,eAAe,GACf,QAAQ;IACX,OAAOF,QAAQ,CAAEC,MAAM,CAAE,CAAEV,QAAS,CAAC,CAAEH,YAAY,CAAE,CACpD,GAAGC,IACJ,CAAC;EACF,CACF,CAAC;EACD,CAAEN,QAAQ,GAAI,IAAAgB,8BAAqB,EAChCC,QAAQ,IACT,CAAE;IAAET,QAAQ;IAAEI,UAAU;IAAEN;EAAK,CAAC,KAC/BW,QAAQ,CAACN,QAAQ,CAAEH,QAAS,CAAC,CAAEI,UAAU,CAAE,CAAE,GAAGN,IAAK,CACxD;AACD,CAAC","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/controls.js"],
4
+ "sourcesContent": ["/**\n * Internal dependencies\n */\nimport { createRegistryControl } from './factory';\n\n/** @typedef {import('./types').StoreDescriptor} StoreDescriptor */\n\nconst SELECT = '@@data/SELECT';\nconst RESOLVE_SELECT = '@@data/RESOLVE_SELECT';\nconst DISPATCH = '@@data/DISPATCH';\n\nfunction isObject( object ) {\n\treturn object !== null && typeof object === 'object';\n}\n\n/**\n * Dispatches a control action for triggering a synchronous registry select.\n *\n * Note: This control synchronously returns the current selector value, triggering the\n * resolution, but not waiting for it.\n *\n * @param {string|StoreDescriptor} storeNameOrDescriptor Unique namespace identifier for the store\n * @param {string} selectorName The name of the selector.\n * @param {Array} args Arguments for the selector.\n *\n * @example\n * ```js\n * import { controls } from '@wordpress/data';\n *\n * // Action generator using `select`.\n * export function* myAction() {\n * const isEditorSideBarOpened = yield controls.select( 'core/edit-post', 'isEditorSideBarOpened' );\n * // Do stuff with the result from the `select`.\n * }\n * ```\n *\n * @return {Object} The control descriptor.\n */\nfunction select( storeNameOrDescriptor, selectorName, ...args ) {\n\treturn {\n\t\ttype: SELECT,\n\t\tstoreKey: isObject( storeNameOrDescriptor )\n\t\t\t? storeNameOrDescriptor.name\n\t\t\t: storeNameOrDescriptor,\n\t\tselectorName,\n\t\targs,\n\t};\n}\n\n/**\n * Dispatches a control action for triggering and resolving a registry select.\n *\n * Note: when this control action is handled, it automatically considers\n * selectors that may have a resolver. In such case, it will return a `Promise` that resolves\n * after the selector finishes resolving, with the final result value.\n *\n * @param {string|StoreDescriptor} storeNameOrDescriptor Unique namespace identifier for the store\n * @param {string} selectorName The name of the selector\n * @param {Array} args Arguments for the selector.\n *\n * @example\n * ```js\n * import { controls } from '@wordpress/data';\n *\n * // Action generator using resolveSelect\n * export function* myAction() {\n * \tconst isSidebarOpened = yield controls.resolveSelect( 'core/edit-post', 'isEditorSideBarOpened' );\n * \t// do stuff with the result from the select.\n * }\n * ```\n *\n * @return {Object} The control descriptor.\n */\nfunction resolveSelect( storeNameOrDescriptor, selectorName, ...args ) {\n\treturn {\n\t\ttype: RESOLVE_SELECT,\n\t\tstoreKey: isObject( storeNameOrDescriptor )\n\t\t\t? storeNameOrDescriptor.name\n\t\t\t: storeNameOrDescriptor,\n\t\tselectorName,\n\t\targs,\n\t};\n}\n\n/**\n * Dispatches a control action for triggering a registry dispatch.\n *\n * @param {string|StoreDescriptor} storeNameOrDescriptor Unique namespace identifier for the store\n * @param {string} actionName The name of the action to dispatch\n * @param {Array} args Arguments for the dispatch action.\n *\n * @example\n * ```js\n * import { controls } from '@wordpress/data-controls';\n *\n * // Action generator using dispatch\n * export function* myAction() {\n * yield controls.dispatch( 'core/editor', 'togglePublishSidebar' );\n * // do some other things.\n * }\n * ```\n *\n * @return {Object} The control descriptor.\n */\nfunction dispatch( storeNameOrDescriptor, actionName, ...args ) {\n\treturn {\n\t\ttype: DISPATCH,\n\t\tstoreKey: isObject( storeNameOrDescriptor )\n\t\t\t? storeNameOrDescriptor.name\n\t\t\t: storeNameOrDescriptor,\n\t\tactionName,\n\t\targs,\n\t};\n}\n\nexport const controls = { select, resolveSelect, dispatch };\n\nexport const builtinControls = {\n\t[ SELECT ]: createRegistryControl(\n\t\t( registry ) =>\n\t\t\t( { storeKey, selectorName, args } ) =>\n\t\t\t\tregistry.select( storeKey )[ selectorName ]( ...args )\n\t),\n\t[ RESOLVE_SELECT ]: createRegistryControl(\n\t\t( registry ) =>\n\t\t\t( { storeKey, selectorName, args } ) => {\n\t\t\t\tconst method = registry.select( storeKey )[ selectorName ]\n\t\t\t\t\t.hasResolver\n\t\t\t\t\t? 'resolveSelect'\n\t\t\t\t\t: 'select';\n\t\t\t\treturn registry[ method ]( storeKey )[ selectorName ](\n\t\t\t\t\t...args\n\t\t\t\t);\n\t\t\t}\n\t),\n\t[ DISPATCH ]: createRegistryControl(\n\t\t( registry ) =>\n\t\t\t( { storeKey, actionName, args } ) =>\n\t\t\t\tregistry.dispatch( storeKey )[ actionName ]( ...args )\n\t),\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,qBAAsC;AAItC,MAAM,SAAS;AACf,MAAM,iBAAiB;AACvB,MAAM,WAAW;AAEjB,SAAS,SAAU,QAAS;AAC3B,SAAO,WAAW,QAAQ,OAAO,WAAW;AAC7C;AAyBA,SAAS,OAAQ,uBAAuB,iBAAiB,MAAO;AAC/D,SAAO;AAAA,IACN,MAAM;AAAA,IACN,UAAU,SAAU,qBAAsB,IACvC,sBAAsB,OACtB;AAAA,IACH;AAAA,IACA;AAAA,EACD;AACD;AA0BA,SAAS,cAAe,uBAAuB,iBAAiB,MAAO;AACtE,SAAO;AAAA,IACN,MAAM;AAAA,IACN,UAAU,SAAU,qBAAsB,IACvC,sBAAsB,OACtB;AAAA,IACH;AAAA,IACA;AAAA,EACD;AACD;AAsBA,SAAS,SAAU,uBAAuB,eAAe,MAAO;AAC/D,SAAO;AAAA,IACN,MAAM;AAAA,IACN,UAAU,SAAU,qBAAsB,IACvC,sBAAsB,OACtB;AAAA,IACH;AAAA,IACA;AAAA,EACD;AACD;AAEO,MAAM,WAAW,EAAE,QAAQ,eAAe,SAAS;AAEnD,MAAM,kBAAkB;AAAA,EAC9B,CAAE,MAAO,OAAG;AAAA,IACX,CAAE,aACD,CAAE,EAAE,UAAU,cAAc,KAAK,MAChC,SAAS,OAAQ,QAAS,EAAG,YAAa,EAAG,GAAG,IAAK;AAAA,EACxD;AAAA,EACA,CAAE,cAAe,OAAG;AAAA,IACnB,CAAE,aACD,CAAE,EAAE,UAAU,cAAc,KAAK,MAAO;AACvC,YAAM,SAAS,SAAS,OAAQ,QAAS,EAAG,YAAa,EACvD,cACC,kBACA;AACH,aAAO,SAAU,MAAO,EAAG,QAAS,EAAG,YAAa;AAAA,QACnD,GAAG;AAAA,MACJ;AAAA,IACD;AAAA,EACF;AAAA,EACA,CAAE,QAAS,OAAG;AAAA,IACb,CAAE,aACD,CAAE,EAAE,UAAU,YAAY,KAAK,MAC9B,SAAS,SAAU,QAAS,EAAG,UAAW,EAAG,GAAG,IAAK;AAAA,EACxD;AACD;",
6
+ "names": []
7
+ }
@@ -1,14 +1,39 @@
1
1
  "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- Object.defineProperty(exports, "createSelector", {
8
- enumerable: true,
9
- get: function () {
10
- return _rememo.default;
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
17
  }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var create_selector_exports = {};
30
+ __export(create_selector_exports, {
31
+ createSelector: () => import_rememo.default
32
+ });
33
+ module.exports = __toCommonJS(create_selector_exports);
34
+ var import_rememo = __toESM(require("rememo"));
35
+ // Annotate the CommonJS export names for ESM import in node:
36
+ 0 && (module.exports = {
37
+ createSelector
12
38
  });
13
- var _rememo = _interopRequireDefault(require("rememo"));
14
- //# sourceMappingURL=create-selector.js.map
39
+ //# sourceMappingURL=create-selector.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["_rememo","_interopRequireDefault","require"],"sources":["@wordpress/data/src/create-selector.ts"],"sourcesContent":["/**\n * Creates a memoized selector that caches the computed values according to the array of \"dependants\"\n * and the selector parameters, and recomputes the values only when any of them changes.\n *\n * @see The documentation for the `rememo` package from which the `createSelector` function is reexported.\n */\nexport { default as createSelector } from 'rememo';\n"],"mappings":";;;;;;;;;;;;AAMA,IAAAA,OAAA,GAAAC,sBAAA,CAAAC,OAAA","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/create-selector.ts"],
4
+ "sourcesContent": ["/**\n * Creates a memoized selector that caches the computed values according to the array of \"dependants\"\n * and the selector parameters, and recomputes the values only when any of them changes.\n *\n * @see The documentation for the `rememo` package from which the `createSelector` function is reexported.\n */\nexport { default as createSelector } from 'rememo';\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAMA,oBAA0C;",
6
+ "names": []
7
+ }
@@ -1,12 +1,26 @@
1
1
  "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var default_registry_exports = {};
20
+ __export(default_registry_exports, {
21
+ default: () => default_registry_default
5
22
  });
6
- exports.default = void 0;
7
- var _registry = require("./registry");
8
- /**
9
- * Internal dependencies
10
- */
11
- var _default = exports.default = (0, _registry.createRegistry)();
12
- //# sourceMappingURL=default-registry.js.map
23
+ module.exports = __toCommonJS(default_registry_exports);
24
+ var import_registry = require("./registry");
25
+ var default_registry_default = (0, import_registry.createRegistry)();
26
+ //# sourceMappingURL=default-registry.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["_registry","require","_default","exports","default","createRegistry"],"sources":["@wordpress/data/src/default-registry.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport { createRegistry } from './registry';\n\nexport default createRegistry();\n"],"mappings":";;;;;;AAGA,IAAAA,SAAA,GAAAC,OAAA;AAHA;AACA;AACA;AAFA,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAKe,IAAAC,wBAAc,EAAC,CAAC","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/default-registry.js"],
4
+ "sourcesContent": ["/**\n * Internal dependencies\n */\nimport { createRegistry } from './registry';\n\nexport default createRegistry();\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,sBAA+B;AAE/B,IAAO,+BAAQ,gCAAe;",
6
+ "names": []
7
+ }