@wordpress/data 10.13.1-next.a9f418477.0 → 10.14.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 (59) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/README.md +4 -13
  3. package/build/components/use-dispatch/use-dispatch-with-map.js +1 -0
  4. package/build/components/use-dispatch/use-dispatch-with-map.js.map +1 -1
  5. package/build/components/use-select/index.js +12 -3
  6. package/build/components/use-select/index.js.map +1 -1
  7. package/build/create-selector.js.map +1 -1
  8. package/build/factory.js +9 -7
  9. package/build/factory.js.map +1 -1
  10. package/build/plugins/persistence/index.js +1 -0
  11. package/build/plugins/persistence/index.js.map +1 -1
  12. package/build/redux-store/index.js +1 -0
  13. package/build/redux-store/index.js.map +1 -1
  14. package/build/redux-store/metadata/reducer.js +1 -0
  15. package/build/redux-store/metadata/reducer.js.map +1 -1
  16. package/build/redux-store/metadata/selectors.js +1 -0
  17. package/build/redux-store/metadata/selectors.js.map +1 -1
  18. package/build/registry.js +1 -0
  19. package/build/registry.js.map +1 -1
  20. package/build/resolvers-cache-middleware.js +1 -0
  21. package/build/resolvers-cache-middleware.js.map +1 -1
  22. package/build/utils/emitter.js +1 -0
  23. package/build/utils/emitter.js.map +1 -1
  24. package/build-module/components/use-dispatch/use-dispatch-with-map.js +1 -0
  25. package/build-module/components/use-dispatch/use-dispatch-with-map.js.map +1 -1
  26. package/build-module/components/use-select/index.js +12 -3
  27. package/build-module/components/use-select/index.js.map +1 -1
  28. package/build-module/create-selector.js +0 -4
  29. package/build-module/create-selector.js.map +1 -1
  30. package/build-module/factory.js +9 -7
  31. package/build-module/factory.js.map +1 -1
  32. package/build-module/plugins/persistence/index.js +1 -0
  33. package/build-module/plugins/persistence/index.js.map +1 -1
  34. package/build-module/redux-store/index.js +1 -0
  35. package/build-module/redux-store/index.js.map +1 -1
  36. package/build-module/redux-store/metadata/reducer.js +1 -0
  37. package/build-module/redux-store/metadata/reducer.js.map +1 -1
  38. package/build-module/redux-store/metadata/selectors.js +1 -0
  39. package/build-module/redux-store/metadata/selectors.js.map +1 -1
  40. package/build-module/registry.js +1 -0
  41. package/build-module/registry.js.map +1 -1
  42. package/build-module/resolvers-cache-middleware.js +1 -0
  43. package/build-module/resolvers-cache-middleware.js.map +1 -1
  44. package/build-module/utils/emitter.js +1 -0
  45. package/build-module/utils/emitter.js.map +1 -1
  46. package/build-types/components/use-select/index.d.ts.map +1 -1
  47. package/build-types/controls.d.ts +21 -3
  48. package/build-types/controls.d.ts.map +1 -1
  49. package/build-types/create-selector.d.ts +7 -1
  50. package/build-types/create-selector.d.ts.map +1 -1
  51. package/build-types/factory.d.ts +21 -7
  52. package/build-types/factory.d.ts.map +1 -1
  53. package/package.json +9 -9
  54. package/src/components/use-select/index.js +21 -5
  55. package/src/components/use-select/test/index.js +13 -0
  56. package/src/components/with-select/test/index.js +13 -0
  57. package/src/{create-selector.js → create-selector.ts} +0 -4
  58. package/src/{factory.js → factory.ts} +25 -10
  59. package/tsconfig.tsbuildinfo +1 -1
@@ -1,3 +1,4 @@
1
+ /* wp:polyfill */
1
2
  /**
2
3
  * External dependencies
3
4
  */
