@wordpress/core-data 6.35.0 → 7.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +9 -1
- package/build/actions.js +6 -2
- package/build/actions.js.map +1 -1
- package/build/entities.js +2 -2
- package/build/entities.js.map +1 -1
- package/build/entity-provider.js +17 -41
- package/build/entity-provider.js.map +1 -1
- package/build/entity-types/theme.js.map +1 -1
- package/build/queried-data/reducer.js +3 -3
- package/build/queried-data/reducer.js.map +1 -1
- package/build/reducer.js +1 -1
- package/build/reducer.js.map +1 -1
- package/build/resolvers.js +4 -3
- package/build/resolvers.js.map +1 -1
- package/build-module/actions.js +6 -2
- package/build-module/actions.js.map +1 -1
- package/build-module/entities.js +2 -2
- package/build-module/entities.js.map +1 -1
- package/build-module/entity-provider.js +16 -38
- package/build-module/entity-provider.js.map +1 -1
- package/build-module/entity-types/theme.js.map +1 -1
- package/build-module/queried-data/reducer.js +3 -3
- package/build-module/queried-data/reducer.js.map +1 -1
- package/build-module/reducer.js +1 -1
- package/build-module/reducer.js.map +1 -1
- package/build-module/resolvers.js +4 -3
- package/build-module/resolvers.js.map +1 -1
- package/build-types/actions.d.ts.map +1 -1
- package/build-types/entity-provider.d.ts.map +1 -1
- package/build-types/entity-types/theme.d.ts +9 -0
- package/build-types/entity-types/theme.d.ts.map +1 -1
- package/build-types/queried-data/reducer.d.ts.map +1 -1
- package/build-types/resolvers.d.ts.map +1 -1
- package/package.json +19 -18
- package/src/actions.js +6 -2
- package/src/entities.js +2 -2
- package/src/entity-provider.js +19 -36
- package/src/entity-types/theme.ts +10 -0
- package/src/queried-data/reducer.js +4 -3
- package/src/reducer.js +1 -1
- package/src/resolvers.js +4 -3
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["capitalCase","pascalCase","apiFetch","__","RichTextData","addEntities","getSyncProvider","DEFAULT_ENTITY_KEY","POST_RAW_ATTRIBUTES","rootEntitiesConfig","label","kind","name","baseURL","baseURLParams","_fields","join","plural","syncConfig","fetch","path","applyChangesToDoc","doc","changes","document","getMap","Object","entries","forEach","key","value","get","set","fromCRDTDoc","toJSON","syncObjectType","getSyncObjectId","context","id","rawAttributes","supportsPagination","transientEdits","blocks","getTitle","record","title","rendered","getRevisionsUrl","parentId","revisionId","additionalEntityConfigLoaders","loadEntities","loadPostTypeEntities","loadTaxonomyEntities","loadSiteEntity","prePersistPostType","persistedRecord","edits","newEdits","status","serialisableBlocksCache","WeakMap","makeBlockAttributesSerializable","attributes","newAttributes","valueOf","makeBlocksSerializable","map","block","innerBlocks","rest","postTypes","postType","_postType$rest_namesp","isTemplate","includes","namespace","rest_namespace","rest_base","selection","mergedEdits","meta","_record$slug","slug","String","__unstablePrePersist","undefined","__unstable_rest_base","has","revisionKey","taxonomies","taxonomy","_taxonomy$rest_namesp","_site$schema$properti","entity","site","method","labels","schema","properties","getMethodName","prefix","kindPrefix","suffix","registerSyncConfigs","configs","register","editSyncConfig","getOrLoadEntitiesConfig","select","dispatch","getEntitiesConfig","hasConfig","getEntityConfig","length","window","__experimentalEnableSync","process","env","IS_GUTENBERG_PLUGIN","loader","find","l"],"sources":["@wordpress/core-data/src/entities.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { capitalCase, pascalCase } from 'change-case';\n\n/**\n * WordPress dependencies\n */\nimport apiFetch from '@wordpress/api-fetch';\nimport { __ } from '@wordpress/i18n';\nimport { RichTextData } from '@wordpress/rich-text';\n\n/**\n * Internal dependencies\n */\nimport { addEntities } from './actions';\nimport { getSyncProvider } from './sync';\n\nexport const DEFAULT_ENTITY_KEY = 'id';\n\nconst POST_RAW_ATTRIBUTES = [ 'title', 'excerpt', 'content' ];\n\nexport const rootEntitiesConfig = [\n\t{\n\t\tlabel: __( 'Base' ),\n\t\tkind: 'root',\n\t\tname: '__unstableBase',\n\t\tbaseURL: '/',\n\t\tbaseURLParams: {\n\t\t\t_fields: [\n\t\t\t\t'description',\n\t\t\t\t'gmt_offset',\n\t\t\t\t'home',\n\t\t\t\t'name',\n\t\t\t\t'site_icon',\n\t\t\t\t'site_icon_url',\n\t\t\t\t'site_logo',\n\t\t\t\t'timezone_string',\n\t\t\t\t'url',\n\t\t\t].join( ',' ),\n\t\t},\n\t\t// The entity doesn't support selecting multiple records.\n\t\t// The property is maintained for backward compatibility.\n\t\tplural: '__unstableBases',\n\t\tsyncConfig: {\n\t\t\tfetch: async () => {\n\t\t\t\treturn apiFetch( { path: '/' } );\n\t\t\t},\n\t\t\tapplyChangesToDoc: ( doc, changes ) => {\n\t\t\t\tconst document = doc.getMap( 'document' );\n\t\t\t\tObject.entries( changes ).forEach( ( [ key, value ] ) => {\n\t\t\t\t\tif ( document.get( key ) !== value ) {\n\t\t\t\t\t\tdocument.set( key, value );\n\t\t\t\t\t}\n\t\t\t\t} );\n\t\t\t},\n\t\t\tfromCRDTDoc: ( doc ) => {\n\t\t\t\treturn doc.getMap( 'document' ).toJSON();\n\t\t\t},\n\t\t},\n\t\tsyncObjectType: 'root/base',\n\t\tgetSyncObjectId: () => 'index',\n\t},\n\t{\n\t\tlabel: __( 'Post Type' ),\n\t\tname: 'postType',\n\t\tkind: 'root',\n\t\tkey: 'slug',\n\t\tbaseURL: '/wp/v2/types',\n\t\tbaseURLParams: { context: 'edit' },\n\t\tplural: 'postTypes',\n\t\tsyncConfig: {\n\t\t\tfetch: async ( id ) => {\n\t\t\t\treturn apiFetch( {\n\t\t\t\t\tpath: `/wp/v2/types/${ id }?context=edit`,\n\t\t\t\t} );\n\t\t\t},\n\t\t\tapplyChangesToDoc: ( doc, changes ) => {\n\t\t\t\tconst document = doc.getMap( 'document' );\n\t\t\t\tObject.entries( changes ).forEach( ( [ key, value ] ) => {\n\t\t\t\t\tif ( document.get( key ) !== value ) {\n\t\t\t\t\t\tdocument.set( key, value );\n\t\t\t\t\t}\n\t\t\t\t} );\n\t\t\t},\n\t\t\tfromCRDTDoc: ( doc ) => {\n\t\t\t\treturn doc.getMap( 'document' ).toJSON();\n\t\t\t},\n\t\t},\n\t\tsyncObjectType: 'root/postType',\n\t\tgetSyncObjectId: ( id ) => id,\n\t},\n\t{\n\t\tname: 'media',\n\t\tkind: 'root',\n\t\tbaseURL: '/wp/v2/media',\n\t\tbaseURLParams: { context: 'edit' },\n\t\tplural: 'mediaItems',\n\t\tlabel: __( 'Media' ),\n\t\trawAttributes: [ 'caption', 'title', 'description' ],\n\t\tsupportsPagination: true,\n\t},\n\t{\n\t\tname: 'taxonomy',\n\t\tkind: 'root',\n\t\tkey: 'slug',\n\t\tbaseURL: '/wp/v2/taxonomies',\n\t\tbaseURLParams: { context: 'edit' },\n\t\tplural: 'taxonomies',\n\t\tlabel: __( 'Taxonomy' ),\n\t},\n\t{\n\t\tname: 'sidebar',\n\t\tkind: 'root',\n\t\tbaseURL: '/wp/v2/sidebars',\n\t\tbaseURLParams: { context: 'edit' },\n\t\tplural: 'sidebars',\n\t\ttransientEdits: { blocks: true },\n\t\tlabel: __( 'Widget areas' ),\n\t},\n\t{\n\t\tname: 'widget',\n\t\tkind: 'root',\n\t\tbaseURL: '/wp/v2/widgets',\n\t\tbaseURLParams: { context: 'edit' },\n\t\tplural: 'widgets',\n\t\ttransientEdits: { blocks: true },\n\t\tlabel: __( 'Widgets' ),\n\t},\n\t{\n\t\tname: 'widgetType',\n\t\tkind: 'root',\n\t\tbaseURL: '/wp/v2/widget-types',\n\t\tbaseURLParams: { context: 'edit' },\n\t\tplural: 'widgetTypes',\n\t\tlabel: __( 'Widget types' ),\n\t},\n\t{\n\t\tlabel: __( 'User' ),\n\t\tname: 'user',\n\t\tkind: 'root',\n\t\tbaseURL: '/wp/v2/users',\n\t\tbaseURLParams: { context: 'edit' },\n\t\tplural: 'users',\n\t},\n\t{\n\t\tname: 'comment',\n\t\tkind: 'root',\n\t\tbaseURL: '/wp/v2/comments',\n\t\tbaseURLParams: { context: 'edit' },\n\t\tplural: 'comments',\n\t\tlabel: __( 'Comment' ),\n\t},\n\t{\n\t\tname: 'menu',\n\t\tkind: 'root',\n\t\tbaseURL: '/wp/v2/menus',\n\t\tbaseURLParams: { context: 'edit' },\n\t\tplural: 'menus',\n\t\tlabel: __( 'Menu' ),\n\t},\n\t{\n\t\tname: 'menuItem',\n\t\tkind: 'root',\n\t\tbaseURL: '/wp/v2/menu-items',\n\t\tbaseURLParams: { context: 'edit' },\n\t\tplural: 'menuItems',\n\t\tlabel: __( 'Menu Item' ),\n\t\trawAttributes: [ 'title' ],\n\t},\n\t{\n\t\tname: 'menuLocation',\n\t\tkind: 'root',\n\t\tbaseURL: '/wp/v2/menu-locations',\n\t\tbaseURLParams: { context: 'edit' },\n\t\tplural: 'menuLocations',\n\t\tlabel: __( 'Menu Location' ),\n\t\tkey: 'name',\n\t},\n\t{\n\t\tlabel: __( 'Global Styles' ),\n\t\tname: 'globalStyles',\n\t\tkind: 'root',\n\t\tbaseURL: '/wp/v2/global-styles',\n\t\tbaseURLParams: { context: 'edit' },\n\t\tplural: 'globalStylesVariations', // Should be different from name.\n\t\tgetTitle: ( record ) => record?.title?.rendered || record?.title,\n\t\tgetRevisionsUrl: ( parentId, revisionId ) =>\n\t\t\t`/wp/v2/global-styles/${ parentId }/revisions${\n\t\t\t\trevisionId ? '/' + revisionId : ''\n\t\t\t}`,\n\t\tsupportsPagination: true,\n\t},\n\t{\n\t\tlabel: __( 'Themes' ),\n\t\tname: 'theme',\n\t\tkind: 'root',\n\t\tbaseURL: '/wp/v2/themes',\n\t\tbaseURLParams: { context: 'edit' },\n\t\tplural: 'themes',\n\t\tkey: 'stylesheet',\n\t},\n\t{\n\t\tlabel: __( 'Plugins' ),\n\t\tname: 'plugin',\n\t\tkind: 'root',\n\t\tbaseURL: '/wp/v2/plugins',\n\t\tbaseURLParams: { context: 'edit' },\n\t\tplural: 'plugins',\n\t\tkey: 'plugin',\n\t},\n\t{\n\t\tlabel: __( 'Status' ),\n\t\tname: 'status',\n\t\tkind: 'root',\n\t\tbaseURL: '/wp/v2/statuses',\n\t\tbaseURLParams: { context: 'edit' },\n\t\tplural: 'statuses',\n\t\tkey: 'slug',\n\t},\n];\n\nexport const additionalEntityConfigLoaders = [\n\t{ kind: 'postType', loadEntities: loadPostTypeEntities },\n\t{ kind: 'taxonomy', loadEntities: loadTaxonomyEntities },\n\t{\n\t\tkind: 'root',\n\t\tname: 'site',\n\t\tplural: 'sites',\n\t\tloadEntities: loadSiteEntity,\n\t},\n];\n\n/**\n * Returns a function to be used to retrieve extra edits to apply before persisting a post type.\n *\n * @param {Object} persistedRecord Already persisted Post\n * @param {Object} edits Edits.\n * @return {Object} Updated edits.\n */\nexport const prePersistPostType = ( persistedRecord, edits ) => {\n\tconst newEdits = {};\n\n\tif ( persistedRecord?.status === 'auto-draft' ) {\n\t\t// Saving an auto-draft should create a draft by default.\n\t\tif ( ! edits.status && ! newEdits.status ) {\n\t\t\tnewEdits.status = 'draft';\n\t\t}\n\n\t\t// Fix the auto-draft default title.\n\t\tif (\n\t\t\t( ! edits.title || edits.title === 'Auto Draft' ) &&\n\t\t\t! newEdits.title &&\n\t\t\t( ! persistedRecord?.title ||\n\t\t\t\tpersistedRecord?.title === 'Auto Draft' )\n\t\t) {\n\t\t\tnewEdits.title = '';\n\t\t}\n\t}\n\n\treturn newEdits;\n};\n\nconst serialisableBlocksCache = new WeakMap();\n\nfunction makeBlockAttributesSerializable( attributes ) {\n\tconst newAttributes = { ...attributes };\n\tfor ( const [ key, value ] of Object.entries( attributes ) ) {\n\t\tif ( value instanceof RichTextData ) {\n\t\t\tnewAttributes[ key ] = value.valueOf();\n\t\t}\n\t}\n\treturn newAttributes;\n}\n\nfunction makeBlocksSerializable( blocks ) {\n\treturn blocks.map( ( block ) => {\n\t\tconst { innerBlocks, attributes, ...rest } = block;\n\t\treturn {\n\t\t\t...rest,\n\t\t\tattributes: makeBlockAttributesSerializable( attributes ),\n\t\t\tinnerBlocks: makeBlocksSerializable( innerBlocks ),\n\t\t};\n\t} );\n}\n\n/**\n * Returns the list of post type entities.\n *\n * @return {Promise} Entities promise\n */\nasync function loadPostTypeEntities() {\n\tconst postTypes = await apiFetch( {\n\t\tpath: '/wp/v2/types?context=view',\n\t} );\n\treturn Object.entries( postTypes ?? {} ).map( ( [ name, postType ] ) => {\n\t\tconst isTemplate = [ 'wp_template', 'wp_template_part' ].includes(\n\t\t\tname\n\t\t);\n\t\tconst namespace = postType?.rest_namespace ?? 'wp/v2';\n\t\treturn {\n\t\t\tkind: 'postType',\n\t\t\tbaseURL: `/${ namespace }/${ postType.rest_base }`,\n\t\t\tbaseURLParams: { context: 'edit' },\n\t\t\tname,\n\t\t\tlabel: postType.name,\n\t\t\ttransientEdits: {\n\t\t\t\tblocks: true,\n\t\t\t\tselection: true,\n\t\t\t},\n\t\t\tmergedEdits: { meta: true },\n\t\t\trawAttributes: POST_RAW_ATTRIBUTES,\n\t\t\tgetTitle: ( record ) =>\n\t\t\t\trecord?.title?.rendered ||\n\t\t\t\trecord?.title ||\n\t\t\t\t( isTemplate\n\t\t\t\t\t? capitalCase( record.slug ?? '' )\n\t\t\t\t\t: String( record.id ) ),\n\t\t\t__unstablePrePersist: isTemplate ? undefined : prePersistPostType,\n\t\t\t__unstable_rest_base: postType.rest_base,\n\t\t\tsyncConfig: {\n\t\t\t\tfetch: async ( id ) => {\n\t\t\t\t\treturn apiFetch( {\n\t\t\t\t\t\tpath: `/${ namespace }/${ postType.rest_base }/${ id }?context=edit`,\n\t\t\t\t\t} );\n\t\t\t\t},\n\t\t\t\tapplyChangesToDoc: ( doc, changes ) => {\n\t\t\t\t\tconst document = doc.getMap( 'document' );\n\n\t\t\t\t\tObject.entries( changes ).forEach( ( [ key, value ] ) => {\n\t\t\t\t\t\tif ( typeof value !== 'function' ) {\n\t\t\t\t\t\t\tif ( key === 'blocks' ) {\n\t\t\t\t\t\t\t\tif ( ! serialisableBlocksCache.has( value ) ) {\n\t\t\t\t\t\t\t\t\tserialisableBlocksCache.set(\n\t\t\t\t\t\t\t\t\t\tvalue,\n\t\t\t\t\t\t\t\t\t\tmakeBlocksSerializable( value )\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tvalue = serialisableBlocksCache.get( value );\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif ( document.get( key ) !== value ) {\n\t\t\t\t\t\t\t\tdocument.set( key, value );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} );\n\t\t\t\t},\n\t\t\t\tfromCRDTDoc: ( doc ) => {\n\t\t\t\t\treturn doc.getMap( 'document' ).toJSON();\n\t\t\t\t},\n\t\t\t},\n\t\t\tsyncObjectType: 'postType/' + postType.name,\n\t\t\tgetSyncObjectId: ( id ) => id,\n\t\t\tsupportsPagination: true,\n\t\t\tgetRevisionsUrl: ( parentId, revisionId ) =>\n\t\t\t\t`/${ namespace }/${\n\t\t\t\t\tpostType.rest_base\n\t\t\t\t}/${ parentId }/revisions${\n\t\t\t\t\trevisionId ? '/' + revisionId : ''\n\t\t\t\t}`,\n\t\t\trevisionKey: isTemplate ? 'wp_id' : DEFAULT_ENTITY_KEY,\n\t\t};\n\t} );\n}\n\n/**\n * Returns the list of the taxonomies entities.\n *\n * @return {Promise} Entities promise\n */\nasync function loadTaxonomyEntities() {\n\tconst taxonomies = await apiFetch( {\n\t\tpath: '/wp/v2/taxonomies?context=view',\n\t} );\n\treturn Object.entries( taxonomies ?? {} ).map( ( [ name, taxonomy ] ) => {\n\t\tconst namespace = taxonomy?.rest_namespace ?? 'wp/v2';\n\t\treturn {\n\t\t\tkind: 'taxonomy',\n\t\t\tbaseURL: `/${ namespace }/${ taxonomy.rest_base }`,\n\t\t\tbaseURLParams: { context: 'edit' },\n\t\t\tname,\n\t\t\tlabel: taxonomy.name,\n\t\t};\n\t} );\n}\n\n/**\n * Returns the Site entity.\n *\n * @return {Promise} Entity promise\n */\nasync function loadSiteEntity() {\n\tconst entity = {\n\t\tlabel: __( 'Site' ),\n\t\tname: 'site',\n\t\tkind: 'root',\n\t\tbaseURL: '/wp/v2/settings',\n\t\tsyncConfig: {\n\t\t\tfetch: async () => {\n\t\t\t\treturn apiFetch( { path: '/wp/v2/settings' } );\n\t\t\t},\n\t\t\tapplyChangesToDoc: ( doc, changes ) => {\n\t\t\t\tconst document = doc.getMap( 'document' );\n\t\t\t\tObject.entries( changes ).forEach( ( [ key, value ] ) => {\n\t\t\t\t\tif ( document.get( key ) !== value ) {\n\t\t\t\t\t\tdocument.set( key, value );\n\t\t\t\t\t}\n\t\t\t\t} );\n\t\t\t},\n\t\t\tfromCRDTDoc: ( doc ) => {\n\t\t\t\treturn doc.getMap( 'document' ).toJSON();\n\t\t\t},\n\t\t},\n\t\tsyncObjectType: 'root/site',\n\t\tgetSyncObjectId: () => 'index',\n\t\tmeta: {},\n\t};\n\n\tconst site = await apiFetch( {\n\t\tpath: entity.baseURL,\n\t\tmethod: 'OPTIONS',\n\t} );\n\n\tconst labels = {};\n\tObject.entries( site?.schema?.properties ?? {} ).forEach(\n\t\t( [ key, value ] ) => {\n\t\t\t// Ignore properties `title` and `type` keys.\n\t\t\tif ( typeof value === 'object' && value.title ) {\n\t\t\t\tlabels[ key ] = value.title;\n\t\t\t}\n\t\t}\n\t);\n\n\treturn [ { ...entity, meta: { labels } } ];\n}\n\n/**\n * Returns the entity's getter method name given its kind and name or plural name.\n *\n * @example\n * ```js\n * const nameSingular = getMethodName( 'root', 'theme', 'get' );\n * // nameSingular is getRootTheme\n *\n * const namePlural = getMethodName( 'root', 'themes', 'set' );\n * // namePlural is setRootThemes\n * ```\n *\n * @param {string} kind Entity kind.\n * @param {string} name Entity name or plural name.\n * @param {string} prefix Function prefix.\n *\n * @return {string} Method name\n */\nexport const getMethodName = ( kind, name, prefix = 'get' ) => {\n\tconst kindPrefix = kind === 'root' ? '' : pascalCase( kind );\n\tconst suffix = pascalCase( name );\n\treturn `${ prefix }${ kindPrefix }${ suffix }`;\n};\n\nfunction registerSyncConfigs( configs ) {\n\tconfigs.forEach( ( { syncObjectType, syncConfig } ) => {\n\t\tgetSyncProvider().register( syncObjectType, syncConfig );\n\t\tconst editSyncConfig = { ...syncConfig };\n\t\tdelete editSyncConfig.fetch;\n\t\tgetSyncProvider().register( syncObjectType + '--edit', editSyncConfig );\n\t} );\n}\n\n/**\n * Loads the entities into the store.\n *\n * Note: The `name` argument is used for `root` entities requiring additional server data.\n *\n * @param {string} kind Kind\n * @param {string} name Name\n * @return {(thunkArgs: object) => Promise<Array>} Entities\n */\nexport const getOrLoadEntitiesConfig =\n\t( kind, name ) =>\n\tasync ( { select, dispatch } ) => {\n\t\tlet configs = select.getEntitiesConfig( kind );\n\t\tconst hasConfig = !! select.getEntityConfig( kind, name );\n\n\t\tif ( configs?.length > 0 && hasConfig ) {\n\t\t\tif ( window.__experimentalEnableSync ) {\n\t\t\t\tif ( process.env.IS_GUTENBERG_PLUGIN ) {\n\t\t\t\t\tregisterSyncConfigs( configs );\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn configs;\n\t\t}\n\n\t\tconst loader = additionalEntityConfigLoaders.find( ( l ) => {\n\t\t\tif ( ! name || ! l.name ) {\n\t\t\t\treturn l.kind === kind;\n\t\t\t}\n\n\t\t\treturn l.kind === kind && l.name === name;\n\t\t} );\n\t\tif ( ! loader ) {\n\t\t\treturn [];\n\t\t}\n\n\t\tconfigs = await loader.loadEntities();\n\t\tif ( window.__experimentalEnableSync ) {\n\t\t\tif ( process.env.IS_GUTENBERG_PLUGIN ) {\n\t\t\t\tregisterSyncConfigs( configs );\n\t\t\t}\n\t\t}\n\n\t\tdispatch( addEntities( configs ) );\n\n\t\treturn configs;\n\t};\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,WAAW,EAAEC,UAAU,QAAQ,aAAa;;AAErD;AACA;AACA;AACA,OAAOC,QAAQ,MAAM,sBAAsB;AAC3C,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,YAAY,QAAQ,sBAAsB;;AAEnD;AACA;AACA;A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IF,SAAS,EAAG;IACvC,IAAKG,MAAM,CAACC,wBAAwB,EAAG;MACtC,IAAKC,OAAO,CAACC,GAAG,CAACC,mBAAmB,EAAG;QACtCf,mBAAmB,CAAEC,OAAQ,CAAC;MAC/B;IACD;IAEA,OAAOA,OAAO;EACf;EAEA,MAAMe,MAAM,GAAGtE,6BAA6B,CAACuE,IAAI,CAAIC,CAAC,IAAM;IAC3D,IAAK,CAAE9G,IAAI,IAAI,CAAE8G,CAAC,CAAC9G,IAAI,EAAG;MACzB,OAAO8G,CAAC,CAAC/G,IAAI,KAAKA,IAAI;IACvB;IAEA,OAAO+G,CAAC,CAAC/G,IAAI,KAAKA,IAAI,IAAI+G,CAAC,CAAC9G,IAAI,KAAKA,IAAI;EAC1C,CAAE,CAAC;EACH,IAAK,CAAE4G,MAAM,EAAG;IACf,OAAO,EAAE;EACV;EAEAf,OAAO,GAAG,MAAMe,MAAM,CAACrE,YAAY,CAAC,CAAC;EACrC,IAAKgE,MAAM,CAACC,wBAAwB,EAAG;IACtC,IAAKC,OAAO,CAACC,GAAG,CAACC,mBAAmB,EAAG;MACtCf,mBAAmB,CAAEC,OAAQ,CAAC;IAC/B;EACD;EAEAK,QAAQ,CAAEzG,WAAW,CAAEoG,OAAQ,CAAE,CAAC;EAElC,OAAOA,OAAO;AACf,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["capitalCase","pascalCase","apiFetch","__","RichTextData","addEntities","getSyncProvider","DEFAULT_ENTITY_KEY","POST_RAW_ATTRIBUTES","rootEntitiesConfig","label","kind","name","baseURL","baseURLParams","_fields","join","plural","syncConfig","fetch","path","applyChangesToDoc","doc","changes","document","getMap","Object","entries","forEach","key","value","get","set","fromCRDTDoc","toJSON","syncObjectType","getSyncObjectId","context","id","rawAttributes","supportsPagination","transientEdits","blocks","getTitle","record","title","rendered","getRevisionsUrl","parentId","revisionId","additionalEntityConfigLoaders","loadEntities","loadPostTypeEntities","loadTaxonomyEntities","loadSiteEntity","prePersistPostType","persistedRecord","edits","newEdits","status","serialisableBlocksCache","WeakMap","makeBlockAttributesSerializable","attributes","newAttributes","valueOf","makeBlocksSerializable","map","block","innerBlocks","rest","postTypes","postType","_postType$rest_namesp","isTemplate","includes","namespace","rest_namespace","rest_base","selection","mergedEdits","meta","_record$slug","slug","String","__unstablePrePersist","undefined","__unstable_rest_base","has","revisionKey","taxonomies","taxonomy","_taxonomy$rest_namesp","_site$schema$properti","entity","site","method","labels","schema","properties","getMethodName","prefix","kindPrefix","suffix","registerSyncConfigs","configs","register","editSyncConfig","getOrLoadEntitiesConfig","select","dispatch","getEntitiesConfig","hasConfig","getEntityConfig","length","window","__experimentalEnableSync","globalThis","IS_GUTENBERG_PLUGIN","loader","find","l"],"sources":["@wordpress/core-data/src/entities.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { capitalCase, pascalCase } from 'change-case';\n\n/**\n * WordPress dependencies\n */\nimport apiFetch from '@wordpress/api-fetch';\nimport { __ } from '@wordpress/i18n';\nimport { RichTextData } from '@wordpress/rich-text';\n\n/**\n * Internal dependencies\n */\nimport { addEntities } from './actions';\nimport { getSyncProvider } from './sync';\n\nexport const DEFAULT_ENTITY_KEY = 'id';\n\nconst POST_RAW_ATTRIBUTES = [ 'title', 'excerpt', 'content' ];\n\nexport const rootEntitiesConfig = [\n\t{\n\t\tlabel: __( 'Base' ),\n\t\tkind: 'root',\n\t\tname: '__unstableBase',\n\t\tbaseURL: '/',\n\t\tbaseURLParams: {\n\t\t\t_fields: [\n\t\t\t\t'description',\n\t\t\t\t'gmt_offset',\n\t\t\t\t'home',\n\t\t\t\t'name',\n\t\t\t\t'site_icon',\n\t\t\t\t'site_icon_url',\n\t\t\t\t'site_logo',\n\t\t\t\t'timezone_string',\n\t\t\t\t'url',\n\t\t\t].join( ',' ),\n\t\t},\n\t\t// The entity doesn't support selecting multiple records.\n\t\t// The property is maintained for backward compatibility.\n\t\tplural: '__unstableBases',\n\t\tsyncConfig: {\n\t\t\tfetch: async () => {\n\t\t\t\treturn apiFetch( { path: '/' } );\n\t\t\t},\n\t\t\tapplyChangesToDoc: ( doc, changes ) => {\n\t\t\t\tconst document = doc.getMap( 'document' );\n\t\t\t\tObject.entries( changes ).forEach( ( [ key, value ] ) => {\n\t\t\t\t\tif ( document.get( key ) !== value ) {\n\t\t\t\t\t\tdocument.set( key, value );\n\t\t\t\t\t}\n\t\t\t\t} );\n\t\t\t},\n\t\t\tfromCRDTDoc: ( doc ) => {\n\t\t\t\treturn doc.getMap( 'document' ).toJSON();\n\t\t\t},\n\t\t},\n\t\tsyncObjectType: 'root/base',\n\t\tgetSyncObjectId: () => 'index',\n\t},\n\t{\n\t\tlabel: __( 'Post Type' ),\n\t\tname: 'postType',\n\t\tkind: 'root',\n\t\tkey: 'slug',\n\t\tbaseURL: '/wp/v2/types',\n\t\tbaseURLParams: { context: 'edit' },\n\t\tplural: 'postTypes',\n\t\tsyncConfig: {\n\t\t\tfetch: async ( id ) => {\n\t\t\t\treturn apiFetch( {\n\t\t\t\t\tpath: `/wp/v2/types/${ id }?context=edit`,\n\t\t\t\t} );\n\t\t\t},\n\t\t\tapplyChangesToDoc: ( doc, changes ) => {\n\t\t\t\tconst document = doc.getMap( 'document' );\n\t\t\t\tObject.entries( changes ).forEach( ( [ key, value ] ) => {\n\t\t\t\t\tif ( document.get( key ) !== value ) {\n\t\t\t\t\t\tdocument.set( key, value );\n\t\t\t\t\t}\n\t\t\t\t} );\n\t\t\t},\n\t\t\tfromCRDTDoc: ( doc ) => {\n\t\t\t\treturn doc.getMap( 'document' ).toJSON();\n\t\t\t},\n\t\t},\n\t\tsyncObjectType: 'root/postType',\n\t\tgetSyncObjectId: ( id ) => id,\n\t},\n\t{\n\t\tname: 'media',\n\t\tkind: 'root',\n\t\tbaseURL: '/wp/v2/media',\n\t\tbaseURLParams: { context: 'edit' },\n\t\tplural: 'mediaItems',\n\t\tlabel: __( 'Media' ),\n\t\trawAttributes: [ 'caption', 'title', 'description' ],\n\t\tsupportsPagination: true,\n\t},\n\t{\n\t\tname: 'taxonomy',\n\t\tkind: 'root',\n\t\tkey: 'slug',\n\t\tbaseURL: '/wp/v2/taxonomies',\n\t\tbaseURLParams: { context: 'edit' },\n\t\tplural: 'taxonomies',\n\t\tlabel: __( 'Taxonomy' ),\n\t},\n\t{\n\t\tname: 'sidebar',\n\t\tkind: 'root',\n\t\tbaseURL: '/wp/v2/sidebars',\n\t\tbaseURLParams: { context: 'edit' },\n\t\tplural: 'sidebars',\n\t\ttransientEdits: { blocks: true },\n\t\tlabel: __( 'Widget areas' ),\n\t},\n\t{\n\t\tname: 'widget',\n\t\tkind: 'root',\n\t\tbaseURL: '/wp/v2/widgets',\n\t\tbaseURLParams: { context: 'edit' },\n\t\tplural: 'widgets',\n\t\ttransientEdits: { blocks: true },\n\t\tlabel: __( 'Widgets' ),\n\t},\n\t{\n\t\tname: 'widgetType',\n\t\tkind: 'root',\n\t\tbaseURL: '/wp/v2/widget-types',\n\t\tbaseURLParams: { context: 'edit' },\n\t\tplural: 'widgetTypes',\n\t\tlabel: __( 'Widget types' ),\n\t},\n\t{\n\t\tlabel: __( 'User' ),\n\t\tname: 'user',\n\t\tkind: 'root',\n\t\tbaseURL: '/wp/v2/users',\n\t\tbaseURLParams: { context: 'edit' },\n\t\tplural: 'users',\n\t},\n\t{\n\t\tname: 'comment',\n\t\tkind: 'root',\n\t\tbaseURL: '/wp/v2/comments',\n\t\tbaseURLParams: { context: 'edit' },\n\t\tplural: 'comments',\n\t\tlabel: __( 'Comment' ),\n\t},\n\t{\n\t\tname: 'menu',\n\t\tkind: 'root',\n\t\tbaseURL: '/wp/v2/menus',\n\t\tbaseURLParams: { context: 'edit' },\n\t\tplural: 'menus',\n\t\tlabel: __( 'Menu' ),\n\t},\n\t{\n\t\tname: 'menuItem',\n\t\tkind: 'root',\n\t\tbaseURL: '/wp/v2/menu-items',\n\t\tbaseURLParams: { context: 'edit' },\n\t\tplural: 'menuItems',\n\t\tlabel: __( 'Menu Item' ),\n\t\trawAttributes: [ 'title' ],\n\t},\n\t{\n\t\tname: 'menuLocation',\n\t\tkind: 'root',\n\t\tbaseURL: '/wp/v2/menu-locations',\n\t\tbaseURLParams: { context: 'edit' },\n\t\tplural: 'menuLocations',\n\t\tlabel: __( 'Menu Location' ),\n\t\tkey: 'name',\n\t},\n\t{\n\t\tlabel: __( 'Global Styles' ),\n\t\tname: 'globalStyles',\n\t\tkind: 'root',\n\t\tbaseURL: '/wp/v2/global-styles',\n\t\tbaseURLParams: { context: 'edit' },\n\t\tplural: 'globalStylesVariations', // Should be different from name.\n\t\tgetTitle: ( record ) => record?.title?.rendered || record?.title,\n\t\tgetRevisionsUrl: ( parentId, revisionId ) =>\n\t\t\t`/wp/v2/global-styles/${ parentId }/revisions${\n\t\t\t\trevisionId ? '/' + revisionId : ''\n\t\t\t}`,\n\t\tsupportsPagination: true,\n\t},\n\t{\n\t\tlabel: __( 'Themes' ),\n\t\tname: 'theme',\n\t\tkind: 'root',\n\t\tbaseURL: '/wp/v2/themes',\n\t\tbaseURLParams: { context: 'edit' },\n\t\tplural: 'themes',\n\t\tkey: 'stylesheet',\n\t},\n\t{\n\t\tlabel: __( 'Plugins' ),\n\t\tname: 'plugin',\n\t\tkind: 'root',\n\t\tbaseURL: '/wp/v2/plugins',\n\t\tbaseURLParams: { context: 'edit' },\n\t\tplural: 'plugins',\n\t\tkey: 'plugin',\n\t},\n\t{\n\t\tlabel: __( 'Status' ),\n\t\tname: 'status',\n\t\tkind: 'root',\n\t\tbaseURL: '/wp/v2/statuses',\n\t\tbaseURLParams: { context: 'edit' },\n\t\tplural: 'statuses',\n\t\tkey: 'slug',\n\t},\n];\n\nexport const additionalEntityConfigLoaders = [\n\t{ kind: 'postType', loadEntities: loadPostTypeEntities },\n\t{ kind: 'taxonomy', loadEntities: loadTaxonomyEntities },\n\t{\n\t\tkind: 'root',\n\t\tname: 'site',\n\t\tplural: 'sites',\n\t\tloadEntities: loadSiteEntity,\n\t},\n];\n\n/**\n * Returns a function to be used to retrieve extra edits to apply before persisting a post type.\n *\n * @param {Object} persistedRecord Already persisted Post\n * @param {Object} edits Edits.\n * @return {Object} Updated edits.\n */\nexport const prePersistPostType = ( persistedRecord, edits ) => {\n\tconst newEdits = {};\n\n\tif ( persistedRecord?.status === 'auto-draft' ) {\n\t\t// Saving an auto-draft should create a draft by default.\n\t\tif ( ! edits.status && ! newEdits.status ) {\n\t\t\tnewEdits.status = 'draft';\n\t\t}\n\n\t\t// Fix the auto-draft default title.\n\t\tif (\n\t\t\t( ! edits.title || edits.title === 'Auto Draft' ) &&\n\t\t\t! newEdits.title &&\n\t\t\t( ! persistedRecord?.title ||\n\t\t\t\tpersistedRecord?.title === 'Auto Draft' )\n\t\t) {\n\t\t\tnewEdits.title = '';\n\t\t}\n\t}\n\n\treturn newEdits;\n};\n\nconst serialisableBlocksCache = new WeakMap();\n\nfunction makeBlockAttributesSerializable( attributes ) {\n\tconst newAttributes = { ...attributes };\n\tfor ( const [ key, value ] of Object.entries( attributes ) ) {\n\t\tif ( value instanceof RichTextData ) {\n\t\t\tnewAttributes[ key ] = value.valueOf();\n\t\t}\n\t}\n\treturn newAttributes;\n}\n\nfunction makeBlocksSerializable( blocks ) {\n\treturn blocks.map( ( block ) => {\n\t\tconst { innerBlocks, attributes, ...rest } = block;\n\t\treturn {\n\t\t\t...rest,\n\t\t\tattributes: makeBlockAttributesSerializable( attributes ),\n\t\t\tinnerBlocks: makeBlocksSerializable( innerBlocks ),\n\t\t};\n\t} );\n}\n\n/**\n * Returns the list of post type entities.\n *\n * @return {Promise} Entities promise\n */\nasync function loadPostTypeEntities() {\n\tconst postTypes = await apiFetch( {\n\t\tpath: '/wp/v2/types?context=view',\n\t} );\n\treturn Object.entries( postTypes ?? {} ).map( ( [ name, postType ] ) => {\n\t\tconst isTemplate = [ 'wp_template', 'wp_template_part' ].includes(\n\t\t\tname\n\t\t);\n\t\tconst namespace = postType?.rest_namespace ?? 'wp/v2';\n\t\treturn {\n\t\t\tkind: 'postType',\n\t\t\tbaseURL: `/${ namespace }/${ postType.rest_base }`,\n\t\t\tbaseURLParams: { context: 'edit' },\n\t\t\tname,\n\t\t\tlabel: postType.name,\n\t\t\ttransientEdits: {\n\t\t\t\tblocks: true,\n\t\t\t\tselection: true,\n\t\t\t},\n\t\t\tmergedEdits: { meta: true },\n\t\t\trawAttributes: POST_RAW_ATTRIBUTES,\n\t\t\tgetTitle: ( record ) =>\n\t\t\t\trecord?.title?.rendered ||\n\t\t\t\trecord?.title ||\n\t\t\t\t( isTemplate\n\t\t\t\t\t? capitalCase( record.slug ?? '' )\n\t\t\t\t\t: String( record.id ) ),\n\t\t\t__unstablePrePersist: isTemplate ? undefined : prePersistPostType,\n\t\t\t__unstable_rest_base: postType.rest_base,\n\t\t\tsyncConfig: {\n\t\t\t\tfetch: async ( id ) => {\n\t\t\t\t\treturn apiFetch( {\n\t\t\t\t\t\tpath: `/${ namespace }/${ postType.rest_base }/${ id }?context=edit`,\n\t\t\t\t\t} );\n\t\t\t\t},\n\t\t\t\tapplyChangesToDoc: ( doc, changes ) => {\n\t\t\t\t\tconst document = doc.getMap( 'document' );\n\n\t\t\t\t\tObject.entries( changes ).forEach( ( [ key, value ] ) => {\n\t\t\t\t\t\tif ( typeof value !== 'function' ) {\n\t\t\t\t\t\t\tif ( key === 'blocks' ) {\n\t\t\t\t\t\t\t\tif ( ! serialisableBlocksCache.has( value ) ) {\n\t\t\t\t\t\t\t\t\tserialisableBlocksCache.set(\n\t\t\t\t\t\t\t\t\t\tvalue,\n\t\t\t\t\t\t\t\t\t\tmakeBlocksSerializable( value )\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tvalue = serialisableBlocksCache.get( value );\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif ( document.get( key ) !== value ) {\n\t\t\t\t\t\t\t\tdocument.set( key, value );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} );\n\t\t\t\t},\n\t\t\t\tfromCRDTDoc: ( doc ) => {\n\t\t\t\t\treturn doc.getMap( 'document' ).toJSON();\n\t\t\t\t},\n\t\t\t},\n\t\t\tsyncObjectType: 'postType/' + postType.name,\n\t\t\tgetSyncObjectId: ( id ) => id,\n\t\t\tsupportsPagination: true,\n\t\t\tgetRevisionsUrl: ( parentId, revisionId ) =>\n\t\t\t\t`/${ namespace }/${\n\t\t\t\t\tpostType.rest_base\n\t\t\t\t}/${ parentId }/revisions${\n\t\t\t\t\trevisionId ? '/' + revisionId : ''\n\t\t\t\t}`,\n\t\t\trevisionKey: isTemplate ? 'wp_id' : DEFAULT_ENTITY_KEY,\n\t\t};\n\t} );\n}\n\n/**\n * Returns the list of the taxonomies entities.\n *\n * @return {Promise} Entities promise\n */\nasync function loadTaxonomyEntities() {\n\tconst taxonomies = await apiFetch( {\n\t\tpath: '/wp/v2/taxonomies?context=view',\n\t} );\n\treturn Object.entries( taxonomies ?? {} ).map( ( [ name, taxonomy ] ) => {\n\t\tconst namespace = taxonomy?.rest_namespace ?? 'wp/v2';\n\t\treturn {\n\t\t\tkind: 'taxonomy',\n\t\t\tbaseURL: `/${ namespace }/${ taxonomy.rest_base }`,\n\t\t\tbaseURLParams: { context: 'edit' },\n\t\t\tname,\n\t\t\tlabel: taxonomy.name,\n\t\t};\n\t} );\n}\n\n/**\n * Returns the Site entity.\n *\n * @return {Promise} Entity promise\n */\nasync function loadSiteEntity() {\n\tconst entity = {\n\t\tlabel: __( 'Site' ),\n\t\tname: 'site',\n\t\tkind: 'root',\n\t\tbaseURL: '/wp/v2/settings',\n\t\tsyncConfig: {\n\t\t\tfetch: async () => {\n\t\t\t\treturn apiFetch( { path: '/wp/v2/settings' } );\n\t\t\t},\n\t\t\tapplyChangesToDoc: ( doc, changes ) => {\n\t\t\t\tconst document = doc.getMap( 'document' );\n\t\t\t\tObject.entries( changes ).forEach( ( [ key, value ] ) => {\n\t\t\t\t\tif ( document.get( key ) !== value ) {\n\t\t\t\t\t\tdocument.set( key, value );\n\t\t\t\t\t}\n\t\t\t\t} );\n\t\t\t},\n\t\t\tfromCRDTDoc: ( doc ) => {\n\t\t\t\treturn doc.getMap( 'document' ).toJSON();\n\t\t\t},\n\t\t},\n\t\tsyncObjectType: 'root/site',\n\t\tgetSyncObjectId: () => 'index',\n\t\tmeta: {},\n\t};\n\n\tconst site = await apiFetch( {\n\t\tpath: entity.baseURL,\n\t\tmethod: 'OPTIONS',\n\t} );\n\n\tconst labels = {};\n\tObject.entries( site?.schema?.properties ?? {} ).forEach(\n\t\t( [ key, value ] ) => {\n\t\t\t// Ignore properties `title` and `type` keys.\n\t\t\tif ( typeof value === 'object' && value.title ) {\n\t\t\t\tlabels[ key ] = value.title;\n\t\t\t}\n\t\t}\n\t);\n\n\treturn [ { ...entity, meta: { labels } } ];\n}\n\n/**\n * Returns the entity's getter method name given its kind and name or plural name.\n *\n * @example\n * ```js\n * const nameSingular = getMethodName( 'root', 'theme', 'get' );\n * // nameSingular is getRootTheme\n *\n * const namePlural = getMethodName( 'root', 'themes', 'set' );\n * // namePlural is setRootThemes\n * ```\n *\n * @param {string} kind Entity kind.\n * @param {string} name Entity name or plural name.\n * @param {string} prefix Function prefix.\n *\n * @return {string} Method name\n */\nexport const getMethodName = ( kind, name, prefix = 'get' ) => {\n\tconst kindPrefix = kind === 'root' ? '' : pascalCase( kind );\n\tconst suffix = pascalCase( name );\n\treturn `${ prefix }${ kindPrefix }${ suffix }`;\n};\n\nfunction registerSyncConfigs( configs ) {\n\tconfigs.forEach( ( { syncObjectType, syncConfig } ) => {\n\t\tgetSyncProvider().register( syncObjectType, syncConfig );\n\t\tconst editSyncConfig = { ...syncConfig };\n\t\tdelete editSyncConfig.fetch;\n\t\tgetSyncProvider().register( syncObjectType + '--edit', editSyncConfig );\n\t} );\n}\n\n/**\n * Loads the entities into the store.\n *\n * Note: The `name` argument is used for `root` entities requiring additional server data.\n *\n * @param {string} kind Kind\n * @param {string} name Name\n * @return {(thunkArgs: object) => Promise<Array>} Entities\n */\nexport const getOrLoadEntitiesConfig =\n\t( kind, name ) =>\n\tasync ( { select, dispatch } ) => {\n\t\tlet configs = select.getEntitiesConfig( kind );\n\t\tconst hasConfig = !! select.getEntityConfig( kind, name );\n\n\t\tif ( configs?.length > 0 && hasConfig ) {\n\t\t\tif ( window.__experimentalEnableSync ) {\n\t\t\t\tif ( globalThis.IS_GUTENBERG_PLUGIN ) {\n\t\t\t\t\tregisterSyncConfigs( configs );\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn configs;\n\t\t}\n\n\t\tconst loader = additionalEntityConfigLoaders.find( ( l ) => {\n\t\t\tif ( ! name || ! l.name ) {\n\t\t\t\treturn l.kind === kind;\n\t\t\t}\n\n\t\t\treturn l.kind === kind && l.name === name;\n\t\t} );\n\t\tif ( ! loader ) {\n\t\t\treturn [];\n\t\t}\n\n\t\tconfigs = await loader.loadEntities();\n\t\tif ( window.__experimentalEnableSync ) {\n\t\t\tif ( globalThis.IS_GUTENBERG_PLUGIN ) {\n\t\t\t\tregisterSyncConfigs( configs );\n\t\t\t}\n\t\t}\n\n\t\tdispatch( addEntities( configs ) );\n\n\t\treturn configs;\n\t};\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,WAAW,EAAEC,UAAU,QAAQ,aAAa;;AAErD;AACA;AACA;AACA,OAAOC,QAAQ,MAAM,sBAAsB;AAC3C,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,YAAY,QAAQ,sBAAsB;;AAEnD;AACA;AACA;AACA,SAASC,WAAW,QAAQ,WAAW;AACvC,SAASC,eAAe,QAAQ,QAAQ;AAExC,OAAO,MAAMC,kBAAkB,GAAG,IAAI;AAEtC,MAAMC,mBAAmB,GAAG,CAAE,OAAO,EAAE,SAAS,EAAE,SAAS,CAAE;AAE7D,OAAO,MAAMC,kBAAkB,GAAG,CACjC;EACCC,KAAK,EAAEP,EAAE,CAAE,MAAO,CAAC;EACnBQ,IAAI,EAAE,MAAM;EACZC,IAAI,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AI,EAAG;MACzB,OAAO6G,CAAC,CAAC9G,IAAI,KAAKA,IAAI;IACvB;IAEA,OAAO8G,CAAC,CAAC9G,IAAI,KAAKA,IAAI,IAAI8G,CAAC,CAAC7G,IAAI,KAAKA,IAAI;EAC1C,CAAE,CAAC;EACH,IAAK,CAAE2G,MAAM,EAAG;IACf,OAAO,EAAE;EACV;EAEAd,OAAO,GAAG,MAAMc,MAAM,CAACpE,YAAY,CAAC,CAAC;EACrC,IAAKgE,MAAM,CAACC,wBAAwB,EAAG;IACtC,IAAKC,UAAU,CAACC,mBAAmB,EAAG;MACrCd,mBAAmB,CAAEC,OAAQ,CAAC;IAC/B;EACD;EAEAK,QAAQ,CAAEzG,WAAW,CAAEoG,OAAQ,CAAE,CAAC;EAElC,OAAOA,OAAO;AACf,CAAC","ignoreList":[]}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { createElement } from "react";
|
|
2
1
|
/**
|
|
3
2
|
* WordPress dependencies
|
|
4
3
|
*/
|
|
@@ -13,39 +12,9 @@ import { STORE_NAME } from './name';
|
|
|
13
12
|
import { updateFootnotesFromMeta } from './footnotes';
|
|
14
13
|
|
|
15
14
|
/** @typedef {import('@wordpress/blocks').WPBlock} WPBlock */
|
|
16
|
-
|
|
15
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
17
16
|
const EMPTY_ARRAY = [];
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Internal dependencies
|
|
21
|
-
*/
|
|
22
|
-
import { rootEntitiesConfig, additionalEntityConfigLoaders } from './entities';
|
|
23
|
-
const entityContexts = {
|
|
24
|
-
...rootEntitiesConfig.reduce((acc, loader) => {
|
|
25
|
-
if (!acc[loader.kind]) {
|
|
26
|
-
acc[loader.kind] = {};
|
|
27
|
-
}
|
|
28
|
-
acc[loader.kind][loader.name] = {
|
|
29
|
-
context: createContext(undefined)
|
|
30
|
-
};
|
|
31
|
-
return acc;
|
|
32
|
-
}, {}),
|
|
33
|
-
...additionalEntityConfigLoaders.reduce((acc, loader) => {
|
|
34
|
-
acc[loader.kind] = {};
|
|
35
|
-
return acc;
|
|
36
|
-
}, {})
|
|
37
|
-
};
|
|
38
|
-
const getEntityContext = (kind, name) => {
|
|
39
|
-
if (!entityContexts[kind]) {
|
|
40
|
-
throw new Error(`Missing entity config for kind: ${kind}.`);
|
|
41
|
-
}
|
|
42
|
-
if (!entityContexts[kind][name]) {
|
|
43
|
-
entityContexts[kind][name] = {
|
|
44
|
-
context: createContext(undefined)
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
return entityContexts[kind][name].context;
|
|
48
|
-
};
|
|
17
|
+
const EntityContext = createContext({});
|
|
49
18
|
|
|
50
19
|
/**
|
|
51
20
|
* Context provider component for providing
|
|
@@ -66,10 +35,18 @@ export default function EntityProvider({
|
|
|
66
35
|
id,
|
|
67
36
|
children
|
|
68
37
|
}) {
|
|
69
|
-
const
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
38
|
+
const parent = useContext(EntityContext);
|
|
39
|
+
const childContext = useMemo(() => ({
|
|
40
|
+
...parent,
|
|
41
|
+
[kind]: {
|
|
42
|
+
...parent?.[kind],
|
|
43
|
+
[name]: id
|
|
44
|
+
}
|
|
45
|
+
}), [parent, kind, name, id]);
|
|
46
|
+
return /*#__PURE__*/_jsx(EntityContext.Provider, {
|
|
47
|
+
value: childContext,
|
|
48
|
+
children: children
|
|
49
|
+
});
|
|
73
50
|
}
|
|
74
51
|
|
|
75
52
|
/**
|
|
@@ -80,7 +57,8 @@ export default function EntityProvider({
|
|
|
80
57
|
* @param {string} name The entity name.
|
|
81
58
|
*/
|
|
82
59
|
export function useEntityId(kind, name) {
|
|
83
|
-
|
|
60
|
+
const context = useContext(EntityContext);
|
|
61
|
+
return context?.[kind]?.[name];
|
|
84
62
|
}
|
|
85
63
|
|
|
86
64
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["createContext","useContext","useCallback","useMemo","useSelect","useDispatch","parse","__unstableSerializeAndClean","STORE_NAME","updateFootnotesFromMeta","EMPTY_ARRAY","rootEntitiesConfig","additionalEntityConfigLoaders","entityContexts","reduce","acc","loader","kind","name","context","undefined","getEntityContext","Error","EntityProvider","type","id","children","Provider","createElement","value","useEntityId","useEntityProp","prop","_id","providerId","fullValue","select","getEntityRecord","getEditedEntityRecord","record","editedRecord","editEntityRecord","setValue","newValue","parsedBlocksCache","WeakMap","useEntityBlockEditor","getEntityRecordEdits","content","editedBlocks","meta","blocks","__unstableCreateUndoLevel","edits","isUnedited","Object","keys","length","cackeKey","_blocks","get","set","updateFootnotes","onChange","newBlocks","options","noChange","selection","rest","blocksForSerialization","isCached","onInput","footnotesChanges"],"sources":["@wordpress/core-data/src/entity-provider.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tcreateContext,\n\tuseContext,\n\tuseCallback,\n\tuseMemo,\n} from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { parse, __unstableSerializeAndClean } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { STORE_NAME } from './name';\nimport { updateFootnotesFromMeta } from './footnotes';\n\n/** @typedef {import('@wordpress/blocks').WPBlock} WPBlock */\n\nconst EMPTY_ARRAY = [];\n\n/**\n * Internal dependencies\n */\nimport { rootEntitiesConfig, additionalEntityConfigLoaders } from './entities';\n\nconst entityContexts = {\n\t...rootEntitiesConfig.reduce( ( acc, loader ) => {\n\t\tif ( ! acc[ loader.kind ] ) {\n\t\t\tacc[ loader.kind ] = {};\n\t\t}\n\t\tacc[ loader.kind ][ loader.name ] = {\n\t\t\tcontext: createContext( undefined ),\n\t\t};\n\t\treturn acc;\n\t}, {} ),\n\t...additionalEntityConfigLoaders.reduce( ( acc, loader ) => {\n\t\tacc[ loader.kind ] = {};\n\t\treturn acc;\n\t}, {} ),\n};\nconst getEntityContext = ( kind, name ) => {\n\tif ( ! entityContexts[ kind ] ) {\n\t\tthrow new Error( `Missing entity config for kind: ${ kind }.` );\n\t}\n\n\tif ( ! entityContexts[ kind ][ name ] ) {\n\t\tentityContexts[ kind ][ name ] = {\n\t\t\tcontext: createContext( undefined ),\n\t\t};\n\t}\n\n\treturn entityContexts[ kind ][ name ].context;\n};\n\n/**\n * Context provider component for providing\n * an entity for a specific entity.\n *\n * @param {Object} props The component's props.\n * @param {string} props.kind The entity kind.\n * @param {string} props.type The entity name.\n * @param {number} props.id The entity ID.\n * @param {*} props.children The children to wrap.\n *\n * @return {Object} The provided children, wrapped with\n * the entity's context provider.\n */\nexport default function EntityProvider( { kind, type: name, id, children } ) {\n\tconst Provider = getEntityContext( kind, name ).Provider;\n\treturn <Provider value={ id }>{ children }</Provider>;\n}\n\n/**\n * Hook that returns the ID for the nearest\n * provided entity of the specified type.\n *\n * @param {string} kind The entity kind.\n * @param {string} name The entity name.\n */\nexport function useEntityId( kind, name ) {\n\treturn useContext( getEntityContext( kind, name ) );\n}\n\n/**\n * Hook that returns the value and a setter for the\n * specified property of the nearest provided\n * entity of the specified type.\n *\n * @param {string} kind The entity kind.\n * @param {string} name The entity name.\n * @param {string} prop The property name.\n * @param {string} [_id] An entity ID to use instead of the context-provided one.\n *\n * @return {[*, Function, *]} An array where the first item is the\n * property value, the second is the\n * setter and the third is the full value\n * \t\t\t\t\t\t\t object from REST API containing more\n * \t\t\t\t\t\t\t information like `raw`, `rendered` and\n * \t\t\t\t\t\t\t `protected` props.\n */\nexport function useEntityProp( kind, name, prop, _id ) {\n\tconst providerId = useEntityId( kind, name );\n\tconst id = _id ?? providerId;\n\n\tconst { value, fullValue } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEntityRecord, getEditedEntityRecord } =\n\t\t\t\tselect( STORE_NAME );\n\t\t\tconst record = getEntityRecord( kind, name, id ); // Trigger resolver.\n\t\t\tconst editedRecord = getEditedEntityRecord( kind, name, id );\n\t\t\treturn record && editedRecord\n\t\t\t\t? {\n\t\t\t\t\t\tvalue: editedRecord[ prop ],\n\t\t\t\t\t\tfullValue: record[ prop ],\n\t\t\t\t }\n\t\t\t\t: {};\n\t\t},\n\t\t[ kind, name, id, prop ]\n\t);\n\tconst { editEntityRecord } = useDispatch( STORE_NAME );\n\tconst setValue = useCallback(\n\t\t( newValue ) => {\n\t\t\teditEntityRecord( kind, name, id, {\n\t\t\t\t[ prop ]: newValue,\n\t\t\t} );\n\t\t},\n\t\t[ editEntityRecord, kind, name, id, prop ]\n\t);\n\n\treturn [ value, setValue, fullValue ];\n}\n\nconst parsedBlocksCache = new WeakMap();\n\n/**\n * Hook that returns block content getters and setters for\n * the nearest provided entity of the specified type.\n *\n * The return value has the shape `[ blocks, onInput, onChange ]`.\n * `onInput` is for block changes that don't create undo levels\n * or dirty the post, non-persistent changes, and `onChange` is for\n * persistent changes. They map directly to the props of a\n * `BlockEditorProvider` and are intended to be used with it,\n * or similar components or hooks.\n *\n * @param {string} kind The entity kind.\n * @param {string} name The entity name.\n * @param {Object} options\n * @param {string} [options.id] An entity ID to use instead of the context-provided one.\n *\n * @return {[WPBlock[], Function, Function]} The block array and setters.\n */\nexport function useEntityBlockEditor( kind, name, { id: _id } = {} ) {\n\tconst providerId = useEntityId( kind, name );\n\tconst id = _id ?? providerId;\n\tconst { getEntityRecord, getEntityRecordEdits } = useSelect( STORE_NAME );\n\tconst { content, editedBlocks, meta } = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! id ) {\n\t\t\t\treturn {};\n\t\t\t}\n\t\t\tconst { getEditedEntityRecord } = select( STORE_NAME );\n\t\t\tconst editedRecord = getEditedEntityRecord( kind, name, id );\n\t\t\treturn {\n\t\t\t\teditedBlocks: editedRecord.blocks,\n\t\t\t\tcontent: editedRecord.content,\n\t\t\t\tmeta: editedRecord.meta,\n\t\t\t};\n\t\t},\n\t\t[ kind, name, id ]\n\t);\n\tconst { __unstableCreateUndoLevel, editEntityRecord } =\n\t\tuseDispatch( STORE_NAME );\n\n\tconst blocks = useMemo( () => {\n\t\tif ( ! id ) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tif ( editedBlocks ) {\n\t\t\treturn editedBlocks;\n\t\t}\n\n\t\tif ( ! content || typeof content !== 'string' ) {\n\t\t\treturn EMPTY_ARRAY;\n\t\t}\n\n\t\t// If there's an edit, cache the parsed blocks by the edit.\n\t\t// If not, cache by the original enity record.\n\t\tconst edits = getEntityRecordEdits( kind, name, id );\n\t\tconst isUnedited = ! edits || ! Object.keys( edits ).length;\n\t\tconst cackeKey = isUnedited ? getEntityRecord( kind, name, id ) : edits;\n\t\tlet _blocks = parsedBlocksCache.get( cackeKey );\n\n\t\tif ( ! _blocks ) {\n\t\t\t_blocks = parse( content );\n\t\t\tparsedBlocksCache.set( cackeKey, _blocks );\n\t\t}\n\n\t\treturn _blocks;\n\t}, [\n\t\tkind,\n\t\tname,\n\t\tid,\n\t\teditedBlocks,\n\t\tcontent,\n\t\tgetEntityRecord,\n\t\tgetEntityRecordEdits,\n\t] );\n\n\tconst updateFootnotes = useCallback(\n\t\t( _blocks ) => updateFootnotesFromMeta( _blocks, meta ),\n\t\t[ meta ]\n\t);\n\n\tconst onChange = useCallback(\n\t\t( newBlocks, options ) => {\n\t\t\tconst noChange = blocks === newBlocks;\n\t\t\tif ( noChange ) {\n\t\t\t\treturn __unstableCreateUndoLevel( kind, name, id );\n\t\t\t}\n\t\t\tconst { selection, ...rest } = options;\n\n\t\t\t// We create a new function here on every persistent edit\n\t\t\t// to make sure the edit makes the post dirty and creates\n\t\t\t// a new undo level.\n\t\t\tconst edits = {\n\t\t\t\tselection,\n\t\t\t\tcontent: ( { blocks: blocksForSerialization = [] } ) =>\n\t\t\t\t\t__unstableSerializeAndClean( blocksForSerialization ),\n\t\t\t\t...updateFootnotes( newBlocks ),\n\t\t\t};\n\n\t\t\teditEntityRecord( kind, name, id, edits, {\n\t\t\t\tisCached: false,\n\t\t\t\t...rest,\n\t\t\t} );\n\t\t},\n\t\t[\n\t\t\tkind,\n\t\t\tname,\n\t\t\tid,\n\t\t\tblocks,\n\t\t\tupdateFootnotes,\n\t\t\t__unstableCreateUndoLevel,\n\t\t\teditEntityRecord,\n\t\t]\n\t);\n\n\tconst onInput = useCallback(\n\t\t( newBlocks, options ) => {\n\t\t\tconst { selection, ...rest } = options;\n\t\t\tconst footnotesChanges = updateFootnotes( newBlocks );\n\t\t\tconst edits = { selection, ...footnotesChanges };\n\n\t\t\teditEntityRecord( kind, name, id, edits, {\n\t\t\t\tisCached: true,\n\t\t\t\t...rest,\n\t\t\t} );\n\t\t},\n\t\t[ kind, name, id, updateFootnotes, editEntityRecord ]\n\t);\n\n\treturn [ blocks, onInput, onChange ];\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SACCA,aAAa,EACbC,UAAU,EACVC,WAAW,EACXC,OAAO,QACD,oBAAoB;AAC3B,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,KAAK,EAAEC,2BAA2B,QAAQ,mBAAmB;;AAEtE;AACA;AACA;AACA,SAASC,UAAU,QAAQ,QAAQ;AACnC,SAASC,uBAAuB,QAAQ,aAAa;;AAErD;;AAEA,MAAMC,WAAW,GAAG,EAAE;;AAEtB;AACA;AACA;AACA,SAASC,kBAAkB,EAAEC,6BAA6B,QAAQ,YAAY;AAE9E,MAAMC,cAAc,GAAG;EACtB,GAAGF,kBAAkB,CAACG,MAAM,CAAE,CAAEC,GAAG,EAAEC,MAAM,KAAM;IAChD,IAAK,CAAED,GAAG,CAAEC,MAAM,CAACC,IAAI,CAAE,EAAG;MAC3BF,GAAG,CAAEC,MAAM,CAACC,IAAI,CAAE,GAAG,CAAC,CAAC;IACxB;IACAF,GAAG,CAAEC,MAAM,CAACC,IAAI,CAAE,CAAED,MAAM,CAACE,IAAI,CAAE,GAAG;MACnCC,OAAO,EAAEnB,aAAa,CAAEoB,SAAU;IACnC,CAAC;IACD,OAAOL,GAAG;EACX,CAAC,EAAE,CAAC,CAAE,CAAC;EACP,GAAGH,6BAA6B,CAACE,MAAM,CAAE,CAAEC,GAAG,EAAEC,MAAM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GAAGP,eAAe,CAAEE,SAAU;IAC/B,CAAC;IAEDvB,gBAAgB,CAAExB,IAAI,EAAEC,IAAI,EAAEO,EAAE,EAAE4B,KAAK,EAAE;MACxCiB,QAAQ,EAAE,KAAK;MACf,GAAGF;IACJ,CAAE,CAAC;EACJ,CAAC,EACD,CACCnD,IAAI,EACJC,IAAI,EACJO,EAAE,EACF0B,MAAM,EACNW,eAAe,EACfV,yBAAyB,EACzBX,gBAAgB,CAElB,CAAC;EAED,MAAM8B,OAAO,GAAGrE,WAAW,CAC1B,CAAE8D,SAAS,EAAEC,OAAO,KAAM;IACzB,MAAM;MAAEE,SAAS;MAAE,GAAGC;IAAK,CAAC,GAAGH,OAAO;IACtC,MAAMO,gBAAgB,GAAGV,eAAe,CAAEE,SAAU,CAAC;IACrD,MAAMX,KAAK,GAAG;MAAEc,SAAS;MAAE,GAAGK;IAAiB,CAAC;IAEhD/B,gBAAgB,CAAExB,IAAI,EAAEC,IAAI,EAAEO,EAAE,EAAE4B,KAAK,EAAE;MACxCiB,QAAQ,EAAE,IAAI;MACd,GAAGF;IACJ,CAAE,CAAC;EACJ,CAAC,EACD,CAAEnD,IAAI,EAAEC,IAAI,EAAEO,EAAE,EAAEqC,eAAe,EAAErB,gBAAgB,CACpD,CAAC;EAED,OAAO,CAAEU,MAAM,EAAEoB,OAAO,EAAER,QAAQ,CAAE;AACrC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["createContext","useContext","useCallback","useMemo","useSelect","useDispatch","parse","__unstableSerializeAndClean","STORE_NAME","updateFootnotesFromMeta","jsx","_jsx","EMPTY_ARRAY","EntityContext","EntityProvider","kind","type","name","id","children","parent","childContext","Provider","value","useEntityId","context","useEntityProp","prop","_id","providerId","fullValue","select","getEntityRecord","getEditedEntityRecord","record","editedRecord","editEntityRecord","setValue","newValue","parsedBlocksCache","WeakMap","useEntityBlockEditor","getEntityRecordEdits","content","editedBlocks","meta","blocks","__unstableCreateUndoLevel","undefined","edits","isUnedited","Object","keys","length","cackeKey","_blocks","get","set","updateFootnotes","onChange","newBlocks","options","noChange","selection","rest","blocksForSerialization","isCached","onInput","footnotesChanges"],"sources":["@wordpress/core-data/src/entity-provider.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tcreateContext,\n\tuseContext,\n\tuseCallback,\n\tuseMemo,\n} from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { parse, __unstableSerializeAndClean } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { STORE_NAME } from './name';\nimport { updateFootnotesFromMeta } from './footnotes';\n\n/** @typedef {import('@wordpress/blocks').WPBlock} WPBlock */\n\nconst EMPTY_ARRAY = [];\n\nconst EntityContext = createContext( {} );\n\n/**\n * Context provider component for providing\n * an entity for a specific entity.\n *\n * @param {Object} props The component's props.\n * @param {string} props.kind The entity kind.\n * @param {string} props.type The entity name.\n * @param {number} props.id The entity ID.\n * @param {*} props.children The children to wrap.\n *\n * @return {Object} The provided children, wrapped with\n * the entity's context provider.\n */\nexport default function EntityProvider( { kind, type: name, id, children } ) {\n\tconst parent = useContext( EntityContext );\n\tconst childContext = useMemo(\n\t\t() => ( {\n\t\t\t...parent,\n\t\t\t[ kind ]: {\n\t\t\t\t...parent?.[ kind ],\n\t\t\t\t[ name ]: id,\n\t\t\t},\n\t\t} ),\n\t\t[ parent, kind, name, id ]\n\t);\n\treturn (\n\t\t<EntityContext.Provider value={ childContext }>\n\t\t\t{ children }\n\t\t</EntityContext.Provider>\n\t);\n}\n\n/**\n * Hook that returns the ID for the nearest\n * provided entity of the specified type.\n *\n * @param {string} kind The entity kind.\n * @param {string} name The entity name.\n */\nexport function useEntityId( kind, name ) {\n\tconst context = useContext( EntityContext );\n\treturn context?.[ kind ]?.[ name ];\n}\n\n/**\n * Hook that returns the value and a setter for the\n * specified property of the nearest provided\n * entity of the specified type.\n *\n * @param {string} kind The entity kind.\n * @param {string} name The entity name.\n * @param {string} prop The property name.\n * @param {string} [_id] An entity ID to use instead of the context-provided one.\n *\n * @return {[*, Function, *]} An array where the first item is the\n * property value, the second is the\n * setter and the third is the full value\n * \t\t\t\t\t\t\t object from REST API containing more\n * \t\t\t\t\t\t\t information like `raw`, `rendered` and\n * \t\t\t\t\t\t\t `protected` props.\n */\nexport function useEntityProp( kind, name, prop, _id ) {\n\tconst providerId = useEntityId( kind, name );\n\tconst id = _id ?? providerId;\n\n\tconst { value, fullValue } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEntityRecord, getEditedEntityRecord } =\n\t\t\t\tselect( STORE_NAME );\n\t\t\tconst record = getEntityRecord( kind, name, id ); // Trigger resolver.\n\t\t\tconst editedRecord = getEditedEntityRecord( kind, name, id );\n\t\t\treturn record && editedRecord\n\t\t\t\t? {\n\t\t\t\t\t\tvalue: editedRecord[ prop ],\n\t\t\t\t\t\tfullValue: record[ prop ],\n\t\t\t\t }\n\t\t\t\t: {};\n\t\t},\n\t\t[ kind, name, id, prop ]\n\t);\n\tconst { editEntityRecord } = useDispatch( STORE_NAME );\n\tconst setValue = useCallback(\n\t\t( newValue ) => {\n\t\t\teditEntityRecord( kind, name, id, {\n\t\t\t\t[ prop ]: newValue,\n\t\t\t} );\n\t\t},\n\t\t[ editEntityRecord, kind, name, id, prop ]\n\t);\n\n\treturn [ value, setValue, fullValue ];\n}\n\nconst parsedBlocksCache = new WeakMap();\n\n/**\n * Hook that returns block content getters and setters for\n * the nearest provided entity of the specified type.\n *\n * The return value has the shape `[ blocks, onInput, onChange ]`.\n * `onInput` is for block changes that don't create undo levels\n * or dirty the post, non-persistent changes, and `onChange` is for\n * persistent changes. They map directly to the props of a\n * `BlockEditorProvider` and are intended to be used with it,\n * or similar components or hooks.\n *\n * @param {string} kind The entity kind.\n * @param {string} name The entity name.\n * @param {Object} options\n * @param {string} [options.id] An entity ID to use instead of the context-provided one.\n *\n * @return {[WPBlock[], Function, Function]} The block array and setters.\n */\nexport function useEntityBlockEditor( kind, name, { id: _id } = {} ) {\n\tconst providerId = useEntityId( kind, name );\n\tconst id = _id ?? providerId;\n\tconst { getEntityRecord, getEntityRecordEdits } = useSelect( STORE_NAME );\n\tconst { content, editedBlocks, meta } = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! id ) {\n\t\t\t\treturn {};\n\t\t\t}\n\t\t\tconst { getEditedEntityRecord } = select( STORE_NAME );\n\t\t\tconst editedRecord = getEditedEntityRecord( kind, name, id );\n\t\t\treturn {\n\t\t\t\teditedBlocks: editedRecord.blocks,\n\t\t\t\tcontent: editedRecord.content,\n\t\t\t\tmeta: editedRecord.meta,\n\t\t\t};\n\t\t},\n\t\t[ kind, name, id ]\n\t);\n\tconst { __unstableCreateUndoLevel, editEntityRecord } =\n\t\tuseDispatch( STORE_NAME );\n\n\tconst blocks = useMemo( () => {\n\t\tif ( ! id ) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tif ( editedBlocks ) {\n\t\t\treturn editedBlocks;\n\t\t}\n\n\t\tif ( ! content || typeof content !== 'string' ) {\n\t\t\treturn EMPTY_ARRAY;\n\t\t}\n\n\t\t// If there's an edit, cache the parsed blocks by the edit.\n\t\t// If not, cache by the original enity record.\n\t\tconst edits = getEntityRecordEdits( kind, name, id );\n\t\tconst isUnedited = ! edits || ! Object.keys( edits ).length;\n\t\tconst cackeKey = isUnedited ? getEntityRecord( kind, name, id ) : edits;\n\t\tlet _blocks = parsedBlocksCache.get( cackeKey );\n\n\t\tif ( ! _blocks ) {\n\t\t\t_blocks = parse( content );\n\t\t\tparsedBlocksCache.set( cackeKey, _blocks );\n\t\t}\n\n\t\treturn _blocks;\n\t}, [\n\t\tkind,\n\t\tname,\n\t\tid,\n\t\teditedBlocks,\n\t\tcontent,\n\t\tgetEntityRecord,\n\t\tgetEntityRecordEdits,\n\t] );\n\n\tconst updateFootnotes = useCallback(\n\t\t( _blocks ) => updateFootnotesFromMeta( _blocks, meta ),\n\t\t[ meta ]\n\t);\n\n\tconst onChange = useCallback(\n\t\t( newBlocks, options ) => {\n\t\t\tconst noChange = blocks === newBlocks;\n\t\t\tif ( noChange ) {\n\t\t\t\treturn __unstableCreateUndoLevel( kind, name, id );\n\t\t\t}\n\t\t\tconst { selection, ...rest } = options;\n\n\t\t\t// We create a new function here on every persistent edit\n\t\t\t// to make sure the edit makes the post dirty and creates\n\t\t\t// a new undo level.\n\t\t\tconst edits = {\n\t\t\t\tselection,\n\t\t\t\tcontent: ( { blocks: blocksForSerialization = [] } ) =>\n\t\t\t\t\t__unstableSerializeAndClean( blocksForSerialization ),\n\t\t\t\t...updateFootnotes( newBlocks ),\n\t\t\t};\n\n\t\t\teditEntityRecord( kind, name, id, edits, {\n\t\t\t\tisCached: false,\n\t\t\t\t...rest,\n\t\t\t} );\n\t\t},\n\t\t[\n\t\t\tkind,\n\t\t\tname,\n\t\t\tid,\n\t\t\tblocks,\n\t\t\tupdateFootnotes,\n\t\t\t__unstableCreateUndoLevel,\n\t\t\teditEntityRecord,\n\t\t]\n\t);\n\n\tconst onInput = useCallback(\n\t\t( newBlocks, options ) => {\n\t\t\tconst { selection, ...rest } = options;\n\t\t\tconst footnotesChanges = updateFootnotes( newBlocks );\n\t\t\tconst edits = { selection, ...footnotesChanges };\n\n\t\t\teditEntityRecord( kind, name, id, edits, {\n\t\t\t\tisCached: true,\n\t\t\t\t...rest,\n\t\t\t} );\n\t\t},\n\t\t[ kind, name, id, updateFootnotes, editEntityRecord ]\n\t);\n\n\treturn [ blocks, onInput, onChange ];\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SACCA,aAAa,EACbC,UAAU,EACVC,WAAW,EACXC,OAAO,QACD,oBAAoB;AAC3B,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,KAAK,EAAEC,2BAA2B,QAAQ,mBAAmB;;AAEtE;AACA;AACA;AACA,SAASC,UAAU,QAAQ,QAAQ;AACnC,SAASC,uBAAuB,QAAQ,aAAa;;AAErD;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAEA,MAAMC,WAAW,GAAG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EACF4B,MAAM,EACNY,eAAe,EACfX,yBAAyB,EACzBX,gBAAgB,CAElB,CAAC;EAED,MAAM+B,OAAO,GAAGjE,WAAW,CAC1B,CAAE0D,SAAS,EAAEC,OAAO,KAAM;IACzB,MAAM;MAAEE,SAAS;MAAE,GAAGC;IAAK,CAAC,GAAGH,OAAO;IACtC,MAAMO,gBAAgB,GAAGV,eAAe,CAAEE,SAAU,CAAC;IACrD,MAAMX,KAAK,GAAG;MAAEc,SAAS;MAAE,GAAGK;IAAiB,CAAC;IAEhDhC,gBAAgB,CAAErB,IAAI,EAAEE,IAAI,EAAEC,EAAE,EAAE+B,KAAK,EAAE;MACxCiB,QAAQ,EAAE,IAAI;MACd,GAAGF;IACJ,CAAE,CAAC;EACJ,CAAC,EACD,CAAEjD,IAAI,EAAEE,IAAI,EAAEC,EAAE,EAAEwC,eAAe,EAAEtB,gBAAgB,CACpD,CAAC;EAED,OAAO,CAAEU,MAAM,EAAEqB,OAAO,EAAER,QAAQ,CAAE;AACrC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["@wordpress/core-data/src/entity-types/theme.ts"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport type { Context, PostFormat, RenderedText, OmitNevers } from './helpers';\n\nimport type { BaseEntityRecords as _BaseEntityRecords } from './base-entity-records';\n\ndeclare module './base-entity-records' {\n\texport namespace BaseEntityRecords {\n\t\texport interface Theme< C extends Context > {\n\t\t\t/**\n\t\t\t * The theme's stylesheet. This uniquely identifies the theme.\n\t\t\t */\n\t\t\tstylesheet: string;\n\t\t\t/**\n\t\t\t * The theme's template. If this is a child theme, this refers to the parent theme, otherwise this is the same as the theme's stylesheet.\n\t\t\t */\n\t\t\ttemplate: string;\n\t\t\t/**\n\t\t\t * The theme author.\n\t\t\t */\n\t\t\tauthor: RenderedText< 'edit' >;\n\t\t\t/**\n\t\t\t * The website of the theme author.\n\t\t\t */\n\t\t\tauthor_uri: RenderedText< 'edit' >;\n\t\t\t/**\n\t\t\t * A description of the theme.\n\t\t\t */\n\t\t\tdescription: RenderedText< 'edit' >;\n\t\t\t/**\n\t\t\t * The name of the theme.\n\t\t\t */\n\t\t\tname: RenderedText< 'edit' >;\n\t\t\t/**\n\t\t\t * The minimum PHP version required for the theme to work.\n\t\t\t */\n\t\t\trequires_php: string;\n\t\t\t/**\n\t\t\t * The minimum WordPress version required for the theme to work.\n\t\t\t */\n\t\t\trequires_wp: string;\n\t\t\t/**\n\t\t\t * The theme's screenshot URL.\n\t\t\t */\n\t\t\tscreenshot: string;\n\t\t\t/**\n\t\t\t * Tags indicating styles and features of the theme.\n\t\t\t */\n\t\t\ttags: RenderedText< 'edit' >;\n\t\t\t/**\n\t\t\t * The theme's text domain.\n\t\t\t */\n\t\t\ttextdomain: string;\n\t\t\t/**\n\t\t\t * Features supported by this theme.\n\t\t\t */\n\t\t\ttheme_supports: ThemeSupports;\n\t\t\t/**\n\t\t\t * The URI of the theme's webpage.\n\t\t\t */\n\t\t\ttheme_uri: RenderedText< 'edit' >;\n\t\t\t/**\n\t\t\t * The theme's current version.\n\t\t\t */\n\t\t\tversion: string;\n\t\t\t/**\n\t\t\t * A named status for the theme.\n\t\t\t */\n\t\t\tstatus: ThemeStatus;\n\t\t}\n\n\t\texport type ThemeStatus = 'active' | 'inactive';\n\n\t\texport interface ThemeSupports {\n\t\t\t/**\n\t\t\t * Whether theme opts in to wide alignment CSS class.\n\t\t\t */\n\t\t\t'align-wide': boolean;\n\t\t\t/**\n\t\t\t * Whether appearanceTools are enabled in Global Styles.\n\t\t\t */\n\t\t\t'appearance-tools': boolean;\n\t\t\t/**\n\t\t\t * Whether posts and comments RSS feed links are added to head.\n\t\t\t */\n\t\t\t'automatic-feed-links': boolean;\n\t\t\t/**\n\t\t\t * Whether border settings are enabled.\n\t\t\t */\n\t\t\tborder: boolean;\n\t\t\t/**\n\t\t\t * Custom background if defined by the theme.\n\t\t\t */\n\t\t\t'custom-background': boolean | CustomBackground;\n\t\t\t/**\n\t\t\t * Custom header if defined by the theme.\n\t\t\t */\n\t\t\t'custom-header': boolean | CustomHeader;\n\t\t\t/**\n\t\t\t * Custom logo if defined by the theme.\n\t\t\t */\n\t\t\t'custom-logo': boolean | CustomLogo;\n\t\t\t/**\n\t\t\t * Whether the theme enables Selective Refresh for Widgets being managed with the Customizer.\n\t\t\t */\n\t\t\t'customize-selective-refresh-widgets': boolean;\n\t\t\t/**\n\t\t\t * Whether theme opts in to the dark editor style UI.\n\t\t\t */\n\t\t\t'dark-editor-style': boolean;\n\t\t\t/**\n\t\t\t * Whether the theme disables custom colors.\n\t\t\t */\n\t\t\t'disable-custom-colors': boolean;\n\t\t\t/**\n\t\t\t * Whether the theme disables custom font sizes.\n\t\t\t */\n\t\t\t'disable-custom-font-sizes': boolean;\n\t\t\t/**\n\t\t\t * Whether the theme disables custom gradients.\n\t\t\t */\n\t\t\t'disable-custom-gradients': boolean;\n\t\t\t/**\n\t\t\t * Custom color palette if defined by the theme.\n\t\t\t */\n\t\t\t'editor-color-palette': boolean | Color[];\n\t\t\t/**\n\t\t\t * Custom font sizes if defined by the theme.\n\t\t\t */\n\t\t\t'editor-font-sizes': boolean | FontSize[];\n\t\t\t/**\n\t\t\t * Custom gradient presets if defined by the theme.\n\t\t\t */\n\t\t\t'editor-gradient-presets': boolean | GradientPreset[];\n\t\t\t/**\n\t\t\t * Whether theme opts in to the editor styles CSS wrapper.\n\t\t\t */\n\t\t\t'editor-styles': boolean;\n\t\t\t/**\n\t\t\t * Allows use of HTML5 markup for search forms, comment forms, comment lists, gallery, and caption.\n\t\t\t */\n\t\t\thtml5: boolean | Html5Option[];\n\t\t\t/**\n\t\t\t * Post formats supported.\n\t\t\t */\n\t\t\tformats: PostFormat[];\n\t\t\t/**\n\t\t\t * Whether link colors are enabled.\n\t\t\t */\n\t\t\t'link-color': boolean;\n\t\t\t/**\n\t\t\t * The post types that support thumbnails or true if all post types are supported.\n\t\t\t */\n\t\t\t'post-thumbnails': boolean | string[];\n\t\t\t/**\n\t\t\t * Whether the theme supports responsive embedded content.\n\t\t\t */\n\t\t\t'responsive-embeds': boolean;\n\t\t\t/**\n\t\t\t * Whether the theme can manage the document title tag.\n\t\t\t */\n\t\t\t'title-tag': boolean;\n\t\t\t/**\n\t\t\t * Whether theme opts in to default WordPress block styles for viewing.\n\t\t\t */\n\t\t\t'wp-block-styles': boolean;\n\t\t}\n\n\t\texport interface CustomBackground {\n\t\t\t'default-image': string;\n\t\t\t'default-preset': 'default' | 'fill' | 'fit' | 'repeat' | 'custom';\n\t\t\t'default-position-x': 'left' | 'center' | 'right';\n\t\t\t'default-position-y': 'left' | 'center' | 'right';\n\t\t\t'default-size': 'auto' | 'contain' | 'cover';\n\t\t\t'default-repeat': 'repeat-x' | 'repeat-y' | 'repeat' | 'no-repeat';\n\t\t\t'default-attachment': 'scroll' | 'fixed';\n\t\t\t'default-color': string;\n\t\t}\n\n\t\texport interface CustomHeader {\n\t\t\t'default-image': string;\n\t\t\t'random-default': boolean;\n\t\t\twidth: number;\n\t\t\theight: number;\n\t\t\t'flex-height': boolean;\n\t\t\t'flex-width': boolean;\n\t\t\t'default-text-color': string;\n\t\t\t'header-text': boolean;\n\t\t\tuploads: boolean;\n\t\t\tvideo: boolean;\n\t\t}\n\n\t\texport interface CustomLogo {\n\t\t\twidth: number;\n\t\t\theight: number;\n\t\t\t'flex-width': boolean;\n\t\t\t'flex-height': boolean;\n\t\t\t'header-text': string[];\n\t\t\t'unlink-homepage-logo': boolean;\n\t\t}\n\n\t\texport interface Color {\n\t\t\tname: string;\n\t\t\tslug: string;\n\t\t\tcolor: string;\n\t\t}\n\n\t\texport interface FontSize {\n\t\t\tname: string;\n\t\t\tsize: number;\n\t\t\tslug: string;\n\t\t}\n\n\t\texport interface GradientPreset {\n\t\t\tname: string;\n\t\t\tgradient: string;\n\t\t\tslug: string;\n\t\t}\n\n\t\texport type Html5Option =\n\t\t\t| 'search-form'\n\t\t\t| 'comment-form'\n\t\t\t| 'comment-list'\n\t\t\t| 'gallery'\n\t\t\t| 'caption'\n\t\t\t| 'script'\n\t\t\t| 'style';\n\t}\n}\n\nexport type Theme< C extends Context = 'edit' > = OmitNevers<\n\t_BaseEntityRecords.Theme< C >\n>;\n"],"mappings":"","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":[],"sources":["@wordpress/core-data/src/entity-types/theme.ts"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport type { Context, PostFormat, RenderedText, OmitNevers } from './helpers';\n\nimport type { BaseEntityRecords as _BaseEntityRecords } from './base-entity-records';\n\ndeclare module './base-entity-records' {\n\texport namespace BaseEntityRecords {\n\t\texport interface Theme< C extends Context > {\n\t\t\t/**\n\t\t\t * The theme's stylesheet. This uniquely identifies the theme.\n\t\t\t */\n\t\t\tstylesheet: string;\n\t\t\t/**\n\t\t\t * The theme's template. If this is a child theme, this refers to the parent theme, otherwise this is the same as the theme's stylesheet.\n\t\t\t */\n\t\t\ttemplate: string;\n\t\t\t/**\n\t\t\t * The theme author.\n\t\t\t */\n\t\t\tauthor: RenderedText< 'edit' >;\n\t\t\t/**\n\t\t\t * The website of the theme author.\n\t\t\t */\n\t\t\tauthor_uri: RenderedText< 'edit' >;\n\t\t\t/**\n\t\t\t * A description of the theme.\n\t\t\t */\n\t\t\tdescription: RenderedText< 'edit' >;\n\t\t\t/**\n\t\t\t * The name of the theme.\n\t\t\t */\n\t\t\tname: RenderedText< 'edit' >;\n\t\t\t/**\n\t\t\t * The minimum PHP version required for the theme to work.\n\t\t\t */\n\t\t\trequires_php: string;\n\t\t\t/**\n\t\t\t * The minimum WordPress version required for the theme to work.\n\t\t\t */\n\t\t\trequires_wp: string;\n\t\t\t/**\n\t\t\t * The theme's screenshot URL.\n\t\t\t */\n\t\t\tscreenshot: string;\n\t\t\t/**\n\t\t\t * Tags indicating styles and features of the theme.\n\t\t\t */\n\t\t\ttags: RenderedText< 'edit' >;\n\t\t\t/**\n\t\t\t * The theme's text domain.\n\t\t\t */\n\t\t\ttextdomain: string;\n\t\t\t/**\n\t\t\t * Features supported by this theme.\n\t\t\t */\n\t\t\ttheme_supports: ThemeSupports;\n\t\t\t/**\n\t\t\t * The URI of the theme's webpage.\n\t\t\t */\n\t\t\ttheme_uri: RenderedText< 'edit' >;\n\t\t\t/**\n\t\t\t * The theme's current version.\n\t\t\t */\n\t\t\tversion: string;\n\t\t\t/**\n\t\t\t * A named status for the theme.\n\t\t\t */\n\t\t\tstatus: ThemeStatus;\n\t\t}\n\n\t\texport type ThemeStatus = 'active' | 'inactive';\n\n\t\texport interface ThemeSupports {\n\t\t\t/**\n\t\t\t * Whether theme opts in to wide alignment CSS class.\n\t\t\t */\n\t\t\t'align-wide': boolean;\n\t\t\t/**\n\t\t\t * Whether appearanceTools are enabled in Global Styles.\n\t\t\t */\n\t\t\t'appearance-tools': boolean;\n\t\t\t/**\n\t\t\t * Whether posts and comments RSS feed links are added to head.\n\t\t\t */\n\t\t\t'automatic-feed-links': boolean;\n\t\t\t/**\n\t\t\t * Whether border settings are enabled.\n\t\t\t */\n\t\t\tborder: boolean;\n\t\t\t/**\n\t\t\t * Custom background if defined by the theme.\n\t\t\t */\n\t\t\t'custom-background': boolean | CustomBackground;\n\t\t\t/**\n\t\t\t * Custom header if defined by the theme.\n\t\t\t */\n\t\t\t'custom-header': boolean | CustomHeader;\n\t\t\t/**\n\t\t\t * Custom logo if defined by the theme.\n\t\t\t */\n\t\t\t'custom-logo': boolean | CustomLogo;\n\t\t\t/**\n\t\t\t * Whether the theme enables Selective Refresh for Widgets being managed with the Customizer.\n\t\t\t */\n\t\t\t'customize-selective-refresh-widgets': boolean;\n\t\t\t/**\n\t\t\t * Whether theme opts in to the dark editor style UI.\n\t\t\t */\n\t\t\t'dark-editor-style': boolean;\n\t\t\t/**\n\t\t\t * Whether the theme disables custom colors.\n\t\t\t */\n\t\t\t'disable-custom-colors': boolean;\n\t\t\t/**\n\t\t\t * Whether the theme disables custom font sizes.\n\t\t\t */\n\t\t\t'disable-custom-font-sizes': boolean;\n\t\t\t/**\n\t\t\t * Whether the theme disables custom gradients.\n\t\t\t */\n\t\t\t'disable-custom-gradients': boolean;\n\t\t\t/**\n\t\t\t * Custom color palette if defined by the theme.\n\t\t\t */\n\t\t\t'editor-color-palette': boolean | Color[];\n\t\t\t/**\n\t\t\t * Custom font sizes if defined by the theme.\n\t\t\t */\n\t\t\t'editor-font-sizes': boolean | FontSize[];\n\t\t\t/**\n\t\t\t * Custom spacing sizes if defined by the theme.\n\t\t\t */\n\t\t\t'editor-spacing-sizes': boolean | SpacingSize[];\n\t\t\t/**\n\t\t\t * Custom gradient presets if defined by the theme.\n\t\t\t */\n\t\t\t'editor-gradient-presets': boolean | GradientPreset[];\n\t\t\t/**\n\t\t\t * Whether theme opts in to the editor styles CSS wrapper.\n\t\t\t */\n\t\t\t'editor-styles': boolean;\n\t\t\t/**\n\t\t\t * Allows use of HTML5 markup for search forms, comment forms, comment lists, gallery, and caption.\n\t\t\t */\n\t\t\thtml5: boolean | Html5Option[];\n\t\t\t/**\n\t\t\t * Post formats supported.\n\t\t\t */\n\t\t\tformats: PostFormat[];\n\t\t\t/**\n\t\t\t * Whether link colors are enabled.\n\t\t\t */\n\t\t\t'link-color': boolean;\n\t\t\t/**\n\t\t\t * The post types that support thumbnails or true if all post types are supported.\n\t\t\t */\n\t\t\t'post-thumbnails': boolean | string[];\n\t\t\t/**\n\t\t\t * Whether the theme supports responsive embedded content.\n\t\t\t */\n\t\t\t'responsive-embeds': boolean;\n\t\t\t/**\n\t\t\t * Whether the theme can manage the document title tag.\n\t\t\t */\n\t\t\t'title-tag': boolean;\n\t\t\t/**\n\t\t\t * Whether theme opts in to default WordPress block styles for viewing.\n\t\t\t */\n\t\t\t'wp-block-styles': boolean;\n\t\t}\n\n\t\texport interface CustomBackground {\n\t\t\t'default-image': string;\n\t\t\t'default-preset': 'default' | 'fill' | 'fit' | 'repeat' | 'custom';\n\t\t\t'default-position-x': 'left' | 'center' | 'right';\n\t\t\t'default-position-y': 'left' | 'center' | 'right';\n\t\t\t'default-size': 'auto' | 'contain' | 'cover';\n\t\t\t'default-repeat': 'repeat-x' | 'repeat-y' | 'repeat' | 'no-repeat';\n\t\t\t'default-attachment': 'scroll' | 'fixed';\n\t\t\t'default-color': string;\n\t\t}\n\n\t\texport interface CustomHeader {\n\t\t\t'default-image': string;\n\t\t\t'random-default': boolean;\n\t\t\twidth: number;\n\t\t\theight: number;\n\t\t\t'flex-height': boolean;\n\t\t\t'flex-width': boolean;\n\t\t\t'default-text-color': string;\n\t\t\t'header-text': boolean;\n\t\t\tuploads: boolean;\n\t\t\tvideo: boolean;\n\t\t}\n\n\t\texport interface CustomLogo {\n\t\t\twidth: number;\n\t\t\theight: number;\n\t\t\t'flex-width': boolean;\n\t\t\t'flex-height': boolean;\n\t\t\t'header-text': string[];\n\t\t\t'unlink-homepage-logo': boolean;\n\t\t}\n\n\t\texport interface Color {\n\t\t\tname: string;\n\t\t\tslug: string;\n\t\t\tcolor: string;\n\t\t}\n\n\t\texport interface FontSize {\n\t\t\tname: string;\n\t\t\tsize: number;\n\t\t\tslug: string;\n\t\t}\n\n\t\texport interface SpacingSize {\n\t\t\tname: string;\n\t\t\tsize: number;\n\t\t\tslug: string;\n\t\t}\n\n\t\texport interface GradientPreset {\n\t\t\tname: string;\n\t\t\tgradient: string;\n\t\t\tslug: string;\n\t\t}\n\n\t\texport type Html5Option =\n\t\t\t| 'search-form'\n\t\t\t| 'comment-form'\n\t\t\t| 'comment-list'\n\t\t\t| 'gallery'\n\t\t\t| 'caption'\n\t\t\t| 'script'\n\t\t\t| 'style';\n\t}\n}\n\nexport type Theme< C extends Context = 'edit' > = OmitNevers<\n\t_BaseEntityRecords.Theme< C >\n>;\n"],"mappings":"","ignoreList":[]}
|
|
@@ -94,7 +94,7 @@ export function items(state = {}, action) {
|
|
|
94
94
|
[context]: {
|
|
95
95
|
...state[context],
|
|
96
96
|
...action.items.reduce((accumulator, value) => {
|
|
97
|
-
const itemId = value[key];
|
|
97
|
+
const itemId = value?.[key];
|
|
98
98
|
accumulator[itemId] = conservativeMapItem(state?.[context]?.[itemId], value);
|
|
99
99
|
return accumulator;
|
|
100
100
|
}, {})
|
|
@@ -142,7 +142,7 @@ export function itemIsComplete(state = {}, action) {
|
|
|
142
142
|
[context]: {
|
|
143
143
|
...state[context],
|
|
144
144
|
...action.items.reduce((result, item) => {
|
|
145
|
-
const itemId = item[key];
|
|
145
|
+
const itemId = item?.[key];
|
|
146
146
|
|
|
147
147
|
// Defer to completeness if already assigned. Technically the
|
|
148
148
|
// data may be outdated if receiving items for a field subset.
|
|
@@ -197,7 +197,7 @@ onSubKey('stableKey')])((state = {}, action) => {
|
|
|
197
197
|
return state;
|
|
198
198
|
}
|
|
199
199
|
return {
|
|
200
|
-
itemIds: getMergedItemIds(state?.itemIds || [], action.items.map(item => item[key]), page, perPage),
|
|
200
|
+
itemIds: getMergedItemIds(state?.itemIds || [], action.items.map(item => item?.[key]).filter(Boolean), page, perPage),
|
|
201
201
|
meta: action.meta
|
|
202
202
|
};
|
|
203
203
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["combineReducers","compose","conservativeMapItem","ifMatchingAction","replaceAction","onSubKey","DEFAULT_ENTITY_KEY","getQueryParts","getContextFromAction","action","query","queryParts","context","getMergedItemIds","itemIds","nextItemIds","page","perPage","_itemIds$length","receivedAllIds","nextItemIdsStartIndex","size","Math","max","length","mergedItemIds","Array","i","isInNextItemsRange","removeEntitiesById","entities","ids","Object","fromEntries","entries","filter","id","some","itemId","Number","isInteger","items","state","type","key","reduce","accumulator","value","map","contextState","itemIsComplete","isCompleteQuery","isArray","fields","result","item","receiveQueries","meta","queries","removedItems","queryGroup","contextQueries","queryItems","queryId"],"sources":["@wordpress/core-data/src/queried-data/reducer.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { combineReducers } from '@wordpress/data';\nimport { compose } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport {\n\tconservativeMapItem,\n\tifMatchingAction,\n\treplaceAction,\n\tonSubKey,\n} from '../utils';\nimport { DEFAULT_ENTITY_KEY } from '../entities';\nimport getQueryParts from './get-query-parts';\n\nfunction getContextFromAction( action ) {\n\tconst { query } = action;\n\tif ( ! query ) {\n\t\treturn 'default';\n\t}\n\n\tconst queryParts = getQueryParts( query );\n\treturn queryParts.context;\n}\n\n/**\n * Returns a merged array of item IDs, given details of the received paginated\n * items. The array is sparse-like with `undefined` entries where holes exist.\n *\n * @param {?Array<number>} itemIds Original item IDs (default empty array).\n * @param {number[]} nextItemIds Item IDs to merge.\n * @param {number} page Page of items merged.\n * @param {number} perPage Number of items per page.\n *\n * @return {number[]} Merged array of item IDs.\n */\nexport function getMergedItemIds( itemIds, nextItemIds, page, perPage ) {\n\tconst receivedAllIds = page === 1 && perPage === -1;\n\tif ( receivedAllIds ) {\n\t\treturn nextItemIds;\n\t}\n\tconst nextItemIdsStartIndex = ( page - 1 ) * perPage;\n\n\t// If later page has already been received, default to the larger known\n\t// size of the existing array, else calculate as extending the existing.\n\tconst size = Math.max(\n\t\titemIds?.length ?? 0,\n\t\tnextItemIdsStartIndex + nextItemIds.length\n\t);\n\n\t// Preallocate array since size is known.\n\tconst mergedItemIds = new Array( size );\n\n\tfor ( let i = 0; i < size; i++ ) {\n\t\t// Preserve existing item ID except for subset of range of next items.\n\t\t// We need to check against the possible maximum upper boundary because\n\t\t// a page could receive fewer than what was previously stored.\n\t\tconst isInNextItemsRange =\n\t\t\ti >= nextItemIdsStartIndex && i < nextItemIdsStartIndex + perPage;\n\t\tmergedItemIds[ i ] = isInNextItemsRange\n\t\t\t? nextItemIds[ i - nextItemIdsStartIndex ]\n\t\t\t: itemIds?.[ i ];\n\t}\n\n\treturn mergedItemIds;\n}\n\n/**\n * Helper function to filter out entities with certain IDs.\n * Entities are keyed by their ID.\n *\n * @param {Object} entities Entity objects, keyed by entity ID.\n * @param {Array} ids Entity IDs to filter out.\n *\n * @return {Object} Filtered entities.\n */\nfunction removeEntitiesById( entities, ids ) {\n\treturn Object.fromEntries(\n\t\tObject.entries( entities ).filter(\n\t\t\t( [ id ] ) =>\n\t\t\t\t! ids.some( ( itemId ) => {\n\t\t\t\t\tif ( Number.isInteger( itemId ) ) {\n\t\t\t\t\t\treturn itemId === +id;\n\t\t\t\t\t}\n\t\t\t\t\treturn itemId === id;\n\t\t\t\t} )\n\t\t)\n\t);\n}\n\n/**\n * Reducer tracking items state, keyed by ID. Items are assumed to be normal,\n * where identifiers are common across all queries.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Next state.\n */\nexport function items( state = {}, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'RECEIVE_ITEMS': {\n\t\t\tconst context = getContextFromAction( action );\n\t\t\tconst key = action.key || DEFAULT_ENTITY_KEY;\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\t[ context ]: {\n\t\t\t\t\t...state[ context ],\n\t\t\t\t\t...action.items.reduce( ( accumulator, value ) => {\n\t\t\t\t\t\tconst itemId = value[ key ];\n\t\t\t\t\t\taccumulator[ itemId ] = conservativeMapItem(\n\t\t\t\t\t\t\tstate?.[ context ]?.[ itemId ],\n\t\t\t\t\t\t\tvalue\n\t\t\t\t\t\t);\n\t\t\t\t\t\treturn accumulator;\n\t\t\t\t\t}, {} ),\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\t\tcase 'REMOVE_ITEMS':\n\t\t\treturn Object.fromEntries(\n\t\t\t\tObject.entries( state ).map( ( [ itemId, contextState ] ) => [\n\t\t\t\t\titemId,\n\t\t\t\t\tremoveEntitiesById( contextState, action.itemIds ),\n\t\t\t\t] )\n\t\t\t);\n\t}\n\treturn state;\n}\n\n/**\n * Reducer tracking item completeness, keyed by ID. A complete item is one for\n * which all fields are known. This is used in supporting `_fields` queries,\n * where not all properties associated with an entity are necessarily returned.\n * In such cases, completeness is used as an indication of whether it would be\n * safe to use queried data for a non-`_fields`-limited request.\n *\n * @param {Object<string,Object<string,boolean>>} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object<string,Object<string,boolean>>} Next state.\n */\nexport function itemIsComplete( state = {}, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'RECEIVE_ITEMS': {\n\t\t\tconst context = getContextFromAction( action );\n\t\t\tconst { query, key = DEFAULT_ENTITY_KEY } = action;\n\n\t\t\t// An item is considered complete if it is received without an associated\n\t\t\t// fields query. Ideally, this would be implemented in such a way where the\n\t\t\t// complete aggregate of all fields would satisfy completeness. Since the\n\t\t\t// fields are not consistent across all entities, this would require\n\t\t\t// introspection on the REST schema for each entity to know which fields\n\t\t\t// compose a complete item for that entity.\n\t\t\tconst queryParts = query ? getQueryParts( query ) : {};\n\t\t\tconst isCompleteQuery =\n\t\t\t\t! query || ! Array.isArray( queryParts.fields );\n\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\t[ context ]: {\n\t\t\t\t\t...state[ context ],\n\t\t\t\t\t...action.items.reduce( ( result, item ) => {\n\t\t\t\t\t\tconst itemId = item[ key ];\n\n\t\t\t\t\t\t// Defer to completeness if already assigned. Technically the\n\t\t\t\t\t\t// data may be outdated if receiving items for a field subset.\n\t\t\t\t\t\tresult[ itemId ] =\n\t\t\t\t\t\t\tstate?.[ context ]?.[ itemId ] || isCompleteQuery;\n\n\t\t\t\t\t\treturn result;\n\t\t\t\t\t}, {} ),\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\t\tcase 'REMOVE_ITEMS':\n\t\t\treturn Object.fromEntries(\n\t\t\t\tObject.entries( state ).map( ( [ itemId, contextState ] ) => [\n\t\t\t\t\titemId,\n\t\t\t\t\tremoveEntitiesById( contextState, action.itemIds ),\n\t\t\t\t] )\n\t\t\t);\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer tracking queries state, keyed by stable query key. Each reducer\n * query object includes `itemIds` and `requestingPageByPerPage`.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Next state.\n */\nconst receiveQueries = compose( [\n\t// Limit to matching action type so we don't attempt to replace action on\n\t// an unhandled action.\n\tifMatchingAction( ( action ) => 'query' in action ),\n\n\t// Inject query parts into action for use both in `onSubKey` and reducer.\n\treplaceAction( ( action ) => {\n\t\t// `ifMatchingAction` still passes on initialization, where state is\n\t\t// undefined and a query is not assigned. Avoid attempting to parse\n\t\t// parts. `onSubKey` will omit by lack of `stableKey`.\n\t\tif ( action.query ) {\n\t\t\treturn {\n\t\t\t\t...action,\n\t\t\t\t...getQueryParts( action.query ),\n\t\t\t};\n\t\t}\n\n\t\treturn action;\n\t} ),\n\n\tonSubKey( 'context' ),\n\n\t// Queries shape is shared, but keyed by query `stableKey` part. Original\n\t// reducer tracks only a single query object.\n\tonSubKey( 'stableKey' ),\n] )( ( state = {}, action ) => {\n\tconst { type, page, perPage, key = DEFAULT_ENTITY_KEY } = action;\n\n\tif ( type !== 'RECEIVE_ITEMS' ) {\n\t\treturn state;\n\t}\n\n\treturn {\n\t\titemIds: getMergedItemIds(\n\t\t\tstate?.itemIds || [],\n\t\t\taction.items.map( ( item ) => item[ key ] ),\n\t\t\tpage,\n\t\t\tperPage\n\t\t),\n\t\tmeta: action.meta,\n\t};\n} );\n\n/**\n * Reducer tracking queries state.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Next state.\n */\nconst queries = ( state = {}, action ) => {\n\tswitch ( action.type ) {\n\t\tcase 'RECEIVE_ITEMS':\n\t\t\treturn receiveQueries( state, action );\n\t\tcase 'REMOVE_ITEMS':\n\t\t\tconst removedItems = action.itemIds.reduce( ( result, itemId ) => {\n\t\t\t\tresult[ itemId ] = true;\n\t\t\t\treturn result;\n\t\t\t}, {} );\n\n\t\t\treturn Object.fromEntries(\n\t\t\t\tObject.entries( state ).map(\n\t\t\t\t\t( [ queryGroup, contextQueries ] ) => [\n\t\t\t\t\t\tqueryGroup,\n\t\t\t\t\t\tObject.fromEntries(\n\t\t\t\t\t\t\tObject.entries( contextQueries ).map(\n\t\t\t\t\t\t\t\t( [ query, queryItems ] ) => [\n\t\t\t\t\t\t\t\t\tquery,\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t...queryItems,\n\t\t\t\t\t\t\t\t\t\titemIds: queryItems.itemIds.filter(\n\t\t\t\t\t\t\t\t\t\t\t( queryId ) =>\n\t\t\t\t\t\t\t\t\t\t\t\t! removedItems[ queryId ]\n\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t),\n\t\t\t\t\t]\n\t\t\t\t)\n\t\t\t);\n\t\tdefault:\n\t\t\treturn state;\n\t}\n};\n\nexport default combineReducers( {\n\titems,\n\titemIsComplete,\n\tqueries,\n} );\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,eAAe,QAAQ,iBAAiB;AACjD,SAASC,OAAO,QAAQ,oBAAoB;;AAE5C;AACA;AACA;AACA,SACCC,mBAAmB,EACnBC,gBAAgB,EAChBC,aAAa,EACbC,QAAQ,QACF,UAAU;AACjB,SAASC,kBAAkB,QAAQ,aAAa;AAChD,OAAOC,aAAa,MAAM,mBAAmB;AAE7C,SAASC,oBAAoBA,CAAEC,MAAM,EAAG;EACvC,MAAM;IAAEC;EAAM,CAAC,GAAGD,MAAM;EACxB,IAAK,CAAEC,KAAK,EAAG;IACd,OAAO,SAAS;EACjB;EAEA,MAAMC,UAAU,GAAGJ,aAAa,CAAEG,KAAM,CAAC;EACzC,OAAOC,UAAU,CAACC,OAAO;AAC1B;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,gBAAgBA,CAAEC,OAAO,EAAEC,WAAW,EAAEC,IAAI,EAAEC,OAAO,EAAG;EAAA,IAAAC,eAAA;EACvE,MAAMC,cAAc,GAAGH,IAAI,KAAK,CAAC,IAAIC,OAAO,KAAK,CAAC,CAAC;EACnD,IAAKE,cAAc,EAAG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AU,EACV5B,MAAM,CAACC,WAAW,CACjBD,MAAM,CAACE,OAAO,CAAE2B,cAAe,CAAC,CAACb,GAAG,CACnC,CAAE,CAAEtC,KAAK,EAAEoD,UAAU,CAAE,KAAM,CAC5BpD,KAAK,EACL;QACC,GAAGoD,UAAU;QACbhD,OAAO,EAAEgD,UAAU,CAAChD,OAAO,CAACqB,MAAM,CAC/B4B,OAAO,IACR,CAAEJ,YAAY,CAAEI,OAAO,CACzB;MACD,CAAC,CAEH,CACD,CAAC,CAEH,CACD,CAAC;IACF;MACC,OAAOrB,KAAK;EACd;AACD,CAAC;AAED,eAAe1C,eAAe,CAAE;EAC/ByC,KAAK;EACLS,cAAc;EACdQ;AACD,CAAE,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["combineReducers","compose","conservativeMapItem","ifMatchingAction","replaceAction","onSubKey","DEFAULT_ENTITY_KEY","getQueryParts","getContextFromAction","action","query","queryParts","context","getMergedItemIds","itemIds","nextItemIds","page","perPage","_itemIds$length","receivedAllIds","nextItemIdsStartIndex","size","Math","max","length","mergedItemIds","Array","i","isInNextItemsRange","removeEntitiesById","entities","ids","Object","fromEntries","entries","filter","id","some","itemId","Number","isInteger","items","state","type","key","reduce","accumulator","value","map","contextState","itemIsComplete","isCompleteQuery","isArray","fields","result","item","receiveQueries","Boolean","meta","queries","removedItems","queryGroup","contextQueries","queryItems","queryId"],"sources":["@wordpress/core-data/src/queried-data/reducer.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { combineReducers } from '@wordpress/data';\nimport { compose } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport {\n\tconservativeMapItem,\n\tifMatchingAction,\n\treplaceAction,\n\tonSubKey,\n} from '../utils';\nimport { DEFAULT_ENTITY_KEY } from '../entities';\nimport getQueryParts from './get-query-parts';\n\nfunction getContextFromAction( action ) {\n\tconst { query } = action;\n\tif ( ! query ) {\n\t\treturn 'default';\n\t}\n\n\tconst queryParts = getQueryParts( query );\n\treturn queryParts.context;\n}\n\n/**\n * Returns a merged array of item IDs, given details of the received paginated\n * items. The array is sparse-like with `undefined` entries where holes exist.\n *\n * @param {?Array<number>} itemIds Original item IDs (default empty array).\n * @param {number[]} nextItemIds Item IDs to merge.\n * @param {number} page Page of items merged.\n * @param {number} perPage Number of items per page.\n *\n * @return {number[]} Merged array of item IDs.\n */\nexport function getMergedItemIds( itemIds, nextItemIds, page, perPage ) {\n\tconst receivedAllIds = page === 1 && perPage === -1;\n\tif ( receivedAllIds ) {\n\t\treturn nextItemIds;\n\t}\n\tconst nextItemIdsStartIndex = ( page - 1 ) * perPage;\n\n\t// If later page has already been received, default to the larger known\n\t// size of the existing array, else calculate as extending the existing.\n\tconst size = Math.max(\n\t\titemIds?.length ?? 0,\n\t\tnextItemIdsStartIndex + nextItemIds.length\n\t);\n\n\t// Preallocate array since size is known.\n\tconst mergedItemIds = new Array( size );\n\n\tfor ( let i = 0; i < size; i++ ) {\n\t\t// Preserve existing item ID except for subset of range of next items.\n\t\t// We need to check against the possible maximum upper boundary because\n\t\t// a page could receive fewer than what was previously stored.\n\t\tconst isInNextItemsRange =\n\t\t\ti >= nextItemIdsStartIndex && i < nextItemIdsStartIndex + perPage;\n\t\tmergedItemIds[ i ] = isInNextItemsRange\n\t\t\t? nextItemIds[ i - nextItemIdsStartIndex ]\n\t\t\t: itemIds?.[ i ];\n\t}\n\n\treturn mergedItemIds;\n}\n\n/**\n * Helper function to filter out entities with certain IDs.\n * Entities are keyed by their ID.\n *\n * @param {Object} entities Entity objects, keyed by entity ID.\n * @param {Array} ids Entity IDs to filter out.\n *\n * @return {Object} Filtered entities.\n */\nfunction removeEntitiesById( entities, ids ) {\n\treturn Object.fromEntries(\n\t\tObject.entries( entities ).filter(\n\t\t\t( [ id ] ) =>\n\t\t\t\t! ids.some( ( itemId ) => {\n\t\t\t\t\tif ( Number.isInteger( itemId ) ) {\n\t\t\t\t\t\treturn itemId === +id;\n\t\t\t\t\t}\n\t\t\t\t\treturn itemId === id;\n\t\t\t\t} )\n\t\t)\n\t);\n}\n\n/**\n * Reducer tracking items state, keyed by ID. Items are assumed to be normal,\n * where identifiers are common across all queries.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Next state.\n */\nexport function items( state = {}, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'RECEIVE_ITEMS': {\n\t\t\tconst context = getContextFromAction( action );\n\t\t\tconst key = action.key || DEFAULT_ENTITY_KEY;\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\t[ context ]: {\n\t\t\t\t\t...state[ context ],\n\t\t\t\t\t...action.items.reduce( ( accumulator, value ) => {\n\t\t\t\t\t\tconst itemId = value?.[ key ];\n\n\t\t\t\t\t\taccumulator[ itemId ] = conservativeMapItem(\n\t\t\t\t\t\t\tstate?.[ context ]?.[ itemId ],\n\t\t\t\t\t\t\tvalue\n\t\t\t\t\t\t);\n\t\t\t\t\t\treturn accumulator;\n\t\t\t\t\t}, {} ),\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\t\tcase 'REMOVE_ITEMS':\n\t\t\treturn Object.fromEntries(\n\t\t\t\tObject.entries( state ).map( ( [ itemId, contextState ] ) => [\n\t\t\t\t\titemId,\n\t\t\t\t\tremoveEntitiesById( contextState, action.itemIds ),\n\t\t\t\t] )\n\t\t\t);\n\t}\n\treturn state;\n}\n\n/**\n * Reducer tracking item completeness, keyed by ID. A complete item is one for\n * which all fields are known. This is used in supporting `_fields` queries,\n * where not all properties associated with an entity are necessarily returned.\n * In such cases, completeness is used as an indication of whether it would be\n * safe to use queried data for a non-`_fields`-limited request.\n *\n * @param {Object<string,Object<string,boolean>>} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object<string,Object<string,boolean>>} Next state.\n */\nexport function itemIsComplete( state = {}, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'RECEIVE_ITEMS': {\n\t\t\tconst context = getContextFromAction( action );\n\t\t\tconst { query, key = DEFAULT_ENTITY_KEY } = action;\n\n\t\t\t// An item is considered complete if it is received without an associated\n\t\t\t// fields query. Ideally, this would be implemented in such a way where the\n\t\t\t// complete aggregate of all fields would satisfy completeness. Since the\n\t\t\t// fields are not consistent across all entities, this would require\n\t\t\t// introspection on the REST schema for each entity to know which fields\n\t\t\t// compose a complete item for that entity.\n\t\t\tconst queryParts = query ? getQueryParts( query ) : {};\n\t\t\tconst isCompleteQuery =\n\t\t\t\t! query || ! Array.isArray( queryParts.fields );\n\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\t[ context ]: {\n\t\t\t\t\t...state[ context ],\n\t\t\t\t\t...action.items.reduce( ( result, item ) => {\n\t\t\t\t\t\tconst itemId = item?.[ key ];\n\n\t\t\t\t\t\t// Defer to completeness if already assigned. Technically the\n\t\t\t\t\t\t// data may be outdated if receiving items for a field subset.\n\t\t\t\t\t\tresult[ itemId ] =\n\t\t\t\t\t\t\tstate?.[ context ]?.[ itemId ] || isCompleteQuery;\n\n\t\t\t\t\t\treturn result;\n\t\t\t\t\t}, {} ),\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\t\tcase 'REMOVE_ITEMS':\n\t\t\treturn Object.fromEntries(\n\t\t\t\tObject.entries( state ).map( ( [ itemId, contextState ] ) => [\n\t\t\t\t\titemId,\n\t\t\t\t\tremoveEntitiesById( contextState, action.itemIds ),\n\t\t\t\t] )\n\t\t\t);\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer tracking queries state, keyed by stable query key. Each reducer\n * query object includes `itemIds` and `requestingPageByPerPage`.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Next state.\n */\nconst receiveQueries = compose( [\n\t// Limit to matching action type so we don't attempt to replace action on\n\t// an unhandled action.\n\tifMatchingAction( ( action ) => 'query' in action ),\n\n\t// Inject query parts into action for use both in `onSubKey` and reducer.\n\treplaceAction( ( action ) => {\n\t\t// `ifMatchingAction` still passes on initialization, where state is\n\t\t// undefined and a query is not assigned. Avoid attempting to parse\n\t\t// parts. `onSubKey` will omit by lack of `stableKey`.\n\t\tif ( action.query ) {\n\t\t\treturn {\n\t\t\t\t...action,\n\t\t\t\t...getQueryParts( action.query ),\n\t\t\t};\n\t\t}\n\n\t\treturn action;\n\t} ),\n\n\tonSubKey( 'context' ),\n\n\t// Queries shape is shared, but keyed by query `stableKey` part. Original\n\t// reducer tracks only a single query object.\n\tonSubKey( 'stableKey' ),\n] )( ( state = {}, action ) => {\n\tconst { type, page, perPage, key = DEFAULT_ENTITY_KEY } = action;\n\n\tif ( type !== 'RECEIVE_ITEMS' ) {\n\t\treturn state;\n\t}\n\n\treturn {\n\t\titemIds: getMergedItemIds(\n\t\t\tstate?.itemIds || [],\n\t\t\taction.items.map( ( item ) => item?.[ key ] ).filter( Boolean ),\n\t\t\tpage,\n\t\t\tperPage\n\t\t),\n\t\tmeta: action.meta,\n\t};\n} );\n\n/**\n * Reducer tracking queries state.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Next state.\n */\nconst queries = ( state = {}, action ) => {\n\tswitch ( action.type ) {\n\t\tcase 'RECEIVE_ITEMS':\n\t\t\treturn receiveQueries( state, action );\n\t\tcase 'REMOVE_ITEMS':\n\t\t\tconst removedItems = action.itemIds.reduce( ( result, itemId ) => {\n\t\t\t\tresult[ itemId ] = true;\n\t\t\t\treturn result;\n\t\t\t}, {} );\n\n\t\t\treturn Object.fromEntries(\n\t\t\t\tObject.entries( state ).map(\n\t\t\t\t\t( [ queryGroup, contextQueries ] ) => [\n\t\t\t\t\t\tqueryGroup,\n\t\t\t\t\t\tObject.fromEntries(\n\t\t\t\t\t\t\tObject.entries( contextQueries ).map(\n\t\t\t\t\t\t\t\t( [ query, queryItems ] ) => [\n\t\t\t\t\t\t\t\t\tquery,\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t...queryItems,\n\t\t\t\t\t\t\t\t\t\titemIds: queryItems.itemIds.filter(\n\t\t\t\t\t\t\t\t\t\t\t( queryId ) =>\n\t\t\t\t\t\t\t\t\t\t\t\t! removedItems[ queryId ]\n\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t),\n\t\t\t\t\t]\n\t\t\t\t)\n\t\t\t);\n\t\tdefault:\n\t\t\treturn state;\n\t}\n};\n\nexport default combineReducers( {\n\titems,\n\titemIsComplete,\n\tqueries,\n} );\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,eAAe,QAAQ,iBAAiB;AACjD,SAASC,OAAO,QAAQ,oBAAoB;;AAE5C;AACA;AACA;AACA,SACCC,mBAAmB,EACnBC,gBAAgB,EAChBC,aAAa,EACbC,QAAQ,QACF,UAAU;AACjB,SAASC,kBAAkB,QAAQ,aAAa;AAChD,OAAOC,aAAa,MAAM,mBAAmB;AAE7C,SAASC,oBAAoBA,CAAEC,MAAM,EAAG;EACvC,MAAM;IAAEC;EAAM,CAAC,GAAGD,MAAM;EACxB,IAAK,CAAEC,KAAK,EAAG;IACd,OAAO,SAAS;EACjB;EAEA,MAAMC,UAAU,GAAGJ,aAAa,CAAEG,KAAM,CAAC;EACzC,OAAOC,UAAU,CAACC,OAAO;AAC1B;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,gBAAgBA,CAAEC,OAAO,EAAEC,WAAW,EAAEC,IAAI,EAAEC,OAAO,EAAG;EAAA,IAAAC,eAAA;EACvE,MAAMC,cAAc,GAAGH,IAAI,KAAK,CAAC,IAAIC,OAAO,KAAK,CAAC,CAAC;EACnD,IAAKE,cAAc,EAAG;IACrB,OAAOJ,WAAW;EACnB;EACA,MAAMK,qBAAqB,GAAG,CAAEJ,IAAI,GAAG,CAAC,IAAKC,OAAO;;EAEpD;EACA;EACA,MAAMI,IAAI,GAAGC,IAAI,CAACC,GAAG,EAAAL,eAAA,GACpBJ,OAAO,EAAEU,M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