@@ -1 +1 @@
1
- {"version":3,"names":["createStore","applyMiddleware","EquivalentKeyMap","createReduxRoutineMiddleware","compose","combineReducers","builtinControls","lock","promise","createResolversCacheMiddleware","createThunkMiddleware","metadataReducer","metadataSelectors","metadataActions","trimUndefinedValues","array","result","i","length","undefined","splice","mapValues","obj","callback","Object","fromEntries","entries","map","key","value","devToolsReplacer","state","Map","window","HTMLElement","createResolversCache","cache","isRunning","selectorName","args","get","clear","delete","markAsRunning","set","createBindingCache","bind","WeakMap","item","itemName","boundItem","createReduxStore","options","privateActions","privateSelectors","privateRegistrationFunctions","registerPrivateActions","actions","assign","registerPrivateSelectors","selectors","storeDescriptor","name","instantiate","registry","listeners","Set","reducer","thunkArgs","dispatch","thunkActions","select","thunkSelectors","resolveSelect","getResolveSelectors","store","instantiateReduxStore","resolversCache","bindAction","action","Promise","resolve","boundPrivateActions","allActions","Proxy","target","prop","privateAction","apply","thisArg","resolvers","mapResolvers","bindSelector","selector","isRegistrySelector","boundSelector","normalize","__unstableOriginalGetState","root","__unstableNormalizeArgs","resolver","hasResolver","mapSelectorWithResolver","bindMetadataSelector","metaDataSelector","originalSelectorName","originalSelectorArgs","targetSelector","metadata","boundPrivateSelectors","allSelectors","privateSelector","resolveSelectors","mapResolveSelectors","suspendSelectors","mapSuspendSelectors","getSelectors","getActions","getSuspendSelectors","getState","subscribe","listener","add","lastState","hasChanged","controls","normalizedControls","control","isRegistryControl","middlewares","enhancers","__REDUX_DEVTOOLS_EXTENSION__","push","instanceId","serialize","replacer","initialState","enhancedReducer","getIsResolving","hasStartedResolution","hasFinishedResolution","hasResolutionFailed","isResolving","getCachedResolvers","getResolutionState","getResolutionError","hasResolvingSelectors","countSelectorsByStatus","storeSelectors","reject","hasFinished","finalize","hasFailed","error","getResult","unsubscribe","fulfill","fulfillSelector","isFulfilled","setTimeout","startResolution","finishResolution","failResolution","selectorResolver"],"sources":["@wordpress/data/src/redux-store/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { createStore, applyMiddleware } from 'redux';\nimport EquivalentKeyMap from 'equivalent-key-map';\n\n/**\n * WordPress dependencies\n */\nimport createReduxRoutineMiddleware from '@wordpress/redux-routine';\nimport { compose } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { combineReducers } from './combine-reducers';\nimport { builtinControls } from '../controls';\nimport { lock } from '../lock-unlock';\nimport promise from '../promise-middleware';\nimport createResolversCacheMiddleware from '../resolvers-cache-middleware';\nimport createThunkMiddleware from './thunk-middleware';\nimport metadataReducer from './metadata/reducer';\nimport * as metadataSelectors from './metadata/selectors';\nimport * as metadataActions from './metadata/actions';\n\nexport { combineReducers };\n\n/** @typedef {import('../types').DataRegistry} DataRegistry */\n/** @typedef {import('../types').ListenerFunction} ListenerFunction */\n/**\n * @typedef {import('../types').StoreDescriptor<C>} StoreDescriptor\n * @template {import('../types').AnyConfig} C\n */\n/**\n * @typedef {import('../types').ReduxStoreConfig<State,Actions,Selectors>} ReduxStoreConfig\n * @template State\n * @template {Record<string,import('../types').ActionCreator>} Actions\n * @template Selectors\n */\n\nconst trimUndefinedValues = ( array ) => {\n\tconst result = [ ...array ];\n\tfor ( let i = result.length - 1; i >= 0; i-- ) {\n\t\tif ( result[ i ] === undefined ) {\n\t\t\tresult.splice( i, 1 );\n\t\t}\n\t}\n\treturn result;\n};\n\n/**\n * Creates a new object with the same keys, but with `callback()` called as\n * a transformer function on each of the values.\n *\n * @param {Object} obj The object to transform.\n * @param {Function} callback The function to transform each object value.\n * @return {Array} Transformed object.\n */\nconst mapValues = ( obj, callback ) =>\n\tObject.fromEntries(\n\t\tObject.entries( obj ?? {} ).map( ( [ key, value ] ) => [\n\t\t\tkey,\n\t\t\tcallback( value, key ),\n\t\t] )\n\t);\n\n// Convert non serializable types to plain objects\nconst devToolsReplacer = ( key, state ) => {\n\tif ( state instanceof Map ) {\n\t\treturn Object.fromEntries( state );\n\t}\n\n\tif ( state instanceof window.HTMLElement ) {\n\t\treturn null;\n\t}\n\n\treturn state;\n};\n\n/**\n * Create a cache to track whether resolvers started running or not.\n *\n * @return {Object} Resolvers Cache.\n */\nfunction createResolversCache() {\n\tconst cache = {};\n\treturn {\n\t\tisRunning( selectorName, args ) {\n\t\t\treturn (\n\t\t\t\tcache[ selectorName ] &&\n\t\t\t\tcache[ selectorName ].get( trimUndefinedValues( args ) )\n\t\t\t);\n\t\t},\n\n\t\tclear( selectorName, args ) {\n\t\t\tif ( cache[ selectorName ] ) {\n\t\t\t\tcache[ selectorName ].delete( trimUndefinedValues( args ) );\n\t\t\t}\n\t\t},\n\n\t\tmarkAsRunning( selectorName, args ) {\n\t\t\tif ( ! cache[ selectorName ] ) {\n\t\t\t\tcache[ selectorName ] = new EquivalentKeyMap();\n\t\t\t}\n\n\t\t\tcache[ selectorName ].set( trimUndefinedValues( args ), true );\n\t\t},\n\t};\n}\n\nfunction createBindingCache( bind ) {\n\tconst cache = new WeakMap();\n\n\treturn {\n\t\tget( item, itemName ) {\n\t\t\tlet boundItem = cache.get( item );\n\t\t\tif ( ! boundItem ) {\n\t\t\t\tboundItem = bind( item, itemName );\n\t\t\t\tcache.set( item, boundItem );\n\t\t\t}\n\t\t\treturn boundItem;\n\t\t},\n\t};\n}\n\n/**\n * Creates a data store descriptor for the provided Redux store configuration containing\n * properties describing reducer, actions, selectors, controls and resolvers.\n *\n * @example\n * ```js\n * import { createReduxStore } from '@wordpress/data';\n *\n * const store = createReduxStore( 'demo', {\n * reducer: ( state = 'OK' ) => state,\n * selectors: {\n * getValue: ( state ) => state,\n * },\n * } );\n * ```\n *\n * @template State\n * @template {Record<string,import('../types').ActionCreator>} Actions\n * @template Selectors\n * @param {string} key Unique namespace identifier.\n * @param {ReduxStoreConfig<State,Actions,Selectors>} options Registered store options, with properties\n * describing reducer, actions, selectors,\n * and resolvers.\n *\n * @return {StoreDescriptor<ReduxStoreConfig<State,Actions,Selectors>>} Store Object.\n */\nexport default function createReduxStore( key, options ) {\n\tconst privateActions = {};\n\tconst privateSelectors = {};\n\tconst privateRegistrationFunctions = {\n\t\tprivateActions,\n\t\tregisterPrivateActions: ( actions ) => {\n\t\t\tObject.assign( privateActions, actions );\n\t\t},\n\t\tprivateSelectors,\n\t\tregisterPrivateSelectors: ( selectors ) => {\n\t\t\tObject.assign( privateSelectors, selectors );\n\t\t},\n\t};\n\tconst storeDescriptor = {\n\t\tname: key,\n\t\tinstantiate: ( registry ) => {\n\t\t\t/**\n\t\t\t * Stores listener functions registered with `subscribe()`.\n\t\t\t *\n\t\t\t * When functions register to listen to store changes with\n\t\t\t * `subscribe()` they get added here. Although Redux offers\n\t\t\t * its own `subscribe()` function directly, by wrapping the\n\t\t\t * subscription in this store instance it's possible to\n\t\t\t * optimize checking if the state has changed before calling\n\t\t\t * each listener.\n\t\t\t *\n\t\t\t * @type {Set<ListenerFunction>}\n\t\t\t */\n\t\t\tconst listeners = new Set();\n\t\t\tconst reducer = options.reducer;\n\t\t\tconst thunkArgs = {\n\t\t\t\tregistry,\n\t\t\t\tget dispatch() {\n\t\t\t\t\treturn thunkActions;\n\t\t\t\t},\n\t\t\t\tget select() {\n\t\t\t\t\treturn thunkSelectors;\n\t\t\t\t},\n\t\t\t\tget resolveSelect() {\n\t\t\t\t\treturn getResolveSelectors();\n\t\t\t\t},\n\t\t\t};\n\n\t\t\tconst store = instantiateReduxStore(\n\t\t\t\tkey,\n\t\t\t\toptions,\n\t\t\t\tregistry,\n\t\t\t\tthunkArgs\n\t\t\t);\n\t\t\t// Expose the private registration functions on the store\n\t\t\t// so they can be copied to a sub registry in registry.js.\n\t\t\tlock( store, privateRegistrationFunctions );\n\t\t\tconst resolversCache = createResolversCache();\n\n\t\t\tfunction bindAction( action ) {\n\t\t\t\treturn ( ...args ) =>\n\t\t\t\t\tPromise.resolve( store.dispatch( action( ...args ) ) );\n\t\t\t}\n\n\t\t\tconst actions = {\n\t\t\t\t...mapValues( metadataActions, bindAction ),\n\t\t\t\t...mapValues( options.actions, bindAction ),\n\t\t\t};\n\n\t\t\tconst boundPrivateActions = createBindingCache( bindAction );\n\t\t\tconst allActions = new Proxy( () => {}, {\n\t\t\t\tget: ( target, prop ) => {\n\t\t\t\t\tconst privateAction = privateActions[ prop ];\n\t\t\t\t\treturn privateAction\n\t\t\t\t\t\t? boundPrivateActions.get( privateAction, prop )\n\t\t\t\t\t\t: actions[ prop ];\n\t\t\t\t},\n\t\t\t} );\n\n\t\t\tconst thunkActions = new Proxy( allActions, {\n\t\t\t\tapply: ( target, thisArg, [ action ] ) =>\n\t\t\t\t\tstore.dispatch( action ),\n\t\t\t} );\n\n\t\t\tlock( actions, allActions );\n\n\t\t\tconst resolvers = options.resolvers\n\t\t\t\t? mapResolvers( options.resolvers )\n\t\t\t\t: {};\n\n\t\t\tfunction bindSelector( selector, selectorName ) {\n\t\t\t\tif ( selector.isRegistrySelector ) {\n\t\t\t\t\tselector.registry = registry;\n\t\t\t\t}\n\t\t\t\tconst boundSelector = ( ...args ) => {\n\t\t\t\t\targs = normalize( selector, args );\n\t\t\t\t\tconst state = store.__unstableOriginalGetState();\n\t\t\t\t\t// Before calling the selector, switch to the correct\n\t\t\t\t\t// registry.\n\t\t\t\t\tif ( selector.isRegistrySelector ) {\n\t\t\t\t\t\tselector.registry = registry;\n\t\t\t\t\t}\n\t\t\t\t\treturn selector( state.root, ...args );\n\t\t\t\t};\n\n\t\t\t\t// Expose normalization method on the bound selector\n\t\t\t\t// in order that it can be called when fullfilling\n\t\t\t\t// the resolver.\n\t\t\t\tboundSelector.__unstableNormalizeArgs =\n\t\t\t\t\tselector.__unstableNormalizeArgs;\n\n\t\t\t\tconst resolver = resolvers[ selectorName ];\n\n\t\t\t\tif ( ! resolver ) {\n\t\t\t\t\tboundSelector.hasResolver = false;\n\t\t\t\t\treturn boundSelector;\n\t\t\t\t}\n\n\t\t\t\treturn mapSelectorWithResolver(\n\t\t\t\t\tboundSelector,\n\t\t\t\t\tselectorName,\n\t\t\t\t\tresolver,\n\t\t\t\t\tstore,\n\t\t\t\t\tresolversCache\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tfunction bindMetadataSelector( metaDataSelector ) {\n\t\t\t\tconst boundSelector = ( ...args ) => {\n\t\t\t\t\tconst state = store.__unstableOriginalGetState();\n\n\t\t\t\t\tconst originalSelectorName = args && args[ 0 ];\n\t\t\t\t\tconst originalSelectorArgs = args && args[ 1 ];\n\t\t\t\t\tconst targetSelector =\n\t\t\t\t\t\toptions?.selectors?.[ originalSelectorName ];\n\n\t\t\t\t\t// Normalize the arguments passed to the target selector.\n\t\t\t\t\tif ( originalSelectorName && targetSelector ) {\n\t\t\t\t\t\targs[ 1 ] = normalize(\n\t\t\t\t\t\t\ttargetSelector,\n\t\t\t\t\t\t\toriginalSelectorArgs\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\treturn metaDataSelector( state.metadata, ...args );\n\t\t\t\t};\n\t\t\t\tboundSelector.hasResolver = false;\n\t\t\t\treturn boundSelector;\n\t\t\t}\n\n\t\t\tconst selectors = {\n\t\t\t\t...mapValues( metadataSelectors, bindMetadataSelector ),\n\t\t\t\t...mapValues( options.selectors, bindSelector ),\n\t\t\t};\n\n\t\t\tconst boundPrivateSelectors = createBindingCache( bindSelector );\n\n\t\t\t// Pre-bind the private selectors that have been registered by the time of\n\t\t\t// instantiation, so that registry selectors are bound to the registry.\n\t\t\tfor ( const [ selectorName, selector ] of Object.entries(\n\t\t\t\tprivateSelectors\n\t\t\t) ) {\n\t\t\t\tboundPrivateSelectors.get( selector, selectorName );\n\t\t\t}\n\n\t\t\tconst allSelectors = new Proxy( () => {}, {\n\t\t\t\tget: ( target, prop ) => {\n\t\t\t\t\tconst privateSelector = privateSelectors[ prop ];\n\t\t\t\t\treturn privateSelector\n\t\t\t\t\t\t? boundPrivateSelectors.get( privateSelector, prop )\n\t\t\t\t\t\t: selectors[ prop ];\n\t\t\t\t},\n\t\t\t} );\n\n\t\t\tconst thunkSelectors = new Proxy( allSelectors, {\n\t\t\t\tapply: ( target, thisArg, [ selector ] ) =>\n\t\t\t\t\tselector( store.__unstableOriginalGetState() ),\n\t\t\t} );\n\n\t\t\tlock( selectors, allSelectors );\n\n\t\t\tconst resolveSelectors = mapResolveSelectors( selectors, store );\n\t\t\tconst suspendSelectors = mapSuspendSelectors( selectors, store );\n\n\t\t\tconst getSelectors = () => selectors;\n\t\t\tconst getActions = () => actions;\n\t\t\tconst getResolveSelectors = () => resolveSelectors;\n\t\t\tconst getSuspendSelectors = () => suspendSelectors;\n\n\t\t\t// We have some modules monkey-patching the store object\n\t\t\t// It's wrong to do so but until we refactor all of our effects to controls\n\t\t\t// We need to keep the same \"store\" instance here.\n\t\t\tstore.__unstableOriginalGetState = store.getState;\n\t\t\tstore.getState = () => store.__unstableOriginalGetState().root;\n\n\t\t\t// Customize subscribe behavior to call listeners only on effective change,\n\t\t\t// not on every dispatch.\n\t\t\tconst subscribe =\n\t\t\t\tstore &&\n\t\t\t\t( ( listener ) => {\n\t\t\t\t\tlisteners.add( listener );\n\n\t\t\t\t\treturn () => listeners.delete( listener );\n\t\t\t\t} );\n\n\t\t\tlet lastState = store.__unstableOriginalGetState();\n\t\t\tstore.subscribe( () => {\n\t\t\t\tconst state = store.__unstableOriginalGetState();\n\t\t\t\tconst hasChanged = state !== lastState;\n\t\t\t\tlastState = state;\n\n\t\t\t\tif ( hasChanged ) {\n\t\t\t\t\tfor ( const listener of listeners ) {\n\t\t\t\t\t\tlistener();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} );\n\n\t\t\t// This can be simplified to just { subscribe, getSelectors, getActions }\n\t\t\t// Once we remove the use function.\n\t\t\treturn {\n\t\t\t\treducer,\n\t\t\t\tstore,\n\t\t\t\tactions,\n\t\t\t\tselectors,\n\t\t\t\tresolvers,\n\t\t\t\tgetSelectors,\n\t\t\t\tgetResolveSelectors,\n\t\t\t\tgetSuspendSelectors,\n\t\t\t\tgetActions,\n\t\t\t\tsubscribe,\n\t\t\t};\n\t\t},\n\t};\n\n\t// Expose the private registration functions on the store\n\t// descriptor. That's a natural choice since that's where the\n\t// public actions and selectors are stored .\n\tlock( storeDescriptor, privateRegistrationFunctions );\n\n\treturn storeDescriptor;\n}\n\n/**\n * Creates a redux store for a namespace.\n *\n * @param {string} key Unique namespace identifier.\n * @param {Object} options Registered store options, with properties\n * describing reducer, actions, selectors,\n * and resolvers.\n * @param {DataRegistry} registry Registry reference.\n * @param {Object} thunkArgs Argument object for the thunk middleware.\n * @return {Object} Newly created redux store.\n */\nfunction instantiateReduxStore( key, options, registry, thunkArgs ) {\n\tconst controls = {\n\t\t...options.controls,\n\t\t...builtinControls,\n\t};\n\n\tconst normalizedControls = mapValues( controls, ( control ) =>\n\t\tcontrol.isRegistryControl ? control( registry ) : control\n\t);\n\n\tconst middlewares = [\n\t\tcreateResolversCacheMiddleware( registry, key ),\n\t\tpromise,\n\t\tcreateReduxRoutineMiddleware( normalizedControls ),\n\t\tcreateThunkMiddleware( thunkArgs ),\n\t];\n\n\tconst enhancers = [ applyMiddleware( ...middlewares ) ];\n\tif (\n\t\ttypeof window !== 'undefined' &&\n\t\twindow.__REDUX_DEVTOOLS_EXTENSION__\n\t) {\n\t\tenhancers.push(\n\t\t\twindow.__REDUX_DEVTOOLS_EXTENSION__( {\n\t\t\t\tname: key,\n\t\t\t\tinstanceId: key,\n\t\t\t\tserialize: {\n\t\t\t\t\treplacer: devToolsReplacer,\n\t\t\t\t},\n\t\t\t} )\n\t\t);\n\t}\n\n\tconst { reducer, initialState } = options;\n\tconst enhancedReducer = combineReducers( {\n\t\tmetadata: metadataReducer,\n\t\troot: reducer,\n\t} );\n\n\treturn createStore(\n\t\tenhancedReducer,\n\t\t{ root: initialState },\n\t\tcompose( enhancers )\n\t);\n}\n\n/**\n * Maps selectors to functions that return a resolution promise for them\n *\n * @param {Object} selectors Selectors to map.\n * @param {Object} store The redux store the selectors select from.\n *\n * @return {Object} Selectors mapped to their resolution functions.\n */\nfunction mapResolveSelectors( selectors, store ) {\n\tconst {\n\t\tgetIsResolving,\n\t\thasStartedResolution,\n\t\thasFinishedResolution,\n\t\thasResolutionFailed,\n\t\tisResolving,\n\t\tgetCachedResolvers,\n\t\tgetResolutionState,\n\t\tgetResolutionError,\n\t\thasResolvingSelectors,\n\t\tcountSelectorsByStatus,\n\t\t...storeSelectors\n\t} = selectors;\n\n\treturn mapValues( storeSelectors, ( selector, selectorName ) => {\n\t\t// If the selector doesn't have a resolver, just convert the return value\n\t\t// (including exceptions) to a Promise, no additional extra behavior is needed.\n\t\tif ( ! selector.hasResolver ) {\n\t\t\treturn async ( ...args ) => selector.apply( null, args );\n\t\t}\n\n\t\treturn ( ...args ) => {\n\t\t\treturn new Promise( ( resolve, reject ) => {\n\t\t\t\tconst hasFinished = () =>\n\t\t\t\t\tselectors.hasFinishedResolution( selectorName, args );\n\t\t\t\tconst finalize = ( result ) => {\n\t\t\t\t\tconst hasFailed = selectors.hasResolutionFailed(\n\t\t\t\t\t\tselectorName,\n\t\t\t\t\t\targs\n\t\t\t\t\t);\n\t\t\t\t\tif ( hasFailed ) {\n\t\t\t\t\t\tconst error = selectors.getResolutionError(\n\t\t\t\t\t\t\tselectorName,\n\t\t\t\t\t\t\targs\n\t\t\t\t\t\t);\n\t\t\t\t\t\treject( error );\n\t\t\t\t\t} else {\n\t\t\t\t\t\tresolve( result );\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t\tconst getResult = () => selector.apply( null, args );\n\t\t\t\t// Trigger the selector (to trigger the resolver)\n\t\t\t\tconst result = getResult();\n\t\t\t\tif ( hasFinished() ) {\n\t\t\t\t\treturn finalize( result );\n\t\t\t\t}\n\n\t\t\t\tconst unsubscribe = store.subscribe( () => {\n\t\t\t\t\tif ( hasFinished() ) {\n\t\t\t\t\t\tunsubscribe();\n\t\t\t\t\t\tfinalize( getResult() );\n\t\t\t\t\t}\n\t\t\t\t} );\n\t\t\t} );\n\t\t};\n\t} );\n}\n\n/**\n * Maps selectors to functions that throw a suspense promise if not yet resolved.\n *\n * @param {Object} selectors Selectors to map.\n * @param {Object} store The redux store the selectors select from.\n *\n * @return {Object} Selectors mapped to their suspense functions.\n */\nfunction mapSuspendSelectors( selectors, store ) {\n\treturn mapValues( selectors, ( selector, selectorName ) => {\n\t\t// Selector without a resolver doesn't have any extra suspense behavior.\n\t\tif ( ! selector.hasResolver ) {\n\t\t\treturn selector;\n\t\t}\n\n\t\treturn ( ...args ) => {\n\t\t\tconst result = selector.apply( null, args );\n\n\t\t\tif ( selectors.hasFinishedResolution( selectorName, args ) ) {\n\t\t\t\tif ( selectors.hasResolutionFailed( selectorName, args ) ) {\n\t\t\t\t\tthrow selectors.getResolutionError( selectorName, args );\n\t\t\t\t}\n\n\t\t\t\treturn result;\n\t\t\t}\n\n\t\t\tthrow new Promise( ( resolve ) => {\n\t\t\t\tconst unsubscribe = store.subscribe( () => {\n\t\t\t\t\tif (\n\t\t\t\t\t\tselectors.hasFinishedResolution( selectorName, args )\n\t\t\t\t\t) {\n\t\t\t\t\t\tresolve();\n\t\t\t\t\t\tunsubscribe();\n\t\t\t\t\t}\n\t\t\t\t} );\n\t\t\t} );\n\t\t};\n\t} );\n}\n\n/**\n * Convert resolvers to a normalized form, an object with `fulfill` method and\n * optional methods like `isFulfilled`.\n *\n * @param {Object} resolvers Resolver to convert\n */\nfunction mapResolvers( resolvers ) {\n\treturn mapValues( resolvers, ( resolver ) => {\n\t\tif ( resolver.fulfill ) {\n\t\t\treturn resolver;\n\t\t}\n\n\t\treturn {\n\t\t\t...resolver, // Copy the enumerable properties of the resolver function.\n\t\t\tfulfill: resolver, // Add the fulfill method.\n\t\t};\n\t} );\n}\n\n/**\n * Returns a selector with a matched resolver.\n * Resolvers are side effects invoked once per argument set of a given selector call,\n * used in ensuring that the data needs for the selector are satisfied.\n *\n * @param {Object} selector The selector function to be bound.\n * @param {string} selectorName The selector name.\n * @param {Object} resolver Resolver to call.\n * @param {Object} store The redux store to which the resolvers should be mapped.\n * @param {Object} resolversCache Resolvers Cache.\n */\nfunction mapSelectorWithResolver(\n\tselector,\n\tselectorName,\n\tresolver,\n\tstore,\n\tresolversCache\n) {\n\tfunction fulfillSelector( args ) {\n\t\tconst state = store.getState();\n\n\t\tif (\n\t\t\tresolversCache.isRunning( selectorName, args ) ||\n\t\t\t( typeof resolver.isFulfilled === 'function' &&\n\t\t\t\tresolver.isFulfilled( state, ...args ) )\n\t\t) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { metadata } = store.__unstableOriginalGetState();\n\n\t\tif (\n\t\t\tmetadataSelectors.hasStartedResolution(\n\t\t\t\tmetadata,\n\t\t\t\tselectorName,\n\t\t\t\targs\n\t\t\t)\n\t\t) {\n\t\t\treturn;\n\t\t}\n\n\t\tresolversCache.markAsRunning( selectorName, args );\n\n\t\tsetTimeout( async () => {\n\t\t\tresolversCache.clear( selectorName, args );\n\t\t\tstore.dispatch(\n\t\t\t\tmetadataActions.startResolution( selectorName, args )\n\t\t\t);\n\t\t\ttry {\n\t\t\t\tconst action = resolver.fulfill( ...args );\n\t\t\t\tif ( action ) {\n\t\t\t\t\tawait store.dispatch( action );\n\t\t\t\t}\n\t\t\t\tstore.dispatch(\n\t\t\t\t\tmetadataActions.finishResolution( selectorName, args )\n\t\t\t\t);\n\t\t\t} catch ( error ) {\n\t\t\t\tstore.dispatch(\n\t\t\t\t\tmetadataActions.failResolution( selectorName, args, error )\n\t\t\t\t);\n\t\t\t}\n\t\t}, 0 );\n\t}\n\n\tconst selectorResolver = ( ...args ) => {\n\t\targs = normalize( selector, args );\n\t\tfulfillSelector( args );\n\t\treturn selector( ...args );\n\t};\n\tselectorResolver.hasResolver = true;\n\treturn selectorResolver;\n}\n\n/**\n * Applies selector's normalization function to the given arguments\n * if it exists.\n *\n * @param {Object} selector The selector potentially with a normalization method property.\n * @param {Array} args selector arguments to normalize.\n * @return {Array} Potentially normalized arguments.\n */\nfunction normalize( selector, args ) {\n\tif (\n\t\tselector.__unstableNormalizeArgs &&\n\t\ttypeof selector.__unstableNormalizeArgs === 'function' &&\n\t\targs?.length\n\t) {\n\t\treturn selector.__unstableNormalizeArgs( args );\n\t}\n\treturn args;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,WAAW,EAAEC,eAAe,QAAQ,OAAO;AACpD,OAAOC,gBAAgB,MAAM,oBAAoB;;AAEjD;AACA;AACA;AACA,OAAOC,4BAA4B,MAAM,0BAA0B;AACnE,SAASC,OAAO,QAAQ,oBAAoB;;AAE5C;AACA;AACA;AACA,SAASC,eAAe,QAAQ,oBAAoB;AACpD,SAASC,eAAe,QAAQ,aAAa;AAC7C,SAASC,IAAI,QAAQ,gBAAgB;AACrC,OAAOC,OAAO,MAAM,uBAAuB;AAC3C,OAAOC,8BAA8B,MAAM,+BAA+B;AAC1E,OAAOC,qBAAqB,MAAM,oBAAoB;AACtD,OAAOC,eAAe,MAAM,oBAAoB;AAChD,OAAO,K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tD,CAAC;MACF,CAAC,CAAC,OAAQkH,KAAK,EAAG;QACjB9E,KAAK,CAACN,QAAQ,CACbxD,eAAe,CAACqJ,cAAc,CAAE5H,YAAY,EAAEC,IAAI,EAAEkH,KAAM,CAC3D,CAAC;MACF;IACD,CAAC,EAAE,CAAE,CAAC;EACP;EAEA,MAAMU,gBAAgB,GAAGA,CAAE,GAAG5H,IAAI,KAAM;IACvCA,IAAI,GAAGyD,SAAS,CAAEH,QAAQ,EAAEtD,IAAK,CAAC;IAClCsH,eAAe,CAAEtH,IAAK,CAAC;IACvB,OAAOsD,QAAQ,CAAE,GAAGtD,IAAK,CAAC;EAC3B,CAAC;EACD4H,gBAAgB,CAAC9D,WAAW,GAAG,IAAI;EACnC,OAAO8D,gBAAgB;AACxB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASnE,SAASA,CAAEH,QAAQ,EAAEtD,IAAI,EAAG;EACpC,IACCsD,QAAQ,CAACM,uBAAuB,IAChC,OAAON,QAAQ,CAACM,uBAAuB,KAAK,UAAU,IACtD5D,IAAI,EAAErB,MAAM,EACX;IACD,OAAO2E,QAAQ,CAACM,uBAAuB,CAAE5D,IAAK,CAAC;EAChD;EACA,OAAOA,IAAI;AACZ","ignoreList":[]}
1
+ {"version":3,"names":["createStore","applyMiddleware","EquivalentKeyMap","createReduxRoutineMiddleware","compose","combineReducers","builtinControls","lock","promise","createResolversCacheMiddleware","createThunkMiddleware","metadataReducer","metadataSelectors","metadataActions","trimUndefinedValues","array","result","i","length","undefined","splice","mapValues","obj","callback","Object","fromEntries","entries","map","key","value","devToolsReplacer","state","Map","window","HTMLElement","createResolversCache","cache","isRunning","selectorName","args","get","clear","delete","markAsRunning","set","createBindingCache","bind","WeakMap","item","itemName","boundItem","createReduxStore","options","privateActions","privateSelectors","privateRegistrationFunctions","registerPrivateActions","actions","assign","registerPrivateSelectors","selectors","storeDescriptor","name","instantiate","registry","listeners","Set","reducer","thunkArgs","dispatch","thunkActions","select","thunkSelectors","resolveSelect","getResolveSelectors","store","instantiateReduxStore","resolversCache","bindAction","action","Promise","resolve","boundPrivateActions","allActions","Proxy","target","prop","privateAction","apply","thisArg","resolvers","mapResolvers","bindSelector","selector","isRegistrySelector","boundSelector","normalize","__unstableOriginalGetState","root","__unstableNormalizeArgs","resolver","hasResolver","mapSelectorWithResolver","bindMetadataSelector","metaDataSelector","originalSelectorName","originalSelectorArgs","targetSelector","metadata","boundPrivateSelectors","allSelectors","privateSelector","resolveSelectors","mapResolveSelectors","suspendSelectors","mapSuspendSelectors","getSelectors","getActions","getSuspendSelectors","getState","subscribe","listener","add","lastState","hasChanged","controls","normalizedControls","control","isRegistryControl","middlewares","enhancers","__REDUX_DEVTOOLS_EXTENSION__","push","instanceId","serialize","replacer","initialState","enhancedReducer","getIsResolving","hasStartedResolution","hasFinishedResolution","hasResolutionFailed","isResolving","getCachedResolvers","getResolutionState","getResolutionError","hasResolvingSelectors","countSelectorsByStatus","storeSelectors","reject","hasFinished","finalize","hasFailed","error","getResult","unsubscribe","fulfill","fulfillSelector","isFulfilled","setTimeout","startResolution","finishResolution","failResolution","selectorResolver"],"sources":["@wordpress/data/src/redux-store/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { createStore, applyMiddleware } from 'redux';\nimport EquivalentKeyMap from 'equivalent-key-map';\n\n/**\n * WordPress dependencies\n */\nimport createReduxRoutineMiddleware from '@wordpress/redux-routine';\nimport { compose } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { combineReducers } from './combine-reducers';\nimport { builtinControls } from '../controls';\nimport { lock } from '../lock-unlock';\nimport promise from '../promise-middleware';\nimport createResolversCacheMiddleware from '../resolvers-cache-middleware';\nimport createThunkMiddleware from './thunk-middleware';\nimport metadataReducer from './metadata/reducer';\nimport * as metadataSelectors from './metadata/selectors';\nimport * as metadataActions from './metadata/actions';\n\nexport { combineReducers };\n\n/** @typedef {import('../types').DataRegistry} DataRegistry */\n/** @typedef {import('../types').ListenerFunction} ListenerFunction */\n/**\n * @typedef {import('../types').StoreDescriptor<C>} StoreDescriptor\n * @template {import('../types').AnyConfig} C\n */\n/**\n * @typedef {import('../types').ReduxStoreConfig<State,Actions,Selectors>} ReduxStoreConfig\n * @template State\n * @template {Record<string,import('../types').ActionCreator>} Actions\n * @template Selectors\n */\n\nconst trimUndefinedValues = ( array ) => {\n\tconst result = [ ...array ];\n\tfor ( let i = result.length - 1; i >= 0; i-- ) {\n\t\tif ( result[ i ] === undefined ) {\n\t\t\tresult.splice( i, 1 );\n\t\t}\n\t}\n\treturn result;\n};\n\n/**\n * Creates a new object with the same keys, but with `callback()` called as\n * a transformer function on each of the values.\n *\n * @param {Object} obj The object to transform.\n * @param {Function} callback The function to transform each object value.\n * @return {Array} Transformed object.\n */\nconst mapValues = ( obj, callback ) =>\n\tObject.fromEntries(\n\t\tObject.entries( obj ?? {} ).map( ( [ key, value ] ) => [\n\t\t\tkey,\n\t\t\tcallback( value, key ),\n\t\t] )\n\t);\n\n// Convert non serializable types to plain objects\nconst devToolsReplacer = ( key, state ) => {\n\tif ( state instanceof Map ) {\n\t\treturn Object.fromEntries( state );\n\t}\n\n\tif ( state instanceof window.HTMLElement ) {\n\t\treturn null;\n\t}\n\n\treturn state;\n};\n\n/**\n * Create a cache to track whether resolvers started running or not.\n *\n * @return {Object} Resolvers Cache.\n */\nfunction createResolversCache() {\n\tconst cache = {};\n\treturn {\n\t\tisRunning( selectorName, args ) {\n\t\t\treturn (\n\t\t\t\tcache[ selectorName ] &&\n\t\t\t\tcache[ selectorName ].get( trimUndefinedValues( args ) )\n\t\t\t);\n\t\t},\n\n\t\tclear( selectorName, args ) {\n\t\t\tif ( cache[ selectorName ] ) {\n\t\t\t\tcache[ selectorName ].delete( trimUndefinedValues( args ) );\n\t\t\t}\n\t\t},\n\n\t\tmarkAsRunning( selectorName, args ) {\n\t\t\tif ( ! cache[ selectorName ] ) {\n\t\t\t\tcache[ selectorName ] = new EquivalentKeyMap();\n\t\t\t}\n\n\t\t\tcache[ selectorName ].set( trimUndefinedValues( args ), true );\n\t\t},\n\t};\n}\n\nfunction createBindingCache( bind ) {\n\tconst cache = new WeakMap();\n\n\treturn {\n\t\tget( item, itemName ) {\n\t\t\tlet boundItem = cache.get( item );\n\t\t\tif ( ! boundItem ) {\n\t\t\t\tboundItem = bind( item, itemName );\n\t\t\t\tcache.set( item, boundItem );\n\t\t\t}\n\t\t\treturn boundItem;\n\t\t},\n\t};\n}\n\n/**\n * Creates a data store descriptor for the provided Redux store configuration containing\n * properties describing reducer, actions, selectors, controls and resolvers.\n *\n * @example\n * ```js\n * import { createReduxStore } from '@wordpress/data';\n *\n * const store = createReduxStore( 'demo', {\n * reducer: ( state = 'OK' ) => state,\n * selectors: {\n * getValue: ( state ) => state,\n * },\n * } );\n * ```\n *\n * @template State\n * @template {Record<string,import('../types').ActionCreator>} Actions\n * @template Selectors\n * @param {string} key Unique namespace identifier.\n * @param {ReduxStoreConfig<State,Actions,Selectors>} options Registered store options, with properties\n * describing reducer, actions, selectors,\n * and resolvers.\n *\n * @return {StoreDescriptor<ReduxStoreConfig<State,Actions,Selectors>>} Store Object.\n */\nexport default function createReduxStore( key, options ) {\n\tconst privateActions = {};\n\tconst privateSelectors = {};\n\tconst privateRegistrationFunctions = {\n\t\tprivateActions,\n\t\tregisterPrivateActions: ( actions ) => {\n\t\t\tObject.assign( privateActions, actions );\n\t\t},\n\t\tprivateSelectors,\n\t\tregisterPrivateSelectors: ( selectors ) => {\n\t\t\tObject.assign( privateSelectors, selectors );\n\t\t},\n\t};\n\tconst storeDescriptor = {\n\t\tname: key,\n\t\tinstantiate: ( registry ) => {\n\t\t\t/**\n\t\t\t * Stores listener functions registered with `subscribe()`.\n\t\t\t *\n\t\t\t * When functions register to listen to store changes with\n\t\t\t * `subscribe()` they get added here. Although Redux offers\n\t\t\t * its own `subscribe()` function directly, by wrapping the\n\t\t\t * subscription in this store instance it's possible to\n\t\t\t * optimize checking if the state has changed before calling\n\t\t\t * each listener.\n\t\t\t *\n\t\t\t * @type {Set<ListenerFunction>}\n\t\t\t */\n\t\t\tconst listeners = new Set();\n\t\t\tconst reducer = options.reducer;\n\t\t\tconst thunkArgs = {\n\t\t\t\tregistry,\n\t\t\t\tget dispatch() {\n\t\t\t\t\treturn thunkActions;\n\t\t\t\t},\n\t\t\t\tget select() {\n\t\t\t\t\treturn thunkSelectors;\n\t\t\t\t},\n\t\t\t\tget resolveSelect() {\n\t\t\t\t\treturn getResolveSelectors();\n\t\t\t\t},\n\t\t\t};\n\n\t\t\tconst store = instantiateReduxStore(\n\t\t\t\tkey,\n\t\t\t\toptions,\n\t\t\t\tregistry,\n\t\t\t\tthunkArgs\n\t\t\t);\n\t\t\t// Expose the private registration functions on the store\n\t\t\t// so they can be copied to a sub registry in registry.js.\n\t\t\tlock( store, privateRegistrationFunctions );\n\t\t\tconst resolversCache = createResolversCache();\n\n\t\t\tfunction bindAction( action ) {\n\t\t\t\treturn ( ...args ) =>\n\t\t\t\t\tPromise.resolve( store.dispatch( action( ...args ) ) );\n\t\t\t}\n\n\t\t\tconst actions = {\n\t\t\t\t...mapValues( metadataActions, bindAction ),\n\t\t\t\t...mapValues( options.actions, bindAction ),\n\t\t\t};\n\n\t\t\tconst boundPrivateActions = createBindingCache( bindAction );\n\t\t\tconst allActions = new Proxy( () => {}, {\n\t\t\t\tget: ( target, prop ) => {\n\t\t\t\t\tconst privateAction = privateActions[ prop ];\n\t\t\t\t\treturn privateAction\n\t\t\t\t\t\t? boundPrivateActions.get( privateAction, prop )\n\t\t\t\t\t\t: actions[ prop ];\n\t\t\t\t},\n\t\t\t} );\n\n\t\t\tconst thunkActions = new Proxy( allActions, {\n\t\t\t\tapply: ( target, thisArg, [ action ] ) =>\n\t\t\t\t\tstore.dispatch( action ),\n\t\t\t} );\n\n\t\t\tlock( actions, allActions );\n\n\t\t\tconst resolvers = options.resolvers\n\t\t\t\t? mapResolvers( options.resolvers )\n\t\t\t\t: {};\n\n\t\t\tfunction bindSelector( selector, selectorName ) {\n\t\t\t\tif ( selector.isRegistrySelector ) {\n\t\t\t\t\tselector.registry = registry;\n\t\t\t\t}\n\t\t\t\tconst boundSelector = ( ...args ) => {\n\t\t\t\t\targs = normalize( selector, args );\n\t\t\t\t\tconst state = store.__unstableOriginalGetState();\n\t\t\t\t\t// Before calling the selector, switch to the correct\n\t\t\t\t\t// registry.\n\t\t\t\t\tif ( selector.isRegistrySelector ) {\n\t\t\t\t\t\tselector.registry = registry;\n\t\t\t\t\t}\n\t\t\t\t\treturn selector( state.root, ...args );\n\t\t\t\t};\n\n\t\t\t\t// Expose normalization method on the bound selector\n\t\t\t\t// in order that it can be called when fullfilling\n\t\t\t\t// the resolver.\n\t\t\t\tboundSelector.__unstableNormalizeArgs =\n\t\t\t\t\tselector.__unstableNormalizeArgs;\n\n\t\t\t\tconst resolver = resolvers[ selectorName ];\n\n\t\t\t\tif ( ! resolver ) {\n\t\t\t\t\tboundSelector.hasResolver = false;\n\t\t\t\t\treturn boundSelector;\n\t\t\t\t}\n\n\t\t\t\treturn mapSelectorWithResolver(\n\t\t\t\t\tboundSelector,\n\t\t\t\t\tselectorName,\n\t\t\t\t\tresolver,\n\t\t\t\t\tstore,\n\t\t\t\t\tresolversCache\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tfunction bindMetadataSelector( metaDataSelector ) {\n\t\t\t\tconst boundSelector = ( ...args ) => {\n\t\t\t\t\tconst state = store.__unstableOriginalGetState();\n\n\t\t\t\t\tconst originalSelectorName = args && args[ 0 ];\n\t\t\t\t\tconst originalSelectorArgs = args && args[ 1 ];\n\t\t\t\t\tconst targetSelector =\n\t\t\t\t\t\toptions?.selectors?.[ originalSelectorName ];\n\n\t\t\t\t\t// Normalize the arguments passed to the target selector.\n\t\t\t\t\tif ( originalSelectorName && targetSelector ) {\n\t\t\t\t\t\targs[ 1 ] = normalize(\n\t\t\t\t\t\t\ttargetSelector,\n\t\t\t\t\t\t\toriginalSelectorArgs\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\treturn metaDataSelector( state.metadata, ...args );\n\t\t\t\t};\n\t\t\t\tboundSelector.hasResolver = false;\n\t\t\t\treturn boundSelector;\n\t\t\t}\n\n\t\t\tconst selectors = {\n\t\t\t\t...mapValues( metadataSelectors, bindMetadataSelector ),\n\t\t\t\t...mapValues( options.selectors, bindSelector ),\n\t\t\t};\n\n\t\t\tconst boundPrivateSelectors = createBindingCache( bindSelector );\n\n\t\t\t// Pre-bind the private selectors that have been registered by the time of\n\t\t\t// instantiation, so that registry selectors are bound to the registry.\n\t\t\tfor ( const [ selectorName, selector ] of Object.entries(\n\t\t\t\tprivateSelectors\n\t\t\t) ) {\n\t\t\t\tboundPrivateSelectors.get( selector, selectorName );\n\t\t\t}\n\n\t\t\tconst allSelectors = new Proxy( () => {}, {\n\t\t\t\tget: ( target, prop ) => {\n\t\t\t\t\tconst privateSelector = privateSelectors[ prop ];\n\t\t\t\t\treturn privateSelector\n\t\t\t\t\t\t? boundPrivateSelectors.get( privateSelector, prop )\n\t\t\t\t\t\t: selectors[ prop ];\n\t\t\t\t},\n\t\t\t} );\n\n\t\t\tconst thunkSelectors = new Proxy( allSelectors, {\n\t\t\t\tapply: ( target, thisArg, [ selector ] ) =>\n\t\t\t\t\tselector( store.__unstableOriginalGetState() ),\n\t\t\t} );\n\n\t\t\tlock( selectors, allSelectors );\n\n\t\t\tconst resolveSelectors = mapResolveSelectors( selectors, store );\n\t\t\tconst suspendSelectors = mapSuspendSelectors( selectors, store );\n\n\t\t\tconst getSelectors = () => selectors;\n\t\t\tconst getActions = () => actions;\n\t\t\tconst getResolveSelectors = () => resolveSelectors;\n\t\t\tconst getSuspendSelectors = () => suspendSelectors;\n\n\t\t\t// We have some modules monkey-patching the store object\n\t\t\t// It's wrong to do so but until we refactor all of our effects to controls\n\t\t\t// We need to keep the same \"store\" instance here.\n\t\t\tstore.__unstableOriginalGetState = store.getState;\n\t\t\tstore.getState = () => store.__unstableOriginalGetState().root;\n\n\t\t\t// Customize subscribe behavior to call listeners only on effective change,\n\t\t\t// not on every dispatch.\n\t\t\tconst subscribe =\n\t\t\t\tstore &&\n\t\t\t\t( ( listener ) => {\n\t\t\t\t\tlisteners.add( listener );\n\n\t\t\t\t\treturn () => listeners.delete( listener );\n\t\t\t\t} );\n\n\t\t\tlet lastState = store.__unstableOriginalGetState();\n\t\t\tstore.subscribe( () => {\n\t\t\t\tconst state = store.__unstableOriginalGetState();\n\t\t\t\tconst hasChanged = state !== lastState;\n\t\t\t\tlastState = state;\n\n\t\t\t\tif ( hasChanged ) {\n\t\t\t\t\tfor ( const listener of listeners ) {\n\t\t\t\t\t\tlistener();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} );\n\n\t\t\t// This can be simplified to just { subscribe, getSelectors, getActions }\n\t\t\t// Once we remove the use function.\n\t\t\treturn {\n\t\t\t\treducer,\n\t\t\t\tstore,\n\t\t\t\tactions,\n\t\t\t\tselectors,\n\t\t\t\tresolvers,\n\t\t\t\tgetSelectors,\n\t\t\t\tgetResolveSelectors,\n\t\t\t\tgetSuspendSelectors,\n\t\t\t\tgetActions,\n\t\t\t\tsubscribe,\n\t\t\t};\n\t\t},\n\t};\n\n\t// Expose the private registration functions on the store\n\t// descriptor. That's a natural choice since that's where the\n\t// public actions and selectors are stored .\n\tlock( storeDescriptor, privateRegistrationFunctions );\n\n\treturn storeDescriptor;\n}\n\n/**\n * Creates a redux store for a namespace.\n *\n * @param {string} key Unique namespace identifier.\n * @param {Object} options Registered store options, with properties\n * describing reducer, actions, selectors,\n * and resolvers.\n * @param {DataRegistry} registry Registry reference.\n * @param {Object} thunkArgs Argument object for the thunk middleware.\n * @return {Object} Newly created redux store.\n */\nfunction instantiateReduxStore( key, options, registry, thunkArgs ) {\n\tconst controls = {\n\t\t...options.controls,\n\t\t...builtinControls,\n\t};\n\n\tconst normalizedControls = mapValues( controls, ( control ) =>\n\t\tcontrol.isRegistryControl ? control( registry ) : control\n\t);\n\n\tconst middlewares = [\n\t\tcreateResolversCacheMiddleware( registry, key ),\n\t\tpromise,\n\t\tcreateReduxRoutineMiddleware( normalizedControls ),\n\t\tcreateThunkMiddleware( thunkArgs ),\n\t];\n\n\tconst enhancers = [ applyMiddleware( ...middlewares ) ];\n\tif (\n\t\ttypeof window !== 'undefined' &&\n\t\twindow.__REDUX_DEVTOOLS_EXTENSION__\n\t) {\n\t\tenhancers.push(\n\t\t\twindow.__REDUX_DEVTOOLS_EXTENSION__( {\n\t\t\t\tname: key,\n\t\t\t\tinstanceId: key,\n\t\t\t\tserialize: {\n\t\t\t\t\treplacer: devToolsReplacer,\n\t\t\t\t},\n\t\t\t} )\n\t\t);\n\t}\n\n\tconst { reducer, initialState } = options;\n\tconst enhancedReducer = combineReducers( {\n\t\tmetadata: metadataReducer,\n\t\troot: reducer,\n\t} );\n\n\treturn createStore(\n\t\tenhancedReducer,\n\t\t{ root: initialState },\n\t\tcompose( enhancers )\n\t);\n}\n\n/**\n * Maps selectors to functions that return a resolution promise for them\n *\n * @param {Object} selectors Selectors to map.\n * @param {Object} store The redux store the selectors select from.\n *\n * @return {Object} Selectors mapped to their resolution functions.\n */\nfunction mapResolveSelectors( selectors, store ) {\n\tconst {\n\t\tgetIsResolving,\n\t\thasStartedResolution,\n\t\thasFinishedResolution,\n\t\thasResolutionFailed,\n\t\tisResolving,\n\t\tgetCachedResolvers,\n\t\tgetResolutionState,\n\t\tgetResolutionError,\n\t\thasResolvingSelectors,\n\t\tcountSelectorsByStatus,\n\t\t...storeSelectors\n\t} = selectors;\n\n\treturn mapValues( storeSelectors, ( selector, selectorName ) => {\n\t\t// If the selector doesn't have a resolver, just convert the return value\n\t\t// (including exceptions) to a Promise, no additional extra behavior is needed.\n\t\tif ( ! selector.hasResolver ) {\n\t\t\treturn async ( ...args ) => selector.apply( null, args );\n\t\t}\n\n\t\treturn ( ...args ) => {\n\t\t\treturn new Promise( ( resolve, reject ) => {\n\t\t\t\tconst hasFinished = () =>\n\t\t\t\t\tselectors.hasFinishedResolution( selectorName, args );\n\t\t\t\tconst finalize = ( result ) => {\n\t\t\t\t\tconst hasFailed = selectors.hasResolutionFailed(\n\t\t\t\t\t\tselectorName,\n\t\t\t\t\t\targs\n\t\t\t\t\t);\n\t\t\t\t\tif ( hasFailed ) {\n\t\t\t\t\t\tconst error = selectors.getResolutionError(\n\t\t\t\t\t\t\tselectorName,\n\t\t\t\t\t\t\targs\n\t\t\t\t\t\t);\n\t\t\t\t\t\treject( error );\n\t\t\t\t\t} else {\n\t\t\t\t\t\tresolve( result );\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t\tconst getResult = () => selector.apply( null, args );\n\t\t\t\t// Trigger the selector (to trigger the resolver)\n\t\t\t\tconst result = getResult();\n\t\t\t\tif ( hasFinished() ) {\n\t\t\t\t\treturn finalize( result );\n\t\t\t\t}\n\n\t\t\t\tconst unsubscribe = store.subscribe( () => {\n\t\t\t\t\tif ( hasFinished() ) {\n\t\t\t\t\t\tunsubscribe();\n\t\t\t\t\t\tfinalize( getResult() );\n\t\t\t\t\t}\n\t\t\t\t} );\n\t\t\t} );\n\t\t};\n\t} );\n}\n\n/**\n * Maps selectors to functions that throw a suspense promise if not yet resolved.\n *\n * @param {Object} selectors Selectors to map.\n * @param {Object} store The redux store the selectors select from.\n *\n * @return {Object} Selectors mapped to their suspense functions.\n */\nfunction mapSuspendSelectors( selectors, store ) {\n\treturn mapValues( selectors, ( selector, selectorName ) => {\n\t\t// Selector without a resolver doesn't have any extra suspense behavior.\n\t\tif ( ! selector.hasResolver ) {\n\t\t\treturn selector;\n\t\t}\n\n\t\treturn ( ...args ) => {\n\t\t\tconst result = selector.apply( null, args );\n\n\t\t\tif ( selectors.hasFinishedResolution( selectorName, args ) ) {\n\t\t\t\tif ( selectors.hasResolutionFailed( selectorName, args ) ) {\n\t\t\t\t\tthrow selectors.getResolutionError( selectorName, args );\n\t\t\t\t}\n\n\t\t\t\treturn result;\n\t\t\t}\n\n\t\t\tthrow new Promise( ( resolve ) => {\n\t\t\t\tconst unsubscribe = store.subscribe( () => {\n\t\t\t\t\tif (\n\t\t\t\t\t\tselectors.hasFinishedResolution( selectorName, args )\n\t\t\t\t\t) {\n\t\t\t\t\t\tresolve();\n\t\t\t\t\t\tunsubscribe();\n\t\t\t\t\t}\n\t\t\t\t} );\n\t\t\t} );\n\t\t};\n\t} );\n}\n\n/**\n * Convert resolvers to a normalized form, an object with `fulfill` method and\n * optional methods like `isFulfilled`.\n *\n * @param {Object} resolvers Resolver to convert\n */\nfunction mapResolvers( resolvers ) {\n\treturn mapValues( resolvers, ( resolver ) => {\n\t\tif ( resolver.fulfill ) {\n\t\t\treturn resolver;\n\t\t}\n\n\t\treturn {\n\t\t\t...resolver, // Copy the enumerable properties of the resolver function.\n\t\t\tfulfill: resolver, // Add the fulfill method.\n\t\t};\n\t} );\n}\n\n/**\n * Returns a selector with a matched resolver.\n * Resolvers are side effects invoked once per argument set of a given selector call,\n * used in ensuring that the data needs for the selector are satisfied.\n *\n * @param {Object} selector The selector function to be bound.\n * @param {string} selectorName The selector name.\n * @param {Object} resolver Resolver to call.\n * @param {Object} store The redux store to which the resolvers should be mapped.\n * @param {Object} resolversCache Resolvers Cache.\n */\nfunction mapSelectorWithResolver(\n\tselector,\n\tselectorName,\n\tresolver,\n\tstore,\n\tresolversCache\n) {\n\tfunction fulfillSelector( args ) {\n\t\tconst state = store.getState();\n\n\t\tif (\n\t\t\tresolversCache.isRunning( selectorName, args ) ||\n\t\t\t( typeof resolver.isFulfilled === 'function' &&\n\t\t\t\tresolver.isFulfilled( state, ...args ) )\n\t\t) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { metadata } = store.__unstableOriginalGetState();\n\n\t\tif (\n\t\t\tmetadataSelectors.hasStartedResolution(\n\t\t\t\tmetadata,\n\t\t\t\tselectorName,\n\t\t\t\targs\n\t\t\t)\n\t\t) {\n\t\t\treturn;\n\t\t}\n\n\t\tresolversCache.markAsRunning( selectorName, args );\n\n\t\tsetTimeout( async () => {\n\t\t\tresolversCache.clear( selectorName, args );\n\t\t\tstore.dispatch(\n\t\t\t\tmetadataActions.startResolution( selectorName, args )\n\t\t\t);\n\t\t\ttry {\n\t\t\t\tconst action = resolver.fulfill( ...args );\n\t\t\t\tif ( action ) {\n\t\t\t\t\tawait store.dispatch( action );\n\t\t\t\t}\n\t\t\t\tstore.dispatch(\n\t\t\t\t\tmetadataActions.finishResolution( selectorName, args )\n\t\t\t\t);\n\t\t\t} catch ( error ) {\n\t\t\t\tstore.dispatch(\n\t\t\t\t\tmetadataActions.failResolution( selectorName, args, error )\n\t\t\t\t);\n\t\t\t}\n\t\t}, 0 );\n\t}\n\n\tconst selectorResolver = ( ...args ) => {\n\t\targs = normalize( selector, args );\n\t\tfulfillSelector( args );\n\t\treturn selector( ...args );\n\t};\n\tselectorResolver.hasResolver = true;\n\treturn selectorResolver;\n}\n\n/**\n * Applies selector's normalization function to the given arguments\n * if it exists.\n *\n * @param {Object} selector The selector potentially with a normalization method property.\n * @param {Array} args selector arguments to normalize.\n * @return {Array} Potentially normalized arguments.\n */\nfunction normalize( selector, args ) {\n\tif (\n\t\tselector.__unstableNormalizeArgs &&\n\t\ttypeof selector.__unstableNormalizeArgs === 'function' &&\n\t\targs?.length\n\t) {\n\t\treturn selector.__unstableNormalizeArgs( args );\n\t}\n\treturn args;\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,WAAW,EAAEC,eAAe,QAAQ,OAAO;AACpD,OAAOC,gBAAgB,MAAM,oBAAoB;;AAEjD;AACA;AACA;AACA,OAAOC,4BAA4B,MAAM,0BAA0B;AACnE,SAASC,OAAO,QAAQ,oBAAoB;;AAE5C;AACA;AACA;AACA,SAASC,eAAe,QAAQ,oBAAoB;AACpD,SAASC,eAAe,QAAQ,aAAa;AAC7C,SAASC,IAAI,QAAQ,gBAAgB;AACrC,OAAOC,OAAO,MAAM,uBAAuB;AAC3C,OAAOC,8BAA8B,MAAM,+BAA+B;AAC1E,OAAOC,qBAAqB,MAAM,oBAAoB;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CAACoJ,gBAAgB,CAAE3H,YAAY,EAAEC,IAAK,CACtD,CAAC;MACF,CAAC,CAAC,OAAQkH,KAAK,EAAG;QACjB9E,KAAK,CAACN,QAAQ,CACbxD,eAAe,CAACqJ,cAAc,CAAE5H,YAAY,EAAEC,IAAI,EAAEkH,KAAM,CAC3D,CAAC;MACF;IACD,CAAC,EAAE,CAAE,CAAC;EACP;EAEA,MAAMU,gBAAgB,GAAGA,CAAE,GAAG5H,IAAI,KAAM;IACvCA,IAAI,GAAGyD,SAAS,CAAEH,QAAQ,EAAEtD,IAAK,CAAC;IAClCsH,eAAe,CAAEtH,IAAK,CAAC;IACvB,OAAOsD,QAAQ,CAAE,GAAGtD,IAAK,CAAC;EAC3B,CAAC;EACD4H,gBAAgB,CAAC9D,WAAW,GAAG,IAAI;EACnC,OAAO8D,gBAAgB;AACxB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASnE,SAASA,CAAEH,QAAQ,EAAEtD,IAAI,EAAG;EACpC,IACCsD,QAAQ,CAACM,uBAAuB,IAChC,OAAON,QAAQ,CAACM,uBAAuB,KAAK,UAAU,IACtD5D,IAAI,EAAErB,MAAM,EACX;IACD,OAAO2E,QAAQ,CAACM,uBAAuB,CAAE5D,IAAK,CAAC;EAChD;EACA,OAAOA,IAAI;AACZ","ignoreList":[]}
@@ -1,3 +1,4 @@
1
+ /* wp:polyfill */
1
2
  /**
2
3
  * External dependencies
3
4
  */
@@ -1 +1 @@
1
- {"version":3,"names":["EquivalentKeyMap","selectorArgsToStateKey","onSubKey","subKeysIsResolved","state","action","type","nextState","set","args","status","error","resolutionArgs","forEach","idx","resolutionState","undefined","errors","delete","isResolved","selectorName","removedSelector","restState"],"sources":["@wordpress/data/src/redux-store/metadata/reducer.ts"],"sourcesContent":["/**\n * External dependencies\n */\nimport EquivalentKeyMap from 'equivalent-key-map';\nimport type { Reducer } from 'redux';\n\n/**\n * Internal dependencies\n */\nimport { selectorArgsToStateKey, onSubKey } from './utils';\n\ntype Action =\n\t| ReturnType< typeof import('./actions').startResolution >\n\t| ReturnType< typeof import('./actions').finishResolution >\n\t| ReturnType< typeof import('./actions').failResolution >\n\t| ReturnType< typeof import('./actions').startResolutions >\n\t| ReturnType< typeof import('./actions').finishResolutions >\n\t| ReturnType< typeof import('./actions').failResolutions >\n\t| ReturnType< typeof import('./actions').invalidateResolution >\n\t| ReturnType< typeof import('./actions').invalidateResolutionForStore >\n\t| ReturnType<\n\t\t\ttypeof import('./actions').invalidateResolutionForStoreSelector\n\t >;\n\ntype StateKey = unknown[] | unknown;\nexport type StateValue =\n\t| { status: 'resolving' | 'finished' }\n\t| { status: 'error'; error: Error | unknown };\n\nexport type Status = StateValue[ 'status' ];\nexport type State = EquivalentKeyMap< StateKey, StateValue >;\n\n/**\n * Reducer function returning next state for selector resolution of\n * subkeys, object form:\n *\n * selectorName -> EquivalentKeyMap<Array,boolean>\n */\nconst subKeysIsResolved: Reducer< Record< string, State >, Action > = onSubKey<\n\tState,\n\tAction\n>( 'selectorName' )( ( state = new EquivalentKeyMap(), action: Action ) => {\n\tswitch ( action.type ) {\n\t\tcase 'START_RESOLUTION': {\n\t\t\tconst nextState = new EquivalentKeyMap( state );\n\t\t\tnextState.set( selectorArgsToStateKey( action.args ), {\n\t\t\t\tstatus: 'resolving',\n\t\t\t} );\n\t\t\treturn nextState;\n\t\t}\n\t\tcase 'FINISH_RESOLUTION': {\n\t\t\tconst nextState = new EquivalentKeyMap( state );\n\t\t\tnextState.set( selectorArgsToStateKey( action.args ), {\n\t\t\t\tstatus: 'finished',\n\t\t\t} );\n\t\t\treturn nextState;\n\t\t}\n\t\tcase 'FAIL_RESOLUTION': {\n\t\t\tconst nextState = new EquivalentKeyMap( state );\n\t\t\tnextState.set( selectorArgsToStateKey( action.args ), {\n\t\t\t\tstatus: 'error',\n\t\t\t\terror: action.error,\n\t\t\t} );\n\t\t\treturn nextState;\n\t\t}\n\t\tcase 'START_RESOLUTIONS': {\n\t\t\tconst nextState = new EquivalentKeyMap( state );\n\t\t\tfor ( const resolutionArgs of action.args ) {\n\t\t\t\tnextState.set( selectorArgsToStateKey( resolutionArgs ), {\n\t\t\t\t\tstatus: 'resolving',\n\t\t\t\t} );\n\t\t\t}\n\t\t\treturn nextState;\n\t\t}\n\t\tcase 'FINISH_RESOLUTIONS': {\n\t\t\tconst nextState = new EquivalentKeyMap( state );\n\t\t\tfor ( const resolutionArgs of action.args ) {\n\t\t\t\tnextState.set( selectorArgsToStateKey( resolutionArgs ), {\n\t\t\t\t\tstatus: 'finished',\n\t\t\t\t} );\n\t\t\t}\n\t\t\treturn nextState;\n\t\t}\n\t\tcase 'FAIL_RESOLUTIONS': {\n\t\t\tconst nextState = new EquivalentKeyMap( state );\n\t\t\taction.args.forEach( ( resolutionArgs, idx ) => {\n\t\t\t\tconst resolutionState: StateValue = {\n\t\t\t\t\tstatus: 'error',\n\t\t\t\t\terror: undefined,\n\t\t\t\t};\n\n\t\t\t\tconst error = action.errors[ idx ];\n\t\t\t\tif ( error ) {\n\t\t\t\t\tresolutionState.error = error;\n\t\t\t\t}\n\n\t\t\t\tnextState.set(\n\t\t\t\t\tselectorArgsToStateKey( resolutionArgs as unknown[] ),\n\t\t\t\t\tresolutionState\n\t\t\t\t);\n\t\t\t} );\n\t\t\treturn nextState;\n\t\t}\n\t\tcase 'INVALIDATE_RESOLUTION': {\n\t\t\tconst nextState = new EquivalentKeyMap( state );\n\t\t\tnextState.delete( selectorArgsToStateKey( action.args ) );\n\t\t\treturn nextState;\n\t\t}\n\t}\n\treturn state;\n} );\n\n/**\n * Reducer function returning next state for selector resolution, object form:\n *\n * selectorName -> EquivalentKeyMap<Array, boolean>\n *\n * @param state Current state.\n * @param action Dispatched action.\n *\n * @return Next state.\n */\nconst isResolved = ( state: Record< string, State > = {}, action: Action ) => {\n\tswitch ( action.type ) {\n\t\tcase 'INVALIDATE_RESOLUTION_FOR_STORE':\n\t\t\treturn {};\n\t\tcase 'INVALIDATE_RESOLUTION_FOR_STORE_SELECTOR': {\n\t\t\tif ( action.selectorName in state ) {\n\t\t\t\tconst {\n\t\t\t\t\t[ action.selectorName ]: removedSelector,\n\t\t\t\t\t...restState\n\t\t\t\t} = state;\n\t\t\t\treturn restState;\n\t\t\t}\n\t\t\treturn state;\n\t\t}\n\t\tcase 'START_RESOLUTION':\n\t\tcase 'FINISH_RESOLUTION':\n\t\tcase 'FAIL_RESOLUTION':\n\t\tcase 'START_RESOLUTIONS':\n\t\tcase 'FINISH_RESOLUTIONS':\n\t\tcase 'FAIL_RESOLUTIONS':\n\t\tcase 'INVALIDATE_RESOLUTION':\n\t\t\treturn subKeysIsResolved( state, action );\n\t}\n\treturn state;\n};\n\nexport default isResolved;\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,gBAAgB,MAAM,oBAAoB;AAGjD;AACA;AACA;AACA,SAASC,sBAAsB,EAAEC,QAAQ,QAAQ,SAAS;AAuB1D;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,iBAA6D,GAAGD,QAAQ,CAG3E,cAAe,CAAC,CAAE,CAAEE,KAAK,GAAG,IAAIJ,gBAAgB,CAAC,CAAC,EAAEK,MAAc,KAAM;EAC1E,QAASA,MAAM,CAACC,IAAI;IACnB,KAAK,kBAAkB;MAAE;QACxB,MAAMC,SAAS,GAAG,IAAIP,gBAAgB,CAAEI,KAAM,CAAC;QAC/CG,SAAS,CAACC,GAAG,CAAEP,sBAAsB,CAAEI,MAAM,CAACI,IAAK,CAAC,EAAE;UACrDC,MAAM,EAAE;QACT,CAAE,CAAC;QACH,OAAOH,SAAS;MACjB;IACA,KAAK,mBAAmB;MAAE;QACzB,MAAMA,SAAS,GAAG,IAAIP,gBAAgB,CAAEI,KAAM,CAAC;QAC/CG,SAAS,CAACC,GAAG,CAAEP,sBAAsB,CAAEI,MAAM,CAACI,IAAK,CAAC,EAAE;UACrDC,MAAM,EAAE;QACT,CAAE,CAAC;QACH,OAAOH,SAAS;MACjB;IACA,KAAK,iBAAiB;MAAE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C,EACrDG,eACD,CAAC;QACF,CAAE,CAAC;QACH,OAAOR,SAAS;MACjB;IACA,KAAK,uBAAuB;MAAE;QAC7B,MAAMA,SAAS,GAAG,IAAIP,gBAAgB,CAAEI,KAAM,CAAC;QAC/CG,SAAS,CAACW,MAAM,CAAEjB,sBAAsB,CAAEI,MAAM,CAACI,IAAK,CAAE,CAAC;QACzD,OAAOF,SAAS;MACjB;EACD;EACA,OAAOH,KAAK;AACb,CAAE,CAAC;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMe,UAAU,GAAGA,CAAEf,KAA8B,GAAG,CAAC,CAAC,EAAEC,MAAc,KAAM;EAC7E,QAASA,MAAM,CAACC,IAAI;IACnB,KAAK,iCAAiC;MACrC,OAAO,CAAC,CAAC;IACV,KAAK,0CAA0C;MAAE;QAChD,IAAKD,MAAM,CAACe,YAAY,IAAIhB,KAAK,EAAG;UACnC,MAAM;YACL,CAAEC,MAAM,CAACe,YAAY,GAAIC,eAAe;YACxC,GAAGC;UACJ,CAAC,GAAGlB,KAAK;UACT,OAAOkB,SAAS;QACjB;QACA,OAAOlB,KAAK;MACb;IACA,KAAK,kBAAkB;IACvB,KAAK,mBAAmB;IACxB,KAAK,iBAAiB;IACtB,KAAK,mBAAmB;IACxB,KAAK,oBAAoB;IACzB,KAAK,kBAAkB;IACvB,KAAK,uBAAuB;MAC3B,OAAOD,iBAAiB,CAAEC,KAAK,EAAEC,MAAO,CAAC;EAC3C;EACA,OAAOD,KAAK;AACb,CAAC;AAED,eAAee,UAAU","ignoreList":[]}
1
+ {"version":3,"names":["EquivalentKeyMap","selectorArgsToStateKey","onSubKey","subKeysIsResolved","state","action","type","nextState","set","args","status","error","resolutionArgs","forEach","idx","resolutionState","undefined","errors","delete","isResolved","selectorName","removedSelector","restState"],"sources":["@wordpress/data/src/redux-store/metadata/reducer.ts"],"sourcesContent":["/**\n * External dependencies\n */\nimport EquivalentKeyMap from 'equivalent-key-map';\nimport type { Reducer } from 'redux';\n\n/**\n * Internal dependencies\n */\nimport { selectorArgsToStateKey, onSubKey } from './utils';\n\ntype Action =\n\t| ReturnType< typeof import('./actions').startResolution >\n\t| ReturnType< typeof import('./actions').finishResolution >\n\t| ReturnType< typeof import('./actions').failResolution >\n\t| ReturnType< typeof import('./actions').startResolutions >\n\t| ReturnType< typeof import('./actions').finishResolutions >\n\t| ReturnType< typeof import('./actions').failResolutions >\n\t| ReturnType< typeof import('./actions').invalidateResolution >\n\t| ReturnType< typeof import('./actions').invalidateResolutionForStore >\n\t| ReturnType<\n\t\t\ttypeof import('./actions').invalidateResolutionForStoreSelector\n\t >;\n\ntype StateKey = unknown[] | unknown;\nexport type StateValue =\n\t| { status: 'resolving' | 'finished' }\n\t| { status: 'error'; error: Error | unknown };\n\nexport type Status = StateValue[ 'status' ];\nexport type State = EquivalentKeyMap< StateKey, StateValue >;\n\n/**\n * Reducer function returning next state for selector resolution of\n * subkeys, object form:\n *\n * selectorName -> EquivalentKeyMap<Array,boolean>\n */\nconst subKeysIsResolved: Reducer< Record< string, State >, Action > = onSubKey<\n\tState,\n\tAction\n>( 'selectorName' )( ( state = new EquivalentKeyMap(), action: Action ) => {\n\tswitch ( action.type ) {\n\t\tcase 'START_RESOLUTION': {\n\t\t\tconst nextState = new EquivalentKeyMap( state );\n\t\t\tnextState.set( selectorArgsToStateKey( action.args ), {\n\t\t\t\tstatus: 'resolving',\n\t\t\t} );\n\t\t\treturn nextState;\n\t\t}\n\t\tcase 'FINISH_RESOLUTION': {\n\t\t\tconst nextState = new EquivalentKeyMap( state );\n\t\t\tnextState.set( selectorArgsToStateKey( action.args ), {\n\t\t\t\tstatus: 'finished',\n\t\t\t} );\n\t\t\treturn nextState;\n\t\t}\n\t\tcase 'FAIL_RESOLUTION': {\n\t\t\tconst nextState = new EquivalentKeyMap( state );\n\t\t\tnextState.set( selectorArgsToStateKey( action.args ), {\n\t\t\t\tstatus: 'error',\n\t\t\t\terror: action.error,\n\t\t\t} );\n\t\t\treturn nextState;\n\t\t}\n\t\tcase 'START_RESOLUTIONS': {\n\t\t\tconst nextState = new EquivalentKeyMap( state );\n\t\t\tfor ( const resolutionArgs of action.args ) {\n\t\t\t\tnextState.set( selectorArgsToStateKey( resolutionArgs ), {\n\t\t\t\t\tstatus: 'resolving',\n\t\t\t\t} );\n\t\t\t}\n\t\t\treturn nextState;\n\t\t}\n\t\tcase 'FINISH_RESOLUTIONS': {\n\t\t\tconst nextState = new EquivalentKeyMap( state );\n\t\t\tfor ( const resolutionArgs of action.args ) {\n\t\t\t\tnextState.set( selectorArgsToStateKey( resolutionArgs ), {\n\t\t\t\t\tstatus: 'finished',\n\t\t\t\t} );\n\t\t\t}\n\t\t\treturn nextState;\n\t\t}\n\t\tcase 'FAIL_RESOLUTIONS': {\n\t\t\tconst nextState = new EquivalentKeyMap( state );\n\t\t\taction.args.forEach( ( resolutionArgs, idx ) => {\n\t\t\t\tconst resolutionState: StateValue = {\n\t\t\t\t\tstatus: 'error',\n\t\t\t\t\terror: undefined,\n\t\t\t\t};\n\n\t\t\t\tconst error = action.errors[ idx ];\n\t\t\t\tif ( error ) {\n\t\t\t\t\tresolutionState.error = error;\n\t\t\t\t}\n\n\t\t\t\tnextState.set(\n\t\t\t\t\tselectorArgsToStateKey( resolutionArgs as unknown[] ),\n\t\t\t\t\tresolutionState\n\t\t\t\t);\n\t\t\t} );\n\t\t\treturn nextState;\n\t\t}\n\t\tcase 'INVALIDATE_RESOLUTION': {\n\t\t\tconst nextState = new EquivalentKeyMap( state );\n\t\t\tnextState.delete( selectorArgsToStateKey( action.args ) );\n\t\t\treturn nextState;\n\t\t}\n\t}\n\treturn state;\n} );\n\n/**\n * Reducer function returning next state for selector resolution, object form:\n *\n * selectorName -> EquivalentKeyMap<Array, boolean>\n *\n * @param state Current state.\n * @param action Dispatched action.\n *\n * @return Next state.\n */\nconst isResolved = ( state: Record< string, State > = {}, action: Action ) => {\n\tswitch ( action.type ) {\n\t\tcase 'INVALIDATE_RESOLUTION_FOR_STORE':\n\t\t\treturn {};\n\t\tcase 'INVALIDATE_RESOLUTION_FOR_STORE_SELECTOR': {\n\t\t\tif ( action.selectorName in state ) {\n\t\t\t\tconst {\n\t\t\t\t\t[ action.selectorName ]: removedSelector,\n\t\t\t\t\t...restState\n\t\t\t\t} = state;\n\t\t\t\treturn restState;\n\t\t\t}\n\t\t\treturn state;\n\t\t}\n\t\tcase 'START_RESOLUTION':\n\t\tcase 'FINISH_RESOLUTION':\n\t\tcase 'FAIL_RESOLUTION':\n\t\tcase 'START_RESOLUTIONS':\n\t\tcase 'FINISH_RESOLUTIONS':\n\t\tcase 'FAIL_RESOLUTIONS':\n\t\tcase 'INVALIDATE_RESOLUTION':\n\t\t\treturn subKeysIsResolved( state, action );\n\t}\n\treturn state;\n};\n\nexport default isResolved;\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,gBAAgB,MAAM,oBAAoB;AAGjD;AACA;AACA;AACA,SAASC,sBAAsB,EAAEC,QAAQ,QAAQ,SAAS;AAuB1D;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,iBAA6D,GAAGD,QAAQ,CAG3E,cAAe,CAAC,CAAE,CAAEE,KAAK,GAAG,IAAIJ,gBAAgB,CAAC,CAAC,EAAEK,MAAc,KAAM;EAC1E,QAASA,MAAM,CAACC,IAAI;IACnB,KAAK,kBAAkB;MAAE;QACxB,MAAMC,SAAS,GAAG,IAAIP,gBAAgB,CAAEI,KAAM,CAAC;QAC/CG,SAAS,CAACC,GAAG,CAAEP,sBAAsB,CAAEI,MAAM,CAACI,IAAK,CAAC,EAAE;UACrDC,MAAM,EAAE;QACT,CAAE,CAAC;QACH,OAAOH,SAAS;MACjB;IACA,KAAK,mBAAmB;MAAE;QACzB,MAAMA,SAAS,GAAG,IAAIP,gBAAgB,CAAEI,KAAM,CAAC;QAC/CG,SAAS,CAACC,GAAG,CAAEP,sBAAsB,CAAEI,MAAM,CAACI,IAAK,CAAC,EAAE;UACrDC,MAAM,EAAE;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AC9B;UAEAJ,SAAS,CAACC,GAAG,CACZP,sBAAsB,CAAEW,cAA4B,CAAC,EACrDG,eACD,CAAC;QACF,CAAE,CAAC;QACH,OAAOR,SAAS;MACjB;IACA,KAAK,uBAAuB;MAAE;QAC7B,MAAMA,SAAS,GAAG,IAAIP,gBAAgB,CAAEI,KAAM,CAAC;QAC/CG,SAAS,CAACW,MAAM,CAAEjB,sBAAsB,CAAEI,MAAM,CAACI,IAAK,CAAE,CAAC;QACzD,OAAOF,SAAS;MACjB;EACD;EACA,OAAOH,KAAK;AACb,CAAE,CAAC;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMe,UAAU,GAAGA,CAAEf,KAA8B,GAAG,CAAC,CAAC,EAAEC,MAAc,KAAM;EAC7E,QAASA,MAAM,CAACC,IAAI;IACnB,KAAK,iCAAiC;MACrC,OAAO,CAAC,CAAC;IACV,KAAK,0CAA0C;MAAE;QAChD,IAAKD,MAAM,CAACe,YAAY,IAAIhB,KAAK,EAAG;UACnC,MAAM;YACL,CAAEC,MAAM,CAACe,YAAY,GAAIC,eAAe;YACxC,GAAGC;UACJ,CAAC,GAAGlB,KAAK;UACT,OAAOkB,SAAS;QACjB;QACA,OAAOlB,KAAK;MACb;IACA,KAAK,kBAAkB;IACvB,KAAK,mBAAmB;IACxB,KAAK,iBAAiB;IACtB,KAAK,mBAAmB;IACxB,KAAK,oBAAoB;IACzB,KAAK,kBAAkB;IACvB,KAAK,uBAAuB;MAC3B,OAAOD,iBAAiB,CAAEC,KAAK,EAAEC,MAAO,CAAC;EAC3C;EACA,OAAOD,KAAK;AACb,CAAC;AAED,eAAee,UAAU","ignoreList":[]}
@@ -1,3 +1,4 @@
1
+ /* wp:polyfill */
1
2
  /**
2
3
  * WordPress dependencies
3
4
  */
@@ -1 +1 @@
1
- {"version":3,"names":["deprecated","createSelector","selectorArgsToStateKey","getResolutionState","state","selectorName","args","map","get","getIsResolving","since","version","alternative","resolutionState","status","hasStartedResolution","undefined","hasFinishedResolution","hasResolutionFailed","getResolutionError","error","isResolving","getCachedResolvers","hasResolvingSelectors","Object","values","some","selectorState","Array","from","_map","resolution","countSelectorsByStatus","selectorsByStatus","forEach","_resolution$1$status","currentStatus"],"sources":["@wordpress/data/src/redux-store/metadata/selectors.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport { createSelector } from '../../create-selector';\nimport { selectorArgsToStateKey } from './utils';\n\n/** @typedef {Record<string, import('./reducer').State>} State */\n/** @typedef {import('./reducer').StateValue} StateValue */\n/** @typedef {import('./reducer').Status} Status */\n\n/**\n * Returns the raw resolution state value for a given selector name,\n * and arguments set. May be undefined if the selector has never been resolved\n * or not resolved for the given set of arguments, otherwise true or false for\n * resolution started and completed respectively.\n *\n * @param {State} state Data state.\n * @param {string} selectorName Selector name.\n * @param {unknown[]?} args Arguments passed to selector.\n *\n * @return {StateValue|undefined} isResolving value.\n */\nexport function getResolutionState( state, selectorName, args ) {\n\tconst map = state[ selectorName ];\n\tif ( ! map ) {\n\t\treturn;\n\t}\n\n\treturn map.get( selectorArgsToStateKey( args ) );\n}\n\n/**\n * Returns an `isResolving`-like value for a given selector name and arguments set.\n * Its value is either `undefined` if the selector has never been resolved or has been\n * invalidated, or a `true`/`false` boolean value if the resolution is in progress or\n * has finished, respectively.\n *\n * This is a legacy selector that was implemented when the \"raw\" internal data had\n * this `undefined | boolean` format. Nowadays the internal value is an object that\n * can be retrieved with `getResolutionState`.\n *\n * @deprecated\n *\n * @param {State} state Data state.\n * @param {string} selectorName Selector name.\n * @param {unknown[]?} args Arguments passed to selector.\n *\n * @return {boolean | undefined} isResolving value.\n */\nexport function getIsResolving( state, selectorName, args ) {\n\tdeprecated( 'wp.data.select( store ).getIsResolving', {\n\t\tsince: '6.6',\n\t\tversion: '6.8',\n\t\talternative: 'wp.data.select( store ).getResolutionState',\n\t} );\n\n\tconst resolutionState = getResolutionState( state, selectorName, args );\n\treturn resolutionState && resolutionState.status === 'resolving';\n}\n\n/**\n * Returns true if resolution has already been triggered for a given\n * selector name, and arguments set.\n *\n * @param {State} state Data state.\n * @param {string} selectorName Selector name.\n * @param {unknown[]?} args Arguments passed to selector.\n *\n * @return {boolean} Whether resolution has been triggered.\n */\nexport function hasStartedResolution( state, selectorName, args ) {\n\treturn getResolutionState( state, selectorName, args ) !== undefined;\n}\n\n/**\n * Returns true if resolution has completed for a given selector\n * name, and arguments set.\n *\n * @param {State} state Data state.\n * @param {string} selectorName Selector name.\n * @param {unknown[]?} args Arguments passed to selector.\n *\n * @return {boolean} Whether resolution has completed.\n */\nexport function hasFinishedResolution( state, selectorName, args ) {\n\tconst status = getResolutionState( state, selectorName, args )?.status;\n\treturn status === 'finished' || status === 'error';\n}\n\n/**\n * Returns true if resolution has failed for a given selector\n * name, and arguments set.\n *\n * @param {State} state Data state.\n * @param {string} selectorName Selector name.\n * @param {unknown[]?} args Arguments passed to selector.\n *\n * @return {boolean} Has resolution failed\n */\nexport function hasResolutionFailed( state, selectorName, args ) {\n\treturn getResolutionState( state, selectorName, args )?.status === 'error';\n}\n\n/**\n * Returns the resolution error for a given selector name, and arguments set.\n * Note it may be of an Error type, but may also be null, undefined, or anything else\n * that can be `throw`-n.\n *\n * @param {State} state Data state.\n * @param {string} selectorName Selector name.\n * @param {unknown[]?} args Arguments passed to selector.\n *\n * @return {Error|unknown} Last resolution error\n */\nexport function getResolutionError( state, selectorName, args ) {\n\tconst resolutionState = getResolutionState( state, selectorName, args );\n\treturn resolutionState?.status === 'error' ? resolutionState.error : null;\n}\n\n/**\n * Returns true if resolution has been triggered but has not yet completed for\n * a given selector name, and arguments set.\n *\n * @param {State} state Data state.\n * @param {string} selectorName Selector name.\n * @param {unknown[]?} args Arguments passed to selector.\n *\n * @return {boolean} Whether resolution is in progress.\n */\nexport function isResolving( state, selectorName, args ) {\n\treturn (\n\t\tgetResolutionState( state, selectorName, args )?.status === 'resolving'\n\t);\n}\n\n/**\n * Returns the list of the cached resolvers.\n *\n * @param {State} state Data state.\n *\n * @return {State} Resolvers mapped by args and selectorName.\n */\nexport function getCachedResolvers( state ) {\n\treturn state;\n}\n\n/**\n * Whether the store has any currently resolving selectors.\n *\n * @param {State} state Data state.\n *\n * @return {boolean} True if one or more selectors are resolving, false otherwise.\n */\nexport function hasResolvingSelectors( state ) {\n\treturn Object.values( state ).some( ( selectorState ) =>\n\t\t/**\n\t\t * This uses the internal `_map` property of `EquivalentKeyMap` for\n\t\t * optimization purposes, since the `EquivalentKeyMap` implementation\n\t\t * does not support a `.values()` implementation.\n\t\t *\n\t\t * @see https://github.com/aduth/equivalent-key-map\n\t\t */\n\t\tArray.from( selectorState._map.values() ).some(\n\t\t\t( resolution ) => resolution[ 1 ]?.status === 'resolving'\n\t\t)\n\t);\n}\n\n/**\n * Retrieves the total number of selectors, grouped per status.\n *\n * @param {State} state Data state.\n *\n * @return {Object} Object, containing selector totals by status.\n */\nexport const countSelectorsByStatus = createSelector(\n\t( state ) => {\n\t\tconst selectorsByStatus = {};\n\n\t\tObject.values( state ).forEach( ( selectorState ) =>\n\t\t\t/**\n\t\t\t * This uses the internal `_map` property of `EquivalentKeyMap` for\n\t\t\t * optimization purposes, since the `EquivalentKeyMap` implementation\n\t\t\t * does not support a `.values()` implementation.\n\t\t\t *\n\t\t\t * @see https://github.com/aduth/equivalent-key-map\n\t\t\t */\n\t\t\tArray.from( selectorState._map.values() ).forEach(\n\t\t\t\t( resolution ) => {\n\t\t\t\t\tconst currentStatus = resolution[ 1 ]?.status ?? 'error';\n\t\t\t\t\tif ( ! selectorsByStatus[ currentStatus ] ) {\n\t\t\t\t\t\tselectorsByStatus[ currentStatus ] = 0;\n\t\t\t\t\t}\n\t\t\t\t\tselectorsByStatus[ currentStatus ]++;\n\t\t\t\t}\n\t\t\t)\n\t\t);\n\n\t\treturn selectorsByStatus;\n\t},\n\t( state ) => [ state ]\n);\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAO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E,CAAC,CAACC,IAAI,CAC3CK,UAAU,IAAMA,UAAU,CAAE,CAAC,CAAE,EAAEjB,MAAM,KAAK,WAC/C,CACD,CAAC;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMkB,sBAAsB,GAAG/B,cAAc,CACjDG,KAAK,IAAM;EACZ,MAAM6B,iBAAiB,GAAG,CAAC,CAAC;EAE5BT,MAAM,CAACC,MAAM,CAAErB,KAAM,CAAC,CAAC8B,OAAO,CAAIP,aAAa;EAC9C;AACH;AACA;AACA;AACA;AACA;AACA;EACGC,KAAK,CAACC,IAAI,CAAEF,aAAa,CAACG,IAAI,CAACL,MAAM,CAAC,CAAE,CAAC,CAACS,OAAO,CAC9CH,UAAU,IAAM;IAAA,IAAAI,oBAAA;IACjB,MAAMC,aAAa,IAAAD,oBAAA,GAAGJ,UAAU,CAAE,CAAC,CAAE,EAAEjB,MAAM,cAAAqB,oBAAA,cAAAA,oBAAA,GAAI,OAAO;IACxD,IAAK,CAAEF,iBAAiB,CAAEG,aAAa,CAAE,EAAG;MAC3CH,iBAAiB,CAAEG,aAAa,CAAE,GAAG,CAAC;IACvC;IACAH,iBAAiB,CAAEG,aAAa,CAAE,EAAE;EACrC,CACD,CACD,CAAC;EAED,OAAOH,iBAAiB;AACzB,CAAC,EACC7B,KAAK,IAAM,CAAEA,KAAK,CACrB,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["deprecated","createSelector","selectorArgsToStateKey","getResolutionState","state","selectorName","args","map","get","getIsResolving","since","version","alternative","resolutionState","status","hasStartedResolution","undefined","hasFinishedResolution","hasResolutionFailed","getResolutionError","error","isResolving","getCachedResolvers","hasResolvingSelectors","Object","values","some","selectorState","Array","from","_map","resolution","countSelectorsByStatus","selectorsByStatus","forEach","_resolution$1$status","currentStatus"],"sources":["@wordpress/data/src/redux-store/metadata/selectors.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport { createSelector } from '../../create-selector';\nimport { selectorArgsToStateKey } from './utils';\n\n/** @typedef {Record<string, import('./reducer').State>} State */\n/** @typedef {import('./reducer').StateValue} StateValue */\n/** @typedef {import('./reducer').Status} Status */\n\n/**\n * Returns the raw resolution state value for a given selector name,\n * and arguments set. May be undefined if the selector has never been resolved\n * or not resolved for the given set of arguments, otherwise true or false for\n * resolution started and completed respectively.\n *\n * @param {State} state Data state.\n * @param {string} selectorName Selector name.\n * @param {unknown[]?} args Arguments passed to selector.\n *\n * @return {StateValue|undefined} isResolving value.\n */\nexport function getResolutionState( state, selectorName, args ) {\n\tconst map = state[ selectorName ];\n\tif ( ! map ) {\n\t\treturn;\n\t}\n\n\treturn map.get( selectorArgsToStateKey( args ) );\n}\n\n/**\n * Returns an `isResolving`-like value for a given selector name and arguments set.\n * Its value is either `undefined` if the selector has never been resolved or has been\n * invalidated, or a `true`/`false` boolean value if the resolution is in progress or\n * has finished, respectively.\n *\n * This is a legacy selector that was implemented when the \"raw\" internal data had\n * this `undefined | boolean` format. Nowadays the internal value is an object that\n * can be retrieved with `getResolutionState`.\n *\n * @deprecated\n *\n * @param {State} state Data state.\n * @param {string} selectorName Selector name.\n * @param {unknown[]?} args Arguments passed to selector.\n *\n * @return {boolean | undefined} isResolving value.\n */\nexport function getIsResolving( state, selectorName, args ) {\n\tdeprecated( 'wp.data.select( store ).getIsResolving', {\n\t\tsince: '6.6',\n\t\tversion: '6.8',\n\t\talternative: 'wp.data.select( store ).getResolutionState',\n\t} );\n\n\tconst resolutionState = getResolutionState( state, selectorName, args );\n\treturn resolutionState && resolutionState.status === 'resolving';\n}\n\n/**\n * Returns true if resolution has already been triggered for a given\n * selector name, and arguments set.\n *\n * @param {State} state Data state.\n * @param {string} selectorName Selector name.\n * @param {unknown[]?} args Arguments passed to selector.\n *\n * @return {boolean} Whether resolution has been triggered.\n */\nexport function hasStartedResolution( state, selectorName, args ) {\n\treturn getResolutionState( state, selectorName, args ) !== undefined;\n}\n\n/**\n * Returns true if resolution has completed for a given selector\n * name, and arguments set.\n *\n * @param {State} state Data state.\n * @param {string} selectorName Selector name.\n * @param {unknown[]?} args Arguments passed to selector.\n *\n * @return {boolean} Whether resolution has completed.\n */\nexport function hasFinishedResolution( state, selectorName, args ) {\n\tconst status = getResolutionState( state, selectorName, args )?.status;\n\treturn status === 'finished' || status === 'error';\n}\n\n/**\n * Returns true if resolution has failed for a given selector\n * name, and arguments set.\n *\n * @param {State} state Data state.\n * @param {string} selectorName Selector name.\n * @param {unknown[]?} args Arguments passed to selector.\n *\n * @return {boolean} Has resolution failed\n */\nexport function hasResolutionFailed( state, selectorName, args ) {\n\treturn getResolutionState( state, selectorName, args )?.status === 'error';\n}\n\n/**\n * Returns the resolution error for a given selector name, and arguments set.\n * Note it may be of an Error type, but may also be null, undefined, or anything else\n * that can be `throw`-n.\n *\n * @param {State} state Data state.\n * @param {string} selectorName Selector name.\n * @param {unknown[]?} args Arguments passed to selector.\n *\n * @return {Error|unknown} Last resolution error\n */\nexport function getResolutionError( state, selectorName, args ) {\n\tconst resolutionState = getResolutionState( state, selectorName, args );\n\treturn resolutionState?.status === 'error' ? resolutionState.error : null;\n}\n\n/**\n * Returns true if resolution has been triggered but has not yet completed for\n * a given selector name, and arguments set.\n *\n * @param {State} state Data state.\n * @param {string} selectorName Selector name.\n * @param {unknown[]?} args Arguments passed to selector.\n *\n * @return {boolean} Whether resolution is in progress.\n */\nexport function isResolving( state, selectorName, args ) {\n\treturn (\n\t\tgetResolutionState( state, selectorName, args )?.status === 'resolving'\n\t);\n}\n\n/**\n * Returns the list of the cached resolvers.\n *\n * @param {State} state Data state.\n *\n * @return {State} Resolvers mapped by args and selectorName.\n */\nexport function getCachedResolvers( state ) {\n\treturn state;\n}\n\n/**\n * Whether the store has any currently resolving selectors.\n *\n * @param {State} state Data state.\n *\n * @return {boolean} True if one or more selectors are resolving, false otherwise.\n */\nexport function hasResolvingSelectors( state ) {\n\treturn Object.values( state ).some( ( selectorState ) =>\n\t\t/**\n\t\t * This uses the internal `_map` property of `EquivalentKeyMap` for\n\t\t * optimization purposes, since the `EquivalentKeyMap` implementation\n\t\t * does not support a `.values()` implementation.\n\t\t *\n\t\t * @see https://github.com/aduth/equivalent-key-map\n\t\t */\n\t\tArray.from( selectorState._map.values() ).some(\n\t\t\t( resolution ) => resolution[ 1 ]?.status === 'resolving'\n\t\t)\n\t);\n}\n\n/**\n * Retrieves the total number of selectors, grouped per status.\n *\n * @param {State} state Data state.\n *\n * @return {Object} Object, containing selector totals by status.\n */\nexport const countSelectorsByStatus = createSelector(\n\t( state ) => {\n\t\tconst selectorsByStatus = {};\n\n\t\tObject.values( state ).forEach( ( selectorState ) =>\n\t\t\t/**\n\t\t\t * This uses the internal `_map` property of `EquivalentKeyMap` for\n\t\t\t * optimization purposes, since the `EquivalentKeyMap` implementation\n\t\t\t * does not support a `.values()` implementation.\n\t\t\t *\n\t\t\t * @see https://github.com/aduth/equivalent-key-map\n\t\t\t */\n\t\t\tArray.from( selectorState._map.values() ).forEach(\n\t\t\t\t( resolution ) => {\n\t\t\t\t\tconst currentStatus = resolution[ 1 ]?.status ?? 'error';\n\t\t\t\t\tif ( ! selectorsByStatus[ currentStatus ] ) {\n\t\t\t\t\t\tselectorsByStatus[ currentStatus ] = 0;\n\t\t\t\t\t}\n\t\t\t\t\tselectorsByStatus[ currentStatus ]++;\n\t\t\t\t}\n\t\t\t)\n\t\t);\n\n\t\treturn selectorsByStatus;\n\t},\n\t( state ) => [ state ]\n);\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,uBAAuB;;AAE9C;AACA;AACA;AACA,SAASC,cAAc,QAAQ,uBAAuB;AACtD,SAASC,sBAAsB,QAAQ,SAAS;;AAEhD;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,kBAAkBA,CAAEC,KAAK,EAAEC,YAAY,EAAEC,IAAI,EAAG;EAC/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CAACC,MAAM,CAAErB,KAAM,CAAC,CAAC8B,OAAO,CAAIP,aAAa;EAC9C;AACH;AACA;AACA;AACA;AACA;AACA;EACGC,KAAK,CAACC,IAAI,CAAEF,aAAa,CAACG,IAAI,CAACL,MAAM,CAAC,CAAE,CAAC,CAACS,OAAO,CAC9CH,UAAU,IAAM;IAAA,IAAAI,oBAAA;IACjB,MAAMC,aAAa,IAAAD,oBAAA,GAAGJ,UAAU,CAAE,CAAC,CAAE,EAAEjB,MAAM,cAAAqB,oBAAA,cAAAA,oBAAA,GAAI,OAAO;IACxD,IAAK,CAAEF,iBAAiB,CAAEG,aAAa,CAAE,EAAG;MAC3CH,iBAAiB,CAAEG,aAAa,CAAE,GAAG,CAAC;IACvC;IACAH,iBAAiB,CAAEG,aAAa,CAAE,EAAE;EACrC,CACD,CACD,CAAC;EAED,OAAOH,iBAAiB;AACzB,CAAC,EACC7B,KAAK,IAAM,CAAEA,KAAK,CACrB,CAAC","ignoreList":[]}
@@ -1,3 +1,4 @@
1
+ /* wp:polyfill */
1
2
  /**
2
3
  * WordPress dependencies
3
4
  */
@@ -1 +1 @@
1
- {"version":3,"names":["deprecated","createReduxStore","coreDataStore","createEmitter","lock","unlock","getStoreName","storeNameOrDescriptor","name","createRegistry","storeConfigs","parent","stores","emitter","listeningStores","globalListener","emit","subscribe","listener","storeName","store","select","add","getSelectors","__unstableMarkListeningStores","callback","ref","Set","call","current","Array","from","resolveSelect","getResolveSelectors","suspendSelect","getSuspendSelectors","dispatch","getActions","withPlugins","attributes","Object","fromEntries","entries","map","key","attribute","registry","apply","arguments","registerStoreInstance","createStore","console","error","TypeError","currentSubscribe","unsubscribeFromEmitter","unsubscribeFromStore","isPaused","registerPrivateActions","privateActionsOf","registerPrivateSelectors","privateSelectorsOf","e","register","instantiate","registerGenericStore","since","alternative","registerStore","options","reducer","batch","pause","values","forEach","resume","namespaces","use","plugin","config","registryWithPlugins","privateActions","privateSelectors"],"sources":["@wordpress/data/src/registry.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport createReduxStore from './redux-store';\nimport coreDataStore from './store';\nimport { createEmitter } from './utils/emitter';\nimport { lock, unlock } from './lock-unlock';\n\n/** @typedef {import('./types').StoreDescriptor} StoreDescriptor */\n\n/**\n * @typedef {Object} WPDataRegistry An isolated orchestrator of store registrations.\n *\n * @property {Function} registerGenericStore Given a namespace key and settings\n * object, registers a new generic\n * store.\n * @property {Function} registerStore Given a namespace key and settings\n * object, registers a new namespace\n * store.\n * @property {Function} subscribe Given a function callback, invokes\n * the callback on any change to state\n * within any registered store.\n * @property {Function} select Given a namespace key, returns an\n * object of the store's registered\n * selectors.\n * @property {Function} dispatch Given a namespace key, returns an\n * object of the store's registered\n * action dispatchers.\n */\n\n/**\n * @typedef {Object} WPDataPlugin An object of registry function overrides.\n *\n * @property {Function} registerStore registers store.\n */\n\nfunction getStoreName( storeNameOrDescriptor ) {\n\treturn typeof storeNameOrDescriptor === 'string'\n\t\t? storeNameOrDescriptor\n\t\t: storeNameOrDescriptor.name;\n}\n/**\n * Creates a new store registry, given an optional object of initial store\n * configurations.\n *\n * @param {Object} storeConfigs Initial store configurations.\n * @param {Object?} parent Parent registry.\n *\n * @return {WPDataRegistry} Data registry.\n */\nexport function createRegistry( storeConfigs = {}, parent = null ) {\n\tconst stores = {};\n\tconst emitter = createEmitter();\n\tlet listeningStores = null;\n\n\t/**\n\t * Global listener called for each store's update.\n\t */\n\tfunction globalListener() {\n\t\temitter.emit();\n\t}\n\n\t/**\n\t * Subscribe to changes to any data, either in all stores in registry, or\n\t * in one specific store.\n\t *\n\t * @param {Function} listener Listener function.\n\t * @param {string|StoreDescriptor?} storeNameOrDescriptor Optional store name.\n\t *\n\t * @return {Function} Unsubscribe function.\n\t */\n\tconst subscribe = ( listener, storeNameOrDescriptor ) => {\n\t\t// subscribe to all stores\n\t\tif ( ! storeNameOrDescriptor ) {\n\t\t\treturn emitter.subscribe( listener );\n\t\t}\n\n\t\t// subscribe to one store\n\t\tconst storeName = getStoreName( storeNameOrDescriptor );\n\t\tconst store = stores[ storeName ];\n\t\tif ( store ) {\n\t\t\treturn store.subscribe( listener );\n\t\t}\n\n\t\t// Trying to access a store that hasn't been registered,\n\t\t// this is a pattern rarely used but seen in some places.\n\t\t// We fallback to global `subscribe` here for backward-compatibility for now.\n\t\t// See https://github.com/WordPress/gutenberg/pull/27466 for more info.\n\t\tif ( ! parent ) {\n\t\t\treturn emitter.subscribe( listener );\n\t\t}\n\n\t\treturn parent.subscribe( listener, storeNameOrDescriptor );\n\t};\n\n\t/**\n\t * Calls a selector given the current state and extra arguments.\n\t *\n\t * @param {string|StoreDescriptor} storeNameOrDescriptor Unique namespace identifier for the store\n\t * or the store descriptor.\n\t *\n\t * @return {*} The selector's returned value.\n\t */\n\tfunction select( storeNameOrDescriptor ) {\n\t\tconst storeName = getStoreName( storeNameOrDescriptor );\n\t\tlisteningStores?.add( storeName );\n\t\tconst store = stores[ storeName ];\n\t\tif ( store ) {\n\t\t\treturn store.getSelectors();\n\t\t}\n\n\t\treturn parent?.select( storeName );\n\t}\n\n\tfunction __unstableMarkListeningStores( callback, ref ) {\n\t\tlisteningStores = new Set();\n\t\ttry {\n\t\t\treturn callback.call( this );\n\t\t} finally {\n\t\t\tref.current = Array.from( listeningStores );\n\t\t\tlisteningStores = null;\n\t\t}\n\t}\n\n\t/**\n\t * Given a store descriptor, returns an object containing the store's selectors pre-bound to\n\t * state so that you only need to supply additional arguments, and modified so that they return\n\t * promises that resolve to their eventual values, after any resolvers have ran.\n\t *\n\t * @param {StoreDescriptor|string} storeNameOrDescriptor The store descriptor. The legacy calling\n\t * convention of passing the store name is\n\t * also supported.\n\t *\n\t * @return {Object} Each key of the object matches the name of a selector.\n\t */\n\tfunction resolveSelect( storeNameOrDescriptor ) {\n\t\tconst storeName = getStoreName( storeNameOrDescriptor );\n\t\tlisteningStores?.add( storeName );\n\t\tconst store = stores[ storeName ];\n\t\tif ( store ) {\n\t\t\treturn store.getResolveSelectors();\n\t\t}\n\n\t\treturn parent && parent.resolveSelect( storeName );\n\t}\n\n\t/**\n\t * Given a store descriptor, returns an object containing the store's selectors pre-bound to\n\t * state so that you only need to supply additional arguments, and modified so that they throw\n\t * promises in case the selector is not resolved yet.\n\t *\n\t * @param {StoreDescriptor|string} storeNameOrDescriptor The store descriptor. The legacy calling\n\t * convention of passing the store name is\n\t * also supported.\n\t *\n\t * @return {Object} Object containing the store's suspense-wrapped selectors.\n\t */\n\tfunction suspendSelect( storeNameOrDescriptor ) {\n\t\tconst storeName = getStoreName( storeNameOrDescriptor );\n\t\tlisteningStores?.add( storeName );\n\t\tconst store = stores[ storeName ];\n\t\tif ( store ) {\n\t\t\treturn store.getSuspendSelectors();\n\t\t}\n\n\t\treturn parent && parent.suspendSelect( storeName );\n\t}\n\n\t/**\n\t * Returns the available actions for a part of the state.\n\t *\n\t * @param {string|StoreDescriptor} storeNameOrDescriptor Unique namespace identifier for the store\n\t * or the store descriptor.\n\t *\n\t * @return {*} The action's returned value.\n\t */\n\tfunction dispatch( storeNameOrDescriptor ) {\n\t\tconst storeName = getStoreName( storeNameOrDescriptor );\n\t\tconst store = stores[ storeName ];\n\t\tif ( store ) {\n\t\t\treturn store.getActions();\n\t\t}\n\n\t\treturn parent && parent.dispatch( storeName );\n\t}\n\n\t//\n\t// Deprecated\n\t// TODO: Remove this after `use()` is removed.\n\tfunction withPlugins( attributes ) {\n\t\treturn Object.fromEntries(\n\t\t\tObject.entries( attributes ).map( ( [ key, attribute ] ) => {\n\t\t\t\tif ( typeof attribute !== 'function' ) {\n\t\t\t\t\treturn [ key, attribute ];\n\t\t\t\t}\n\t\t\t\treturn [\n\t\t\t\t\tkey,\n\t\t\t\t\tfunction () {\n\t\t\t\t\t\treturn registry[ key ].apply( null, arguments );\n\t\t\t\t\t},\n\t\t\t\t];\n\t\t\t} )\n\t\t);\n\t}\n\n\t/**\n\t * Registers a store instance.\n\t *\n\t * @param {string} name Store registry name.\n\t * @param {Function} createStore Function that creates a store object (getSelectors, getActions, subscribe).\n\t */\n\tfunction registerStoreInstance( name, createStore ) {\n\t\tif ( stores[ name ] ) {\n\t\t\t// eslint-disable-next-line no-console\n\t\t\tconsole.error( 'Store \"' + name + '\" is already registered.' );\n\t\t\treturn stores[ name ];\n\t\t}\n\n\t\tconst store = createStore();\n\n\t\tif ( typeof store.getSelectors !== 'function' ) {\n\t\t\tthrow new TypeError( 'store.getSelectors must be a function' );\n\t\t}\n\t\tif ( typeof store.getActions !== 'function' ) {\n\t\t\tthrow new TypeError( 'store.getActions must be a function' );\n\t\t}\n\t\tif ( typeof store.subscribe !== 'function' ) {\n\t\t\tthrow new TypeError( 'store.subscribe must be a function' );\n\t\t}\n\t\t// The emitter is used to keep track of active listeners when the registry\n\t\t// get paused, that way, when resumed we should be able to call all these\n\t\t// pending listeners.\n\t\tstore.emitter = createEmitter();\n\t\tconst currentSubscribe = store.subscribe;\n\t\tstore.subscribe = ( listener ) => {\n\t\t\tconst unsubscribeFromEmitter = store.emitter.subscribe( listener );\n\t\t\tconst unsubscribeFromStore = currentSubscribe( () => {\n\t\t\t\tif ( store.emitter.isPaused ) {\n\t\t\t\t\tstore.emitter.emit();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tlistener();\n\t\t\t} );\n\n\t\t\treturn () => {\n\t\t\t\tunsubscribeFromStore?.();\n\t\t\t\tunsubscribeFromEmitter?.();\n\t\t\t};\n\t\t};\n\t\tstores[ name ] = store;\n\t\tstore.subscribe( globalListener );\n\n\t\t// Copy private actions and selectors from the parent store.\n\t\tif ( parent ) {\n\t\t\ttry {\n\t\t\t\tunlock( store.store ).registerPrivateActions(\n\t\t\t\t\tunlock( parent ).privateActionsOf( name )\n\t\t\t\t);\n\t\t\t\tunlock( store.store ).registerPrivateSelectors(\n\t\t\t\t\tunlock( parent ).privateSelectorsOf( name )\n\t\t\t\t);\n\t\t\t} catch ( e ) {\n\t\t\t\t// unlock() throws if store.store was not locked.\n\t\t\t\t// The error indicates there's nothing to do here so let's\n\t\t\t\t// ignore it.\n\t\t\t}\n\t\t}\n\n\t\treturn store;\n\t}\n\n\t/**\n\t * Registers a new store given a store descriptor.\n\t *\n\t * @param {StoreDescriptor} store Store descriptor.\n\t */\n\tfunction register( store ) {\n\t\tregisterStoreInstance( store.name, () =>\n\t\t\tstore.instantiate( registry )\n\t\t);\n\t}\n\n\tfunction registerGenericStore( name, store ) {\n\t\tdeprecated( 'wp.data.registerGenericStore', {\n\t\t\tsince: '5.9',\n\t\t\talternative: 'wp.data.register( storeDescriptor )',\n\t\t} );\n\t\tregisterStoreInstance( name, () => store );\n\t}\n\n\t/**\n\t * Registers a standard `@wordpress/data` store.\n\t *\n\t * @param {string} storeName Unique namespace identifier.\n\t * @param {Object} options Store description (reducer, actions, selectors, resolvers).\n\t *\n\t * @return {Object} Registered store object.\n\t */\n\tfunction registerStore( storeName, options ) {\n\t\tif ( ! options.reducer ) {\n\t\t\tthrow new TypeError( 'Must specify store reducer' );\n\t\t}\n\n\t\tconst store = registerStoreInstance( storeName, () =>\n\t\t\tcreateReduxStore( storeName, options ).instantiate( registry )\n\t\t);\n\n\t\treturn store.store;\n\t}\n\n\tfunction batch( callback ) {\n\t\t// If we're already batching, just call the callback.\n\t\tif ( emitter.isPaused ) {\n\t\t\tcallback();\n\t\t\treturn;\n\t\t}\n\n\t\temitter.pause();\n\t\tObject.values( stores ).forEach( ( store ) => store.emitter.pause() );\n\t\ttry {\n\t\t\tcallback();\n\t\t} finally {\n\t\t\temitter.resume();\n\t\t\tObject.values( stores ).forEach( ( store ) =>\n\t\t\t\tstore.emitter.resume()\n\t\t\t);\n\t\t}\n\t}\n\n\tlet registry = {\n\t\tbatch,\n\t\tstores,\n\t\tnamespaces: stores, // TODO: Deprecate/remove this.\n\t\tsubscribe,\n\t\tselect,\n\t\tresolveSelect,\n\t\tsuspendSelect,\n\t\tdispatch,\n\t\tuse,\n\t\tregister,\n\t\tregisterGenericStore,\n\t\tregisterStore,\n\t\t__unstableMarkListeningStores,\n\t};\n\n\t//\n\t// TODO:\n\t// This function will be deprecated as soon as it is no longer internally referenced.\n\tfunction use( plugin, options ) {\n\t\tif ( ! plugin ) {\n\t\t\treturn;\n\t\t}\n\n\t\tregistry = {\n\t\t\t...registry,\n\t\t\t...plugin( registry, options ),\n\t\t};\n\n\t\treturn registry;\n\t}\n\n\tregistry.register( coreDataStore );\n\n\tfor ( const [ name, config ] of Object.entries( storeConfigs ) ) {\n\t\tregistry.register( createReduxStore( name, config ) );\n\t}\n\n\tif ( parent ) {\n\t\tparent.subscribe( globalListener );\n\t}\n\n\tconst registryWithPlugins = withPlugins( registry );\n\tlock( registryWithPlugins, {\n\t\tprivateActionsOf: ( name ) => {\n\t\t\ttry {\n\t\t\t\treturn unlock( stores[ name ].store ).privateActions;\n\t\t\t} catch ( e ) {\n\t\t\t\t// unlock() throws an error the store was not locked – this means\n\t\t\t\t// there no private actions are available\n\t\t\t\treturn {};\n\t\t\t}\n\t\t},\n\t\tprivateSelectorsOf: ( name ) => {\n\t\t\ttry {\n\t\t\t\treturn unlock( stores[ name ].store ).privateSelectors;\n\t\t\t} catch ( e ) {\n\t\t\t\treturn {};\n\t\t\t}\n\t\t},\n\t} );\n\treturn registryWithPlugins;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,uBAAuB;;AAE9C;AACA;AACA;AACA,OAAOC,gBAAgB,MAAM,eAAe;AAC5C,OAAOC,aAAa,MAAM,SAAS;AACnC,SAASC,aAAa,QAAQ,iBAAiB;AAC/C,SAASC,IAAI,EAAEC,MAAM,QAAQ,eAAe;;AAE5C;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,SAASC,YAAYA,CAAEC,qBAAqB,EAAG;EAC9C,OAAO,OAAOA,qBAAqB,KAAK,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CAAEO,MAAM,CAAEJ,IAAI,CAAE,CAACY,KAAM,CAAC,CAAC8D,gBAAgB;MACvD,CAAC,CAAC,OAAQpB,CAAC,EAAG;QACb,OAAO,CAAC,CAAC;MACV;IACD;EACD,CAAE,CAAC;EACH,OAAOkB,mBAAmB;AAC3B","ignoreList":[]}
1
+ {"version":3,"names":["deprecated","createReduxStore","coreDataStore","createEmitter","lock","unlock","getStoreName","storeNameOrDescriptor","name","createRegistry","storeConfigs","parent","stores","emitter","listeningStores","globalListener","emit","subscribe","listener","storeName","store","select","add","getSelectors","__unstableMarkListeningStores","callback","ref","Set","call","current","Array","from","resolveSelect","getResolveSelectors","suspendSelect","getSuspendSelectors","dispatch","getActions","withPlugins","attributes","Object","fromEntries","entries","map","key","attribute","registry","apply","arguments","registerStoreInstance","createStore","console","error","TypeError","currentSubscribe","unsubscribeFromEmitter","unsubscribeFromStore","isPaused","registerPrivateActions","privateActionsOf","registerPrivateSelectors","privateSelectorsOf","e","register","instantiate","registerGenericStore","since","alternative","registerStore","options","reducer","batch","pause","values","forEach","resume","namespaces","use","plugin","config","registryWithPlugins","privateActions","privateSelectors"],"sources":["@wordpress/data/src/registry.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport createReduxStore from './redux-store';\nimport coreDataStore from './store';\nimport { createEmitter } from './utils/emitter';\nimport { lock, unlock } from './lock-unlock';\n\n/** @typedef {import('./types').StoreDescriptor} StoreDescriptor */\n\n/**\n * @typedef {Object} WPDataRegistry An isolated orchestrator of store registrations.\n *\n * @property {Function} registerGenericStore Given a namespace key and settings\n * object, registers a new generic\n * store.\n * @property {Function} registerStore Given a namespace key and settings\n * object, registers a new namespace\n * store.\n * @property {Function} subscribe Given a function callback, invokes\n * the callback on any change to state\n * within any registered store.\n * @property {Function} select Given a namespace key, returns an\n * object of the store's registered\n * selectors.\n * @property {Function} dispatch Given a namespace key, returns an\n * object of the store's registered\n * action dispatchers.\n */\n\n/**\n * @typedef {Object} WPDataPlugin An object of registry function overrides.\n *\n * @property {Function} registerStore registers store.\n */\n\nfunction getStoreName( storeNameOrDescriptor ) {\n\treturn typeof storeNameOrDescriptor === 'string'\n\t\t? storeNameOrDescriptor\n\t\t: storeNameOrDescriptor.name;\n}\n/**\n * Creates a new store registry, given an optional object of initial store\n * configurations.\n *\n * @param {Object} storeConfigs Initial store configurations.\n * @param {Object?} parent Parent registry.\n *\n * @return {WPDataRegistry} Data registry.\n */\nexport function createRegistry( storeConfigs = {}, parent = null ) {\n\tconst stores = {};\n\tconst emitter = createEmitter();\n\tlet listeningStores = null;\n\n\t/**\n\t * Global listener called for each store's update.\n\t */\n\tfunction globalListener() {\n\t\temitter.emit();\n\t}\n\n\t/**\n\t * Subscribe to changes to any data, either in all stores in registry, or\n\t * in one specific store.\n\t *\n\t * @param {Function} listener Listener function.\n\t * @param {string|StoreDescriptor?} storeNameOrDescriptor Optional store name.\n\t *\n\t * @return {Function} Unsubscribe function.\n\t */\n\tconst subscribe = ( listener, storeNameOrDescriptor ) => {\n\t\t// subscribe to all stores\n\t\tif ( ! storeNameOrDescriptor ) {\n\t\t\treturn emitter.subscribe( listener );\n\t\t}\n\n\t\t// subscribe to one store\n\t\tconst storeName = getStoreName( storeNameOrDescriptor );\n\t\tconst store = stores[ storeName ];\n\t\tif ( store ) {\n\t\t\treturn store.subscribe( listener );\n\t\t}\n\n\t\t// Trying to access a store that hasn't been registered,\n\t\t// this is a pattern rarely used but seen in some places.\n\t\t// We fallback to global `subscribe` here for backward-compatibility for now.\n\t\t// See https://github.com/WordPress/gutenberg/pull/27466 for more info.\n\t\tif ( ! parent ) {\n\t\t\treturn emitter.subscribe( listener );\n\t\t}\n\n\t\treturn parent.subscribe( listener, storeNameOrDescriptor );\n\t};\n\n\t/**\n\t * Calls a selector given the current state and extra arguments.\n\t *\n\t * @param {string|StoreDescriptor} storeNameOrDescriptor Unique namespace identifier for the store\n\t * or the store descriptor.\n\t *\n\t * @return {*} The selector's returned value.\n\t */\n\tfunction select( storeNameOrDescriptor ) {\n\t\tconst storeName = getStoreName( storeNameOrDescriptor );\n\t\tlisteningStores?.add( storeName );\n\t\tconst store = stores[ storeName ];\n\t\tif ( store ) {\n\t\t\treturn store.getSelectors();\n\t\t}\n\n\t\treturn parent?.select( storeName );\n\t}\n\n\tfunction __unstableMarkListeningStores( callback, ref ) {\n\t\tlisteningStores = new Set();\n\t\ttry {\n\t\t\treturn callback.call( this );\n\t\t} finally {\n\t\t\tref.current = Array.from( listeningStores );\n\t\t\tlisteningStores = null;\n\t\t}\n\t}\n\n\t/**\n\t * Given a store descriptor, returns an object containing the store's selectors pre-bound to\n\t * state so that you only need to supply additional arguments, and modified so that they return\n\t * promises that resolve to their eventual values, after any resolvers have ran.\n\t *\n\t * @param {StoreDescriptor|string} storeNameOrDescriptor The store descriptor. The legacy calling\n\t * convention of passing the store name is\n\t * also supported.\n\t *\n\t * @return {Object} Each key of the object matches the name of a selector.\n\t */\n\tfunction resolveSelect( storeNameOrDescriptor ) {\n\t\tconst storeName = getStoreName( storeNameOrDescriptor );\n\t\tlisteningStores?.add( storeName );\n\t\tconst store = stores[ storeName ];\n\t\tif ( store ) {\n\t\t\treturn store.getResolveSelectors();\n\t\t}\n\n\t\treturn parent && parent.resolveSelect( storeName );\n\t}\n\n\t/**\n\t * Given a store descriptor, returns an object containing the store's selectors pre-bound to\n\t * state so that you only need to supply additional arguments, and modified so that they throw\n\t * promises in case the selector is not resolved yet.\n\t *\n\t * @param {StoreDescriptor|string} storeNameOrDescriptor The store descriptor. The legacy calling\n\t * convention of passing the store name is\n\t * also supported.\n\t *\n\t * @return {Object} Object containing the store's suspense-wrapped selectors.\n\t */\n\tfunction suspendSelect( storeNameOrDescriptor ) {\n\t\tconst storeName = getStoreName( storeNameOrDescriptor );\n\t\tlisteningStores?.add( storeName );\n\t\tconst store = stores[ storeName ];\n\t\tif ( store ) {\n\t\t\treturn store.getSuspendSelectors();\n\t\t}\n\n\t\treturn parent && parent.suspendSelect( storeName );\n\t}\n\n\t/**\n\t * Returns the available actions for a part of the state.\n\t *\n\t * @param {string|StoreDescriptor} storeNameOrDescriptor Unique namespace identifier for the store\n\t * or the store descriptor.\n\t *\n\t * @return {*} The action's returned value.\n\t */\n\tfunction dispatch( storeNameOrDescriptor ) {\n\t\tconst storeName = getStoreName( storeNameOrDescriptor );\n\t\tconst store = stores[ storeName ];\n\t\tif ( store ) {\n\t\t\treturn store.getActions();\n\t\t}\n\n\t\treturn parent && parent.dispatch( storeName );\n\t}\n\n\t//\n\t// Deprecated\n\t// TODO: Remove this after `use()` is removed.\n\tfunction withPlugins( attributes ) {\n\t\treturn Object.fromEntries(\n\t\t\tObject.entries( attributes ).map( ( [ key, attribute ] ) => {\n\t\t\t\tif ( typeof attribute !== 'function' ) {\n\t\t\t\t\treturn [ key, attribute ];\n\t\t\t\t}\n\t\t\t\treturn [\n\t\t\t\t\tkey,\n\t\t\t\t\tfunction () {\n\t\t\t\t\t\treturn registry[ key ].apply( null, arguments );\n\t\t\t\t\t},\n\t\t\t\t];\n\t\t\t} )\n\t\t);\n\t}\n\n\t/**\n\t * Registers a store instance.\n\t *\n\t * @param {string} name Store registry name.\n\t * @param {Function} createStore Function that creates a store object (getSelectors, getActions, subscribe).\n\t */\n\tfunction registerStoreInstance( name, createStore ) {\n\t\tif ( stores[ name ] ) {\n\t\t\t// eslint-disable-next-line no-console\n\t\t\tconsole.error( 'Store \"' + name + '\" is already registered.' );\n\t\t\treturn stores[ name ];\n\t\t}\n\n\t\tconst store = createStore();\n\n\t\tif ( typeof store.getSelectors !== 'function' ) {\n\t\t\tthrow new TypeError( 'store.getSelectors must be a function' );\n\t\t}\n\t\tif ( typeof store.getActions !== 'function' ) {\n\t\t\tthrow new TypeError( 'store.getActions must be a function' );\n\t\t}\n\t\tif ( typeof store.subscribe !== 'function' ) {\n\t\t\tthrow new TypeError( 'store.subscribe must be a function' );\n\t\t}\n\t\t// The emitter is used to keep track of active listeners when the registry\n\t\t// get paused, that way, when resumed we should be able to call all these\n\t\t// pending listeners.\n\t\tstore.emitter = createEmitter();\n\t\tconst currentSubscribe = store.subscribe;\n\t\tstore.subscribe = ( listener ) => {\n\t\t\tconst unsubscribeFromEmitter = store.emitter.subscribe( listener );\n\t\t\tconst unsubscribeFromStore = currentSubscribe( () => {\n\t\t\t\tif ( store.emitter.isPaused ) {\n\t\t\t\t\tstore.emitter.emit();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tlistener();\n\t\t\t} );\n\n\t\t\treturn () => {\n\t\t\t\tunsubscribeFromStore?.();\n\t\t\t\tunsubscribeFromEmitter?.();\n\t\t\t};\n\t\t};\n\t\tstores[ name ] = store;\n\t\tstore.subscribe( globalListener );\n\n\t\t// Copy private actions and selectors from the parent store.\n\t\tif ( parent ) {\n\t\t\ttry {\n\t\t\t\tunlock( store.store ).registerPrivateActions(\n\t\t\t\t\tunlock( parent ).privateActionsOf( name )\n\t\t\t\t);\n\t\t\t\tunlock( store.store ).registerPrivateSelectors(\n\t\t\t\t\tunlock( parent ).privateSelectorsOf( name )\n\t\t\t\t);\n\t\t\t} catch ( e ) {\n\t\t\t\t// unlock() throws if store.store was not locked.\n\t\t\t\t// The error indicates there's nothing to do here so let's\n\t\t\t\t// ignore it.\n\t\t\t}\n\t\t}\n\n\t\treturn store;\n\t}\n\n\t/**\n\t * Registers a new store given a store descriptor.\n\t *\n\t * @param {StoreDescriptor} store Store descriptor.\n\t */\n\tfunction register( store ) {\n\t\tregisterStoreInstance( store.name, () =>\n\t\t\tstore.instantiate( registry )\n\t\t);\n\t}\n\n\tfunction registerGenericStore( name, store ) {\n\t\tdeprecated( 'wp.data.registerGenericStore', {\n\t\t\tsince: '5.9',\n\t\t\talternative: 'wp.data.register( storeDescriptor )',\n\t\t} );\n\t\tregisterStoreInstance( name, () => store );\n\t}\n\n\t/**\n\t * Registers a standard `@wordpress/data` store.\n\t *\n\t * @param {string} storeName Unique namespace identifier.\n\t * @param {Object} options Store description (reducer, actions, selectors, resolvers).\n\t *\n\t * @return {Object} Registered store object.\n\t */\n\tfunction registerStore( storeName, options ) {\n\t\tif ( ! options.reducer ) {\n\t\t\tthrow new TypeError( 'Must specify store reducer' );\n\t\t}\n\n\t\tconst store = registerStoreInstance( storeName, () =>\n\t\t\tcreateReduxStore( storeName, options ).instantiate( registry )\n\t\t);\n\n\t\treturn store.store;\n\t}\n\n\tfunction batch( callback ) {\n\t\t// If we're already batching, just call the callback.\n\t\tif ( emitter.isPaused ) {\n\t\t\tcallback();\n\t\t\treturn;\n\t\t}\n\n\t\temitter.pause();\n\t\tObject.values( stores ).forEach( ( store ) => store.emitter.pause() );\n\t\ttry {\n\t\t\tcallback();\n\t\t} finally {\n\t\t\temitter.resume();\n\t\t\tObject.values( stores ).forEach( ( store ) =>\n\t\t\t\tstore.emitter.resume()\n\t\t\t);\n\t\t}\n\t}\n\n\tlet registry = {\n\t\tbatch,\n\t\tstores,\n\t\tnamespaces: stores, // TODO: Deprecate/remove this.\n\t\tsubscribe,\n\t\tselect,\n\t\tresolveSelect,\n\t\tsuspendSelect,\n\t\tdispatch,\n\t\tuse,\n\t\tregister,\n\t\tregisterGenericStore,\n\t\tregisterStore,\n\t\t__unstableMarkListeningStores,\n\t};\n\n\t//\n\t// TODO:\n\t// This function will be deprecated as soon as it is no longer internally referenced.\n\tfunction use( plugin, options ) {\n\t\tif ( ! plugin ) {\n\t\t\treturn;\n\t\t}\n\n\t\tregistry = {\n\t\t\t...registry,\n\t\t\t...plugin( registry, options ),\n\t\t};\n\n\t\treturn registry;\n\t}\n\n\tregistry.register( coreDataStore );\n\n\tfor ( const [ name, config ] of Object.entries( storeConfigs ) ) {\n\t\tregistry.register( createReduxStore( name, config ) );\n\t}\n\n\tif ( parent ) {\n\t\tparent.subscribe( globalListener );\n\t}\n\n\tconst registryWithPlugins = withPlugins( registry );\n\tlock( registryWithPlugins, {\n\t\tprivateActionsOf: ( name ) => {\n\t\t\ttry {\n\t\t\t\treturn unlock( stores[ name ].store ).privateActions;\n\t\t\t} catch ( e ) {\n\t\t\t\t// unlock() throws an error the store was not locked – this means\n\t\t\t\t// there no private actions are available\n\t\t\t\treturn {};\n\t\t\t}\n\t\t},\n\t\tprivateSelectorsOf: ( name ) => {\n\t\t\ttry {\n\t\t\t\treturn unlock( stores[ name ].store ).privateSelectors;\n\t\t\t} catch ( e ) {\n\t\t\t\treturn {};\n\t\t\t}\n\t\t},\n\t} );\n\treturn registryWithPlugins;\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,uBAAuB;;AAE9C;AACA;AACA;AACA,OAAOC,gBAAgB,MAAM,eAAe;AAC5C,OAAOC,aAAa,MAAM,SAAS;AACnC,SAASC,aAAa,QAAQ,iBAAiB;AAC/C,SAASC,IAAI,EAAEC,MAAM,QAAQ,eAAe;;AAE5C;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,SAASC,YAAYA,CAAEC,qBAAqB,EAAG;EAC9C,OAAO,OAAOA,qBAAqB,KAAK,QAAQ,GAC7CA,qBAAqB,GACrBA,qBAAqB,CAACC,IAAI;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,cAAcA,CAAEC,YAAY,GAAG,CAAC,CAAC,EAAEC,MAAM,GAAG,IAAI,EAAG;EAClE,MAAMC,MAAM,GAAG,CAAC,CAAC;EACjB,MAAMC,OAAO,GAAGV,aAAa,CAAC,CAAC;EAC/B,IAAIW,eAAe,GAAG,IAAI;;EAE1B;AACD;AACA;EACC,SAASC,cAAcA,CAAA,EAAG;IACzBF,OAAO,CAACG,IAAI,CAAC,CAAC;EACf;;EAEA;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACC,MAAMC,SAAS,GAAGA,CAAEC,QAAQ,EAAEX,qBAAqB,KA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AC;IAED,OAAOvB,QAAQ;EAChB;EAEAA,QAAQ,CAACiB,QAAQ,CAAE7D,aAAc,CAAC;EAElC,KAAM,MAAM,CAAEM,IAAI,EAAEuE,MAAM,CAAE,IAAIvC,MAAM,CAACE,OAAO,CAAEhC,YAAa,CAAC,EAAG;IAChEoC,QAAQ,CAACiB,QAAQ,CAAE9D,gBAAgB,CAAEO,IAAI,EAAEuE,MAAO,CAAE,CAAC;EACtD;EAEA,IAAKpE,MAAM,EAAG;IACbA,MAAM,CAACM,SAAS,CAAEF,cAAe,CAAC;EACnC;EAEA,MAAMiE,mBAAmB,GAAG1C,WAAW,CAAEQ,QAAS,CAAC;EACnD1C,IAAI,CAAE4E,mBAAmB,EAAE;IAC1BrB,gBAAgB,EAAInD,IAAI,IAAM;MAC7B,IAAI;QACH,OAAOH,MAAM,CAAEO,MAAM,CAAEJ,IAAI,CAAE,CAACY,KAAM,CAAC,CAAC6D,cAAc;MACrD,CAAC,CAAC,OAAQnB,CAAC,EAAG;QACb;QACA;QACA,OAAO,CAAC,CAAC;MACV;IACD,CAAC;IACDD,kBAAkB,EAAIrD,IAAI,IAAM;MAC/B,IAAI;QACH,OAAOH,MAAM,CAAEO,MAAM,CAAEJ,IAAI,CAAE,CAACY,KAAM,CAAC,CAAC8D,gBAAgB;MACvD,CAAC,CAAC,OAAQpB,CAAC,EAAG;QACb,OAAO,CAAC,CAAC;MACV;IACD;EACD,CAAE,CAAC;EACH,OAAOkB,mBAAmB;AAC3B","ignoreList":[]}
@@ -1,3 +1,4 @@
1
+ /* wp:polyfill */
1
2
  /** @typedef {import('./registry').WPDataRegistry} WPDataRegistry */
2
3
 
3
4
  /**
@@ -1 +1 @@
1
- {"version":3,"names":["createResolversCacheMiddleware","registry","storeName","next","action","resolvers","select","getCachedResolvers","resolverEntries","Object","entries","forEach","selectorName","resolversByArgs","resolver","stores","shouldInvalidate","value","args","undefined","status","dispatch","invalidateResolution"],"sources":["@wordpress/data/src/resolvers-cache-middleware.js"],"sourcesContent":["/** @typedef {import('./registry').WPDataRegistry} WPDataRegistry */\n\n/**\n * Creates a middleware handling resolvers cache invalidation.\n *\n * @param {WPDataRegistry} registry Registry for which to create the middleware.\n * @param {string} storeName Name of the store for which to create the middleware.\n *\n * @return {Function} Middleware function.\n */\nconst createResolversCacheMiddleware =\n\t( registry, storeName ) => () => ( next ) => ( action ) => {\n\t\tconst resolvers = registry.select( storeName ).getCachedResolvers();\n\t\tconst resolverEntries = Object.entries( resolvers );\n\t\tresolverEntries.forEach( ( [ selectorName, resolversByArgs ] ) => {\n\t\t\tconst resolver =\n\t\t\t\tregistry.stores[ storeName ]?.resolvers?.[ selectorName ];\n\t\t\tif ( ! resolver || ! resolver.shouldInvalidate ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tresolversByArgs.forEach( ( value, args ) => {\n\t\t\t\t// Works around a bug in `EquivalentKeyMap` where `map.delete` merely sets an entry value\n\t\t\t\t// to `undefined` and `map.forEach` then iterates also over these orphaned entries.\n\t\t\t\tif ( value === undefined ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// resolversByArgs is the map Map([ args ] => boolean) storing the cache resolution status for a given selector.\n\t\t\t\t// If the value is \"finished\" or \"error\" it means this resolver has finished its resolution which means we need\n\t\t\t\t// to invalidate it, if it's true it means it's inflight and the invalidation is not necessary.\n\t\t\t\tif ( value.status !== 'finished' && value.status !== 'error' ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif ( ! resolver.shouldInvalidate( action, ...args ) ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Trigger cache invalidation\n\t\t\t\tregistry\n\t\t\t\t\t.dispatch( storeName )\n\t\t\t\t\t.invalidateResolution( selectorName, args );\n\t\t\t} );\n\t\t} );\n\t\treturn next( action );\n\t};\n\nexport default createResolversCacheMiddleware;\n"],"mappings":"AAAA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMA,8BAA8B,GACnCA,CAAEC,QAAQ,EAAEC,SAAS,KAAM,MAAQC,IAAI,IAAQC,MAAM,IAAM;EAC1D,MAAMC,SAAS,GAAGJ,QAAQ,CAACK,MAAM,CAAEJ,SAAU,CAAC,CAACK,kBAAkB,CAAC,CAAC;EACnE,MAAMC,eAAe,GAAGC,MAAM,CAACC,OAAO,CAAEL,SAAU,CAAC;EACnDG,eAAe,CAACG,OAAO,CAAE,CAAE,CAAEC,YAAY,EAAEC,eAAe,CAAE,KAAM;IACjE,MAAMC,QAAQ,GACbb,QAAQ,CAACc,MAAM,CAAEb,SAAS,CAAE,EAAEG,SAAS,GAAIO,YAAY,CAAE;IAC1D,IAAK,CAAEE,QAAQ,IAAI,CAAEA,QAAQ,CAACE,gBAAgB,EAAG;MAChD;IACD;IACAH,eAAe,CAACF,OAAO,CAAE,CAAEM,KAAK,EAAEC,IAAI,KAAM;MAC3C;MACA;MACA,IAAKD,KAAK,KAAKE,SAAS,EAAG;QAC1B;MACD;;MAEA;MACA;MACA;MACA,IAAKF,KAAK,CAACG,MAAM,KAAK,UAAU,IAAIH,KAAK,CAACG,MAAM,KAAK,OAAO,EAAG;QAC9D;MACD;MAEA,IAAK,CAAEN,QAAQ,CAACE,gBAAgB,CAAEZ,MAAM,EAAE,GAAGc,IAAK,CAAC,EAAG;QACrD;MACD;;MAEA;MACAjB,QAAQ,CACNoB,QAAQ,CAAEnB,SAAU,CAAC,CACrBoB,oBAAoB,CAAEV,YAAY,EAAEM,IAAK,CAAC;IAC7C,CAAE,CAAC;EACJ,CAAE,CAAC;EACH,OAAOf,IAAI,CAAEC,MAAO,CAAC;AACtB,CAAC;AAEF,eAAeJ,8BAA8B","ignoreList":[]}
1
+ {"version":3,"names":["createResolversCacheMiddleware","registry","storeName","next","action","resolvers","select","getCachedResolvers","resolverEntries","Object","entries","forEach","selectorName","resolversByArgs","resolver","stores","shouldInvalidate","value","args","undefined","status","dispatch","invalidateResolution"],"sources":["@wordpress/data/src/resolvers-cache-middleware.js"],"sourcesContent":["/** @typedef {import('./registry').WPDataRegistry} WPDataRegistry */\n\n/**\n * Creates a middleware handling resolvers cache invalidation.\n *\n * @param {WPDataRegistry} registry Registry for which to create the middleware.\n * @param {string} storeName Name of the store for which to create the middleware.\n *\n * @return {Function} Middleware function.\n */\nconst createResolversCacheMiddleware =\n\t( registry, storeName ) => () => ( next ) => ( action ) => {\n\t\tconst resolvers = registry.select( storeName ).getCachedResolvers();\n\t\tconst resolverEntries = Object.entries( resolvers );\n\t\tresolverEntries.forEach( ( [ selectorName, resolversByArgs ] ) => {\n\t\t\tconst resolver =\n\t\t\t\tregistry.stores[ storeName ]?.resolvers?.[ selectorName ];\n\t\t\tif ( ! resolver || ! resolver.shouldInvalidate ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tresolversByArgs.forEach( ( value, args ) => {\n\t\t\t\t// Works around a bug in `EquivalentKeyMap` where `map.delete` merely sets an entry value\n\t\t\t\t// to `undefined` and `map.forEach` then iterates also over these orphaned entries.\n\t\t\t\tif ( value === undefined ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// resolversByArgs is the map Map([ args ] => boolean) storing the cache resolution status for a given selector.\n\t\t\t\t// If the value is \"finished\" or \"error\" it means this resolver has finished its resolution which means we need\n\t\t\t\t// to invalidate it, if it's true it means it's inflight and the invalidation is not necessary.\n\t\t\t\tif ( value.status !== 'finished' && value.status !== 'error' ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif ( ! resolver.shouldInvalidate( action, ...args ) ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Trigger cache invalidation\n\t\t\t\tregistry\n\t\t\t\t\t.dispatch( storeName )\n\t\t\t\t\t.invalidateResolution( selectorName, args );\n\t\t\t} );\n\t\t} );\n\t\treturn next( action );\n\t};\n\nexport default createResolversCacheMiddleware;\n"],"mappings":";AAAA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMA,8BAA8B,GACnCA,CAAEC,QAAQ,EAAEC,SAAS,KAAM,MAAQC,IAAI,IAAQC,MAAM,IAAM;EAC1D,MAAMC,SAAS,GAAGJ,QAAQ,CAACK,MAAM,CAAEJ,SAAU,CAAC,CAACK,kBAAkB,CAAC,CAAC;EACnE,MAAMC,eAAe,GAAGC,MAAM,CAACC,OAAO,CAAEL,SAAU,CAAC;EACnDG,eAAe,CAACG,OAAO,CAAE,CAAE,CAAEC,YAAY,EAAEC,eAAe,CAAE,KAAM;IACjE,MAAMC,QAAQ,GACbb,QAAQ,CAACc,MAAM,CAAEb,SAAS,CAAE,EAAEG,SAAS,GAAIO,YAAY,CAAE;IAC1D,IAAK,CAAEE,QAAQ,IAAI,CAAEA,QAAQ,CAACE,gBAAgB,EAAG;MAChD;IACD;IACAH,eAAe,CAACF,OAAO,CAAE,CAAEM,KAAK,EAAEC,IAAI,KAAM;MAC3C;MACA;MACA,IAAKD,KAAK,KAAKE,SAAS,EAAG;QAC1B;MACD;;MAEA;MACA;MACA;MACA,IAAKF,KAAK,CAACG,MAAM,KAAK,UAAU,IAAIH,KAAK,CAACG,MAAM,KAAK,OAAO,EAAG;QAC9D;MACD;MAEA,IAAK,CAAEN,QAAQ,CAACE,gBAAgB,CAAEZ,MAAM,EAAE,GAAGc,IAAK,CAAC,EAAG;QACrD;MACD;;MAEA;MACAjB,QAAQ,CACNoB,QAAQ,CAAEnB,SAAU,CAAC,CACrBoB,oBAAoB,CAAEV,YAAY,EAAEM,IAAK,CAAC;IAC7C,CAAE,CAAC;EACJ,CAAE,CAAC;EACH,OAAOf,IAAI,CAAEC,MAAO,CAAC;AACtB,CAAC;AAEF,eAAeJ,8BAA8B","ignoreList":[]}
@@ -1,3 +1,4 @@
1
+ /* wp:polyfill */
1
2
  /**
2
3
  * Create an event emitter.
3
4
  *
@@ -1 +1 @@
1
- {"version":3,"names":["createEmitter","isPaused","isPending","listeners","Set","notifyListeners","Array","from","forEach","listener","subscribe","add","delete","pause","resume","emit"],"sources":["@wordpress/data/src/utils/emitter.ts"],"sourcesContent":["export interface DataEmitter {\n\temit: VoidFunction;\n\tsubscribe: ( listener: VoidFunction ) => VoidFunction;\n\tpause: VoidFunction;\n\tresume: VoidFunction;\n\tisPaused: boolean;\n}\n\n/**\n * Create an event emitter.\n *\n * @return The event emitter.\n */\nexport function createEmitter(): DataEmitter {\n\tlet isPaused = false;\n\tlet isPending = false;\n\tconst listeners = new Set< VoidFunction >();\n\tconst notifyListeners = () =>\n\t\t// We use Array.from to clone the listeners Set\n\t\t// This ensures that we don't run a listener\n\t\t// that was added as a response to another listener.\n\t\tArray.from( listeners ).forEach( ( listener ) => listener() );\n\n\treturn {\n\t\tget isPaused() {\n\t\t\treturn isPaused;\n\t\t},\n\n\t\tsubscribe( listener ) {\n\t\t\tlisteners.add( listener );\n\t\t\treturn () => listeners.delete( listener );\n\t\t},\n\n\t\tpause() {\n\t\t\tisPaused = true;\n\t\t},\n\n\t\tresume() {\n\t\t\tisPaused = false;\n\t\t\tif ( isPending ) {\n\t\t\t\tisPending = false;\n\t\t\t\tnotifyListeners();\n\t\t\t}\n\t\t},\n\n\t\temit() {\n\t\t\tif ( isPaused ) {\n\t\t\t\tisPending = true;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tnotifyListeners();\n\t\t},\n\t};\n}\n"],"mappings":"AAQA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASA,aAAaA,CAAA,EAAgB;EAC5C,IAAIC,QAAQ,GAAG,KAAK;EACpB,IAAIC,SAAS,GAAG,KAAK;EACrB,MAAMC,SAAS,GAAG,IAAIC,GAAG,CAAiB,CAAC;EAC3C,MAAMC,eAAe,GAAGA,CAAA;EACvB;EACA;EACA;EACAC,KAAK,CAACC,IAAI,CAAEJ,SAAU,CAAC,CAACK,OAAO,CAAIC,QAAQ,IAAMA,QAAQ,CAAC,CAAE,CAAC;EAE9D,OAAO;IACN,IAAIR,QAAQA,CAAA,EAAG;MACd,OAAOA,QAAQ;IAChB,CAAC;IAEDS,SAASA,CAAED,QAAQ,EAAG;MACrBN,SAAS,CAACQ,GAAG,CAAEF,QAAS,CAAC;MACzB,OAAO,MAAMN,SAAS,CAACS,MAAM,CAAEH,QAAS,CAAC;IAC1C,CAAC;IAEDI,KAAKA,CAAA,EAAG;MACPZ,QAAQ,GAAG,IAAI;IAChB,CAAC;IAEDa,MAAMA,CAAA,EAAG;MACRb,QAAQ,GAAG,KAAK;MAChB,IAAKC,SAAS,EAAG;QAChBA,SAAS,GAAG,KAAK;QACjBG,eAAe,CAAC,CAAC;MAClB;IACD,CAAC;IAEDU,IAAIA,CAAA,EAAG;MACN,IAAKd,QAAQ,EAAG;QACfC,SAAS,GAAG,IAAI;QAChB;MACD;MACAG,eAAe,CAAC,CAAC;IAClB;EACD,CAAC;AACF","ignoreList":[]}
1
+ {"version":3,"names":["createEmitter","isPaused","isPending","listeners","Set","notifyListeners","Array","from","forEach","listener","subscribe","add","delete","pause","resume","emit"],"sources":["@wordpress/data/src/utils/emitter.ts"],"sourcesContent":["export interface DataEmitter {\n\temit: VoidFunction;\n\tsubscribe: ( listener: VoidFunction ) => VoidFunction;\n\tpause: VoidFunction;\n\tresume: VoidFunction;\n\tisPaused: boolean;\n}\n\n/**\n * Create an event emitter.\n *\n * @return The event emitter.\n */\nexport function createEmitter(): DataEmitter {\n\tlet isPaused = false;\n\tlet isPending = false;\n\tconst listeners = new Set< VoidFunction >();\n\tconst notifyListeners = () =>\n\t\t// We use Array.from to clone the listeners Set\n\t\t// This ensures that we don't run a listener\n\t\t// that was added as a response to another listener.\n\t\tArray.from( listeners ).forEach( ( listener ) => listener() );\n\n\treturn {\n\t\tget isPaused() {\n\t\t\treturn isPaused;\n\t\t},\n\n\t\tsubscribe( listener ) {\n\t\t\tlisteners.add( listener );\n\t\t\treturn () => listeners.delete( listener );\n\t\t},\n\n\t\tpause() {\n\t\t\tisPaused = true;\n\t\t},\n\n\t\tresume() {\n\t\t\tisPaused = false;\n\t\t\tif ( isPending ) {\n\t\t\t\tisPending = false;\n\t\t\t\tnotifyListeners();\n\t\t\t}\n\t\t},\n\n\t\temit() {\n\t\t\tif ( isPaused ) {\n\t\t\t\tisPending = true;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tnotifyListeners();\n\t\t},\n\t};\n}\n"],"mappings":";AAQA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASA,aAAaA,CAAA,EAAgB;EAC5C,IAAIC,QAAQ,GAAG,KAAK;EACpB,IAAIC,SAAS,GAAG,KAAK;EACrB,MAAMC,SAAS,GAAG,IAAIC,GAAG,CAAiB,CAAC;EAC3C,MAAMC,eAAe,GAAGA,CAAA;EACvB;EACA;EACA;EACAC,KAAK,CAACC,IAAI,CAAEJ,SAAU,CAAC,CAACK,OAAO,CAAIC,QAAQ,IAAMA,QAAQ,CAAC,CAAE,CAAC;EAE9D,OAAO;IACN,IAAIR,QAAQA,CAAA,EAAG;MACd,OAAOA,QAAQ;IAChB,CAAC;IAEDS,SAASA,CAAED,QAAQ,EAAG;MACrBN,SAAS,CAACQ,GAAG,CAAEF,QAAS,CAAC;MACzB,OAAO,MAAMN,SAAS,CAACS,MAAM,CAAEH,QAAS,CAAC;IAC1C,CAAC;IAEDI,KAAKA,CAAA,EAAG;MACPZ,QAAQ,GAAG,IAAI;IAChB,CAAC;IAEDa,MAAMA,CAAA,EAAG;MACRb,QAAQ,GAAG,KAAK;MAChB,IAAKC,SAAS,EAAG;QAChBA,SAAS,GAAG,KAAK;QACjBG,eAAe,CAAC,CAAC;MAClB;IACD,CAAC;IAEDU,IAAIA,CAAA,EAAG;MACN,IAAKd,QAAQ,EAAG;QACfC,SAAS,GAAG,IAAI;QAChB;MACD;MACAG,eAAe,CAAC,CAAC;IAClB;EACD,CAAC;AACF","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/use-select/index.js"],"names":[],"mappings":"AAwOA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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SAA3D,MAAM,CAAC,MAAM,EAAC,OAAO,aAAa,EAAE,aAAa,CAAE,EACpD,SAAS,IAHT,OAAO,aAAa,EAAE,gBAAgB,CAAC,KAAK,EAAC,OAAO,EAAC,SAAS,CAAC;wBAK9D,OAAO,aAAa,EAAE,SAAS;4BAGC,CAAC,SAAjC,SAAS,GAAC,eAAe,CAAC,GAAG,CAAE,IADhC,OAAO,aAAa,EAAE,eAAe,CAAC,CAAC,CAAC"}
@@ -4,9 +4,27 @@ export namespace controls {
4
4
  export { dispatch };
5
5
  }
6
6
  export const builtinControls: {
7
- "@@data/SELECT": Function;
8
- "@@data/RESOLVE_SELECT": Function;
9
- "@@data/DISPATCH": Function;
7
+ "@@data/SELECT": ((registry: any) => ({ storeKey, selectorName, args }: {
8
+ storeKey: any;
9
+ selectorName: any;
10
+ args: any;
11
+ }) => any) & {
12
+ isRegistryControl?: boolean;
13
+ };
14
+ "@@data/RESOLVE_SELECT": ((registry: any) => ({ storeKey, selectorName, args }: {
15
+ storeKey: any;
16
+ selectorName: any;
17
+ args: any;
18
+ }) => any) & {
19
+ isRegistryControl?: boolean;
20
+ };
21
+ "@@data/DISPATCH": ((registry: any) => ({ storeKey, actionName, args }: {
22
+ storeKey: any;
23
+ actionName: any;
24
+ args: any;
25
+ }) => any) & {
26
+ isRegistryControl?: boolean;
27
+ };
10
28
  };
11
29
  export type StoreDescriptor = import("./types").StoreDescriptor<any>;
12
30
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"controls.d.ts","sourceRoot":"","sources":["../src/controls.js"],"names":[],"mappings":";;;;;AAqHA;;;;EAuBE;;AA7HF;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,+CAjBW,MAAM,GAAC,eAAe,gBACtB,MAAM,mBAcL,MAAM,CAWjB;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,sDAjBW,MAAM,GAAC,eAAe,gBACtB,MAAM,mBAcL,MAAM,CAWjB;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,iDAjBW,MAAM,GAAC,eAAe,cACtB,MAAM,mBAcL,MAAM,CAWjB"}
1
+ {"version":3,"file":"controls.d.ts","sourceRoot":"","sources":["../src/controls.js"],"names":[],"mappings":";;;;;AAqHA;;;;;;;;;;;;;;;;;;;;;;EAuBE;;AA7HF;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,+CAjBW,MAAM,GAAC,eAAe,gBACtB,MAAM,mBAcL,MAAM,CAWjB;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,sDAjBW,MAAM,GAAC,eAAe,gBACtB,MAAM,mBAcL,MAAM,CAWjB;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,iDAjBW,MAAM,GAAC,eAAe,cACtB,MAAM,mBAcL,MAAM,CAWjB"}
@@ -1,2 +1,8 @@
1
- export { default as createSelector } from "rememo";
1
+ /**
2
+ * Creates a memoized selector that caches the computed values according to the array of "dependants"
3
+ * and the selector parameters, and recomputes the values only when any of them changes.
4
+ *
5
+ * @see The documentation for the `rememo` package from which the `createSelector` function is reexported.
6
+ */
7
+ export { default as createSelector } from 'rememo';
2
8
  //# sourceMappingURL=create-selector.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"create-selector.d.ts","sourceRoot":"","sources":["../src/create-selector.js"],"names":[],"mappings":""}
1
+ {"version":3,"file":"create-selector.d.ts","sourceRoot":"","sources":["../src/create-selector.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,QAAQ,CAAC"}
@@ -1,3 +1,12 @@
1
+ /**
2
+ * Internal dependencies
3
+ */
4
+ import type { select as globalSelect } from './select';
5
+ type RegistrySelector<Selector extends (...args: any[]) => any> = {
6
+ (...args: Parameters<Selector>): ReturnType<Selector>;
7
+ isRegistrySelector?: boolean;
8
+ registry?: any;
9
+ };
1
10
  /**
2
11
  * Creates a selector function that takes additional curried argument with the
3
12
  * registry `select` function. While a regular selector has signature
@@ -33,12 +42,12 @@
33
42
  * registry as argument. The registry binding happens automatically when registering the selector
34
43
  * with a store.
35
44
  *
36
- * @param {Function} registrySelector Function receiving a registry `select`
37
- * function and returning a state selector.
45
+ * @param registrySelector Function receiving a registry `select`
46
+ * function and returning a state selector.
38
47
  *
39
- * @return {Function} Registry selector that can be registered with a store.
48
+ * @return Registry selector that can be registered with a store.
40
49
  */
41
- export function createRegistrySelector(registrySelector: Function): Function;
50
+ export declare function createRegistrySelector<Selector extends (...args: any[]) => any>(registrySelector: (select: typeof globalSelect) => Selector): RegistrySelector<Selector>;
42
51
  /**
43
52
  * Creates a control function that takes additional curried argument with the `registry` object.
44
53
  * While a regular control has signature
@@ -55,9 +64,14 @@ export function createRegistrySelector(registrySelector: Function): Function;
55
64
  * When registering a control created with `createRegistryControl` with a store, the store
56
65
  * knows which calling convention to use when executing the control.
57
66
  *
58
- * @param {Function} registryControl Function receiving a registry object and returning a control.
67
+ * @param registryControl Function receiving a registry object and returning a control.
59
68
  *
60
- * @return {Function} Registry control that can be registered with a store.
69
+ * @return Registry control that can be registered with a store.
61
70
  */
62
- export function createRegistryControl(registryControl: Function): Function;
71
+ export declare function createRegistryControl<T extends (...args: any) => any>(registryControl: T & {
72
+ isRegistryControl?: boolean;
73
+ }): T & {
74
+ isRegistryControl?: boolean;
75
+ };
76
+ export {};
63
77
  //# sourceMappingURL=factory.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../src/factory.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,6EA4BC;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,2EAIC"}
1
+ {"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../src/factory.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,MAAM,IAAI,YAAY,EAAE,MAAM,UAAU,CAAC;AAEvD,KAAK,gBAAgB,CAAE,QAAQ,SAAS,CAAE,GAAG,IAAI,EAAE,GAAG,EAAE,KAAM,GAAG,IAAK;IACrE,CAAE,GAAG,IAAI,EAAE,UAAU,CAAE,QAAQ,CAAE,GAAI,UAAU,CAAE,QAAQ,CAAE,CAAC;IAC5D,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,QAAQ,CAAC,EAAE,GAAG,CAAC;CACf,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,wBAAgB,sBAAsB,CACrC,QAAQ,SAAS,CAAE,GAAG,IAAI,EAAE,GAAG,EAAE,KAAM,GAAG,EAE1C,gBAAgB,EAAE,CAAE,MAAM,EAAE,OAAO,YAAY,KAAM,QAAQ,GAC3D,gBAAgB,CAAE,QAAQ,CAAE,CA0B9B;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,qBAAqB,CAAE,CAAC,SAAS,CAAE,GAAG,IAAI,EAAE,GAAG,KAAM,GAAG,EACvE,eAAe,EAAE,CAAC,GAAG;IAAE,iBAAiB,CAAC,EAAE,OAAO,CAAA;CAAE;wBAAT,OAAO;EAKlD"}