@wordpress/core-data 6.3.1 → 6.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/README.md +1 -1
  3. package/build/actions.js +6 -6
  4. package/build/actions.js.map +1 -1
  5. package/build/hooks/use-entity-record.js +4 -4
  6. package/build/hooks/use-entity-record.js.map +1 -1
  7. package/build/hooks/use-entity-records.js +4 -4
  8. package/build/hooks/use-entity-records.js.map +1 -1
  9. package/build/hooks/use-resource-permissions.js +2 -2
  10. package/build/hooks/use-resource-permissions.js.map +1 -1
  11. package/build/selectors.js +116 -116
  12. package/build/selectors.js.map +1 -1
  13. package/build-module/actions.js +6 -6
  14. package/build-module/actions.js.map +1 -1
  15. package/build-module/hooks/use-entity-record.js +4 -4
  16. package/build-module/hooks/use-entity-record.js.map +1 -1
  17. package/build-module/hooks/use-entity-records.js +4 -4
  18. package/build-module/hooks/use-entity-records.js.map +1 -1
  19. package/build-module/hooks/use-resource-permissions.js +2 -2
  20. package/build-module/hooks/use-resource-permissions.js.map +1 -1
  21. package/build-module/selectors.js +116 -116
  22. package/build-module/selectors.js.map +1 -1
  23. package/build-types/actions.d.ts +1 -1
  24. package/build-types/actions.d.ts.map +1 -1
  25. package/build-types/hooks/use-entity-record.d.ts +4 -4
  26. package/build-types/hooks/use-entity-records.d.ts +4 -4
  27. package/build-types/hooks/use-resource-permissions.d.ts +2 -2
  28. package/build-types/index.d.ts +1 -1
  29. package/build-types/selectors.d.ts +115 -115
  30. package/package.json +12 -12
  31. package/src/actions.js +6 -6
  32. package/src/hooks/use-entity-record.ts +4 -4
  33. package/src/hooks/use-entity-records.ts +4 -4
  34. package/src/hooks/use-resource-permissions.ts +2 -2
  35. package/src/selectors.ts +116 -116
  36. package/tsconfig.json +1 -0
  37. package/tsconfig.tsbuildinfo +1 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/core-data/src/hooks/use-entity-records.ts"],"names":["addQueryArgs","deprecated","useQuerySelect","store","coreStore","EMPTY_ARRAY","useEntityRecords","kind","name","queryArgs","options","enabled","queryAsString","data","records","rest","query","getEntityRecords","__experimentalUseEntityRecords","alternative","since"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,YAAT,QAA6B,gBAA7B;AACA,OAAOC,UAAP,MAAuB,uBAAvB;AAEA;AACA;AACA;;AACA,OAAOC,cAAP,MAA2B,oBAA3B;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,KAAnC;AAsBA,MAAMC,WAAW,GAAG,EAApB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,eAAe,SAASC,gBAAT,CACdC,IADc,EAEdC,IAFc,EAK0B;AAAA,MAFxCC,SAEwC,uEAFD,EAEC;AAAA,MADxCC,OACwC,uEADrB;AAAEC,IAAAA,OAAO,EAAE;AAAX,GACqB;AACxC;AACA;AACA;AACA;AACA,QAAMC,aAAa,GAAGZ,YAAY,CAAE,EAAF,EAAMS,SAAN,CAAlC;AAEA,QAAM;AAAEI,IAAAA,IAAI,EAAEC,OAAR;AAAiB,OAAGC;AAApB,MAA6Bb,cAAc,CAC9Cc,KAAF,IAAa;AACZ,QAAK,CAAEN,OAAO,CAACC,OAAf,EAAyB;AACxB,aAAO;AACN;AACAE,QAAAA,IAAI,EAAER;AAFA,OAAP;AAIA;;AACD,WAAOW,KAAK,CAAEZ,SAAF,CAAL,CAAmBa,gBAAnB,CAAqCV,IAArC,EAA2CC,IAA3C,EAAiDC,SAAjD,CAAP;AACA,GAT+C,EAUhD,CAAEF,IAAF,EAAQC,IAAR,EAAcI,aAAd,EAA6BF,OAAO,CAACC,OAArC,CAVgD,CAAjD;AAaA,SAAO;AACNG,IAAAA,OADM;AAEN,OAAGC;AAFG,GAAP;AAIA;AAED,OAAO,SAASG,8BAAT,CACNX,IADM,EAENC,IAFM,EAGNC,SAHM,EAINC,OAJM,EAKL;AACDT,EAAAA,UAAU,CAAG,wCAAH,EAA4C;AACrDkB,IAAAA,WAAW,EAAE,0BADwC;AAErDC,IAAAA,KAAK,EAAE;AAF8C,GAA5C,CAAV;AAIA,SAAOd,gBAAgB,CAAEC,IAAF,EAAQC,IAAR,EAAcC,SAAd,EAAyBC,OAAzB,CAAvB;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { addQueryArgs } from '@wordpress/url';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport useQuerySelect from './use-query-select';\nimport { store as coreStore } from '../';\nimport type { Options } from './use-entity-record';\nimport type { Status } from './constants';\n\ninterface EntityRecordsResolution< RecordType > {\n\t/** The requested entity record */\n\trecords: RecordType[] | null;\n\n\t/**\n\t * Is the record still being resolved?\n\t */\n\tisResolving: boolean;\n\n\t/**\n\t * Is the record resolved by now?\n\t */\n\thasResolved: boolean;\n\n\t/** Resolution status */\n\tstatus: Status;\n}\n\nconst EMPTY_ARRAY = [];\n\n/**\n * Resolves the specified entity records.\n *\n * @since 6.1.0 Introduced in WordPress core.\n *\n * @param kind Kind of the entity, e.g. `root` or a `postType`. See rootEntitiesConfig in ../entities.ts for a list of available kinds.\n * @param name Name of the entity, e.g. `plugin` or a `post`. See rootEntitiesConfig in ../entities.ts for a list of available names.\n * @param queryArgs Optional HTTP query description for how to fetch the data, passed to the requested API endpoint.\n * @param options Optional hook options.\n * @example\n * ```js\n * import { useEntityRecord } from '@wordpress/core-data';\n *\n * function PageTitlesList() {\n * const { records, isResolving } = useEntityRecords( 'postType', 'page' );\n *\n * if ( isResolving ) {\n * return 'Loading...';\n * }\n *\n * return (\n * <ul>\n * {records.map(( page ) => (\n * <li>{ page.title }</li>\n * ))}\n * </ul>\n * );\n * }\n *\n * // Rendered in the application:\n * // <PageTitlesList />\n * ```\n *\n * In the above example, when `PageTitlesList` is rendered into an\n * application, the list of records and the resolution details will be retrieved from\n * the store state using `getEntityRecords()`, or resolved if missing.\n *\n * @return Entity records data.\n * @template RecordType\n */\nexport default function useEntityRecords< RecordType >(\n\tkind: string,\n\tname: string,\n\tqueryArgs: Record< string, unknown > = {},\n\toptions: Options = { enabled: true }\n): EntityRecordsResolution< RecordType > {\n\t// Serialize queryArgs to a string that can be safely used as a React dep.\n\t// We can't just pass queryArgs as one of the deps, because if it is passed\n\t// as an object literal, then it will be a different object on each call even\n\t// if the values remain the same.\n\tconst queryAsString = addQueryArgs( '', queryArgs );\n\n\tconst { data: records, ...rest } = useQuerySelect(\n\t\t( query ) => {\n\t\t\tif ( ! options.enabled ) {\n\t\t\t\treturn {\n\t\t\t\t\t// Avoiding returning a new reference on every execution.\n\t\t\t\t\tdata: EMPTY_ARRAY,\n\t\t\t\t};\n\t\t\t}\n\t\t\treturn query( coreStore ).getEntityRecords( kind, name, queryArgs );\n\t\t},\n\t\t[ kind, name, queryAsString, options.enabled ]\n\t);\n\n\treturn {\n\t\trecords,\n\t\t...rest,\n\t};\n}\n\nexport function __experimentalUseEntityRecords(\n\tkind: string,\n\tname: string,\n\tqueryArgs: any,\n\toptions: any\n) {\n\tdeprecated( `wp.data.__experimentalUseEntityRecords`, {\n\t\talternative: 'wp.data.useEntityRecords',\n\t\tsince: '6.1',\n\t} );\n\treturn useEntityRecords( kind, name, queryArgs, options );\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/core-data/src/hooks/use-entity-records.ts"],"names":["addQueryArgs","deprecated","useQuerySelect","store","coreStore","EMPTY_ARRAY","useEntityRecords","kind","name","queryArgs","options","enabled","queryAsString","data","records","rest","query","getEntityRecords","__experimentalUseEntityRecords","alternative","since"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,YAAT,QAA6B,gBAA7B;AACA,OAAOC,UAAP,MAAuB,uBAAvB;AAEA;AACA;AACA;;AACA,OAAOC,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B,CAAEC,IAAF,EAAQC,IAAR,EAAcC,SAAd,EAAyBC,OAAzB,CAAvB;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { addQueryArgs } from '@wordpress/url';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport useQuerySelect from './use-query-select';\nimport { store as coreStore } from '../';\nimport type { Options } from './use-entity-record';\nimport type { Status } from './constants';\n\ninterface EntityRecordsResolution< RecordType > {\n\t/** The requested entity record */\n\trecords: RecordType[] | null;\n\n\t/**\n\t * Is the record still being resolved?\n\t */\n\tisResolving: boolean;\n\n\t/**\n\t * Is the record resolved by now?\n\t */\n\thasResolved: boolean;\n\n\t/** Resolution status */\n\tstatus: Status;\n}\n\nconst EMPTY_ARRAY = [];\n\n/**\n * Resolves the specified entity records.\n *\n * @since 6.1.0 Introduced in WordPress core.\n *\n * @param kind Kind of the entity, e.g. `root` or a `postType`. See rootEntitiesConfig in ../entities.ts for a list of available kinds.\n * @param name Name of the entity, e.g. `plugin` or a `post`. See rootEntitiesConfig in ../entities.ts for a list of available names.\n * @param queryArgs Optional HTTP query description for how to fetch the data, passed to the requested API endpoint.\n * @param options Optional hook options.\n * @example\n * ```js\n * import { useEntityRecord } from '@wordpress/core-data';\n *\n * function PageTitlesList() {\n * const { records, isResolving } = useEntityRecords( 'postType', 'page' );\n *\n * if ( isResolving ) {\n * return 'Loading...';\n * }\n *\n * return (\n * <ul>\n * {records.map(( page ) => (\n * <li>{ page.title }</li>\n * ))}\n * </ul>\n * );\n * }\n *\n * // Rendered in the application:\n * // <PageTitlesList />\n * ```\n *\n * In the above example, when `PageTitlesList` is rendered into an\n * application, the list of records and the resolution details will be retrieved from\n * the store state using `getEntityRecords()`, or resolved if missing.\n *\n * @return Entity records data.\n * @template RecordType\n */\nexport default function useEntityRecords< RecordType >(\n\tkind: string,\n\tname: string,\n\tqueryArgs: Record< string, unknown > = {},\n\toptions: Options = { enabled: true }\n): EntityRecordsResolution< RecordType > {\n\t// Serialize queryArgs to a string that can be safely used as a React dep.\n\t// We can't just pass queryArgs as one of the deps, because if it is passed\n\t// as an object literal, then it will be a different object on each call even\n\t// if the values remain the same.\n\tconst queryAsString = addQueryArgs( '', queryArgs );\n\n\tconst { data: records, ...rest } = useQuerySelect(\n\t\t( query ) => {\n\t\t\tif ( ! options.enabled ) {\n\t\t\t\treturn {\n\t\t\t\t\t// Avoiding returning a new reference on every execution.\n\t\t\t\t\tdata: EMPTY_ARRAY,\n\t\t\t\t};\n\t\t\t}\n\t\t\treturn query( coreStore ).getEntityRecords( kind, name, queryArgs );\n\t\t},\n\t\t[ kind, name, queryAsString, options.enabled ]\n\t);\n\n\treturn {\n\t\trecords,\n\t\t...rest,\n\t};\n}\n\nexport function __experimentalUseEntityRecords(\n\tkind: string,\n\tname: string,\n\tqueryArgs: any,\n\toptions: any\n) {\n\tdeprecated( `wp.data.__experimentalUseEntityRecords`, {\n\t\talternative: 'wp.data.useEntityRecords',\n\t\tsince: '6.1',\n\t} );\n\treturn useEntityRecords( kind, name, queryArgs, options );\n}\n"]}
@@ -15,8 +15,8 @@ import useQuerySelect from './use-query-select';
15
15
  *
16
16
  * @since 6.1.0 Introduced in WordPress core.
17
17
  *
18
- * @param resource The resource in question, e.g. media.
19
- * @param id ID of a specific resource entry, if needed, e.g. 10.
18
+ * @param resource The resource in question, e.g. media.
19
+ * @param id ID of a specific resource entry, if needed, e.g. 10.
20
20
  *
21
21
  * @example
22
22
  * ```js
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/core-data/src/hooks/use-resource-permissions.ts"],"names":["deprecated","store","coreStore","Status","useQuerySelect","useResourcePermissions","resource","id","resolve","canUser","create","read","isResolving","hasResolved","status","Idle","Resolving","Success","canCreate","data","canRead","update","_delete","canUpdate","canDelete","__experimentalUseResourcePermissions","alternative","since"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,uBAAvB;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,SAAlB,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,EAAkD;AAC3D0B,IAAAA,WAAW,EAAE,gCAD8C;AAE3DC,IAAAA,KAAK,EAAE;AAFoD,GAAlD,CAAV;AAIA,SAAOtB,sBAAsB,CAAEC,QAAF,EAAYC,EAAZ,CAA7B;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport { store as coreStore } from '../';\nimport { Status } from './constants';\nimport useQuerySelect from './use-query-select';\n\ninterface GlobalResourcePermissionsResolution {\n\t/** Can the current user create new resources of this type? */\n\tcanCreate: boolean;\n}\ninterface SpecificResourcePermissionsResolution {\n\t/** Can the current user update resources of this type? */\n\tcanUpdate: boolean;\n\t/** Can the current user delete resources of this type? */\n\tcanDelete: boolean;\n}\ninterface ResolutionDetails {\n\t/** Resolution status */\n\tstatus: Status;\n\t/**\n\t * Is the data still being resolved?\n\t */\n\tisResolving: boolean;\n}\n\n/**\n * Is the data resolved by now?\n */\ntype HasResolved = boolean;\n\ntype ResourcePermissionsResolution< IdType > = [\n\tHasResolved,\n\tResolutionDetails &\n\t\tGlobalResourcePermissionsResolution &\n\t\t( IdType extends void ? SpecificResourcePermissionsResolution : {} )\n];\n\n/**\n * Resolves resource permissions.\n *\n * @since 6.1.0 Introduced in WordPress core.\n *\n * @param resource The resource in question, e.g. media.\n * @param id ID of a specific resource entry, if needed, e.g. 10.\n *\n * @example\n * ```js\n * import { useResourcePermissions } from '@wordpress/core-data';\n *\n * function PagesList() {\n * const { canCreate, isResolving } = useResourcePermissions( 'pages' );\n *\n * if ( isResolving ) {\n * return 'Loading ...';\n * }\n *\n * return (\n * <div>\n * {canCreate ? (<button>+ Create a new page</button>) : false}\n * // ...\n * </div>\n * );\n * }\n *\n * // Rendered in the application:\n * // <PagesList />\n * ```\n *\n * @example\n * ```js\n * import { useResourcePermissions } from '@wordpress/core-data';\n *\n * function Page({ pageId }) {\n * const {\n * canCreate,\n * canUpdate,\n * canDelete,\n * isResolving\n * } = useResourcePermissions( 'pages', pageId );\n *\n * if ( isResolving ) {\n * return 'Loading ...';\n * }\n *\n * return (\n * <div>\n * {canCreate ? (<button>+ Create a new page</button>) : false}\n * {canUpdate ? (<button>Edit page</button>) : false}\n * {canDelete ? (<button>Delete page</button>) : false}\n * // ...\n * </div>\n * );\n * }\n *\n * // Rendered in the application:\n * // <Page pageId={ 15 } />\n * ```\n *\n * In the above example, when `PagesList` is rendered into an\n * application, the appropriate permissions and the resolution details will be retrieved from\n * the store state using `canUser()`, or resolved if missing.\n *\n * @return Entity records data.\n * @template IdType\n */\nexport default function useResourcePermissions< IdType = void >(\n\tresource: string,\n\tid?: IdType\n): ResourcePermissionsResolution< IdType > {\n\treturn useQuerySelect(\n\t\t( resolve ) => {\n\t\t\tconst { canUser } = resolve( coreStore );\n\t\t\tconst create = canUser( 'create', resource );\n\t\t\tif ( ! id ) {\n\t\t\t\tconst read = canUser( 'read', resource );\n\n\t\t\t\tconst isResolving = create.isResolving || read.isResolving;\n\t\t\t\tconst hasResolved = create.hasResolved && read.hasResolved;\n\t\t\t\tlet status = Status.Idle;\n\t\t\t\tif ( isResolving ) {\n\t\t\t\t\tstatus = Status.Resolving;\n\t\t\t\t} else if ( hasResolved ) {\n\t\t\t\t\tstatus = Status.Success;\n\t\t\t\t}\n\n\t\t\t\treturn {\n\t\t\t\t\tstatus,\n\t\t\t\t\tisResolving,\n\t\t\t\t\thasResolved,\n\t\t\t\t\tcanCreate: create.hasResolved && create.data,\n\t\t\t\t\tcanRead: read.hasResolved && read.data,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tconst read = canUser( 'read', resource, id );\n\t\t\tconst update = canUser( 'update', resource, id );\n\t\t\tconst _delete = canUser( 'delete', resource, id );\n\t\t\tconst isResolving =\n\t\t\t\tread.isResolving ||\n\t\t\t\tcreate.isResolving ||\n\t\t\t\tupdate.isResolving ||\n\t\t\t\t_delete.isResolving;\n\t\t\tconst hasResolved =\n\t\t\t\tread.hasResolved &&\n\t\t\t\tcreate.hasResolved &&\n\t\t\t\tupdate.hasResolved &&\n\t\t\t\t_delete.hasResolved;\n\n\t\t\tlet status = Status.Idle;\n\t\t\tif ( isResolving ) {\n\t\t\t\tstatus = Status.Resolving;\n\t\t\t} else if ( hasResolved ) {\n\t\t\t\tstatus = Status.Success;\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tstatus,\n\t\t\t\tisResolving,\n\t\t\t\thasResolved,\n\t\t\t\tcanRead: hasResolved && read.data,\n\t\t\t\tcanCreate: hasResolved && create.data,\n\t\t\t\tcanUpdate: hasResolved && update.data,\n\t\t\t\tcanDelete: hasResolved && _delete.data,\n\t\t\t};\n\t\t},\n\t\t[ resource, id ]\n\t);\n}\n\nexport function __experimentalUseResourcePermissions(\n\tresource: string,\n\tid?: unknown\n) {\n\tdeprecated( `wp.data.__experimentalUseResourcePermissions`, {\n\t\talternative: 'wp.data.useResourcePermissions',\n\t\tsince: '6.1',\n\t} );\n\treturn useResourcePermissions( resource, id );\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/core-data/src/hooks/use-resource-permissions.ts"],"names":["deprecated","store","coreStore","Status","useQuerySelect","useResourcePermissions","resource","id","resolve","canUser","create","read","isResolving","hasResolved","status","Idle","Resolving","Success","canCreate","data","canRead","update","_delete","canUpdate","canDelete","__experimentalUseResourcePermissions","alternative","since"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,uBAAvB;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,KAAnC;AACA,SAASC,MAAT,QAAuB,aAAvB;AACA,OAAOC,cAAP,MAA2B,oBAA3B;;AAiCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA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CAAvB;;AACA,UAAMK,WAAW,GAChBD,IAAI,CAACC,WAAL,IACAF,MAAM,CAACE,WADP,IAEAS,MAAM,CAACT,WAFP,IAGAU,OAAO,CAACV,WAJT;AAKA,UAAMC,WAAW,GAChBF,IAAI,CAACE,WAAL,IACAH,MAAM,CAACG,WADP,IAEAQ,MAAM,CAACR,WAFP,IAGAS,OAAO,CAACT,WAJT;AAMA,QAAIC,MAAM,GAAGX,MAAM,CAACY,IAApB;;AACA,QAAKH,WAAL,EAAmB;AAClBE,MAAAA,MAAM,GAAGX,MAAM,CAACa,SAAhB;AACA,KAFD,MAEO,IAAKH,WAAL,EAAmB;AACzBC,MAAAA,MAAM,GAAGX,MAAM,CAACc,OAAhB;AACA;;AACD,WAAO;AACNH,MAAAA,MADM;AAENF,MAAAA,WAFM;AAGNC,MAAAA,WAHM;AAINO,MAAAA,OAAO,EAAEP,WAAW,IAAIF,IAAI,CAACQ,IAJvB;AAKND,MAAAA,SAAS,EAAEL,WAAW,IAAIH,MAAM,CAACS,IAL3B;AAMNI,MAAAA,SAAS,EAAEV,WAAW,IAAIQ,MAAM,CAACF,IAN3B;AAONK,MAAAA,SAAS,EAAEX,WAAW,IAAIS,OAAO,CAACH;AAP5B,KAAP;AASA,GAtDmB,EAuDpB,CAAEb,QAAF,EAAYC,EAAZ,CAvDoB,CAArB;AAyDA;AAED,OAAO,SAASkB,oCAAT,CACNnB,QADM,EAENC,EAFM,EAGL;AACDP,EAAAA,UAAU,CAAG,8CAAH,EAAkD;AAC3D0B,IAAAA,WAAW,EAAE,gCAD8C;AAE3DC,IAAAA,KAAK,EAAE;AAFoD,GAAlD,CAAV;AAIA,SAAOtB,sBAAsB,CAAEC,QAAF,EAAYC,EAAZ,CAA7B;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport { store as coreStore } from '../';\nimport { Status } from './constants';\nimport useQuerySelect from './use-query-select';\n\ninterface GlobalResourcePermissionsResolution {\n\t/** Can the current user create new resources of this type? */\n\tcanCreate: boolean;\n}\ninterface SpecificResourcePermissionsResolution {\n\t/** Can the current user update resources of this type? */\n\tcanUpdate: boolean;\n\t/** Can the current user delete resources of this type? */\n\tcanDelete: boolean;\n}\ninterface ResolutionDetails {\n\t/** Resolution status */\n\tstatus: Status;\n\t/**\n\t * Is the data still being resolved?\n\t */\n\tisResolving: boolean;\n}\n\n/**\n * Is the data resolved by now?\n */\ntype HasResolved = boolean;\n\ntype ResourcePermissionsResolution< IdType > = [\n\tHasResolved,\n\tResolutionDetails &\n\t\tGlobalResourcePermissionsResolution &\n\t\t( IdType extends void ? SpecificResourcePermissionsResolution : {} )\n];\n\n/**\n * Resolves resource permissions.\n *\n * @since 6.1.0 Introduced in WordPress core.\n *\n * @param resource The resource in question, e.g. media.\n * @param id ID of a specific resource entry, if needed, e.g. 10.\n *\n * @example\n * ```js\n * import { useResourcePermissions } from '@wordpress/core-data';\n *\n * function PagesList() {\n * const { canCreate, isResolving } = useResourcePermissions( 'pages' );\n *\n * if ( isResolving ) {\n * return 'Loading ...';\n * }\n *\n * return (\n * <div>\n * {canCreate ? (<button>+ Create a new page</button>) : false}\n * // ...\n * </div>\n * );\n * }\n *\n * // Rendered in the application:\n * // <PagesList />\n * ```\n *\n * @example\n * ```js\n * import { useResourcePermissions } from '@wordpress/core-data';\n *\n * function Page({ pageId }) {\n * const {\n * canCreate,\n * canUpdate,\n * canDelete,\n * isResolving\n * } = useResourcePermissions( 'pages', pageId );\n *\n * if ( isResolving ) {\n * return 'Loading ...';\n * }\n *\n * return (\n * <div>\n * {canCreate ? (<button>+ Create a new page</button>) : false}\n * {canUpdate ? (<button>Edit page</button>) : false}\n * {canDelete ? (<button>Delete page</button>) : false}\n * // ...\n * </div>\n * );\n * }\n *\n * // Rendered in the application:\n * // <Page pageId={ 15 } />\n * ```\n *\n * In the above example, when `PagesList` is rendered into an\n * application, the appropriate permissions and the resolution details will be retrieved from\n * the store state using `canUser()`, or resolved if missing.\n *\n * @return Entity records data.\n * @template IdType\n */\nexport default function useResourcePermissions< IdType = void >(\n\tresource: string,\n\tid?: IdType\n): ResourcePermissionsResolution< IdType > {\n\treturn useQuerySelect(\n\t\t( resolve ) => {\n\t\t\tconst { canUser } = resolve( coreStore );\n\t\t\tconst create = canUser( 'create', resource );\n\t\t\tif ( ! id ) {\n\t\t\t\tconst read = canUser( 'read', resource );\n\n\t\t\t\tconst isResolving = create.isResolving || read.isResolving;\n\t\t\t\tconst hasResolved = create.hasResolved && read.hasResolved;\n\t\t\t\tlet status = Status.Idle;\n\t\t\t\tif ( isResolving ) {\n\t\t\t\t\tstatus = Status.Resolving;\n\t\t\t\t} else if ( hasResolved ) {\n\t\t\t\t\tstatus = Status.Success;\n\t\t\t\t}\n\n\t\t\t\treturn {\n\t\t\t\t\tstatus,\n\t\t\t\t\tisResolving,\n\t\t\t\t\thasResolved,\n\t\t\t\t\tcanCreate: create.hasResolved && create.data,\n\t\t\t\t\tcanRead: read.hasResolved && read.data,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tconst read = canUser( 'read', resource, id );\n\t\t\tconst update = canUser( 'update', resource, id );\n\t\t\tconst _delete = canUser( 'delete', resource, id );\n\t\t\tconst isResolving =\n\t\t\t\tread.isResolving ||\n\t\t\t\tcreate.isResolving ||\n\t\t\t\tupdate.isResolving ||\n\t\t\t\t_delete.isResolving;\n\t\t\tconst hasResolved =\n\t\t\t\tread.hasResolved &&\n\t\t\t\tcreate.hasResolved &&\n\t\t\t\tupdate.hasResolved &&\n\t\t\t\t_delete.hasResolved;\n\n\t\t\tlet status = Status.Idle;\n\t\t\tif ( isResolving ) {\n\t\t\t\tstatus = Status.Resolving;\n\t\t\t} else if ( hasResolved ) {\n\t\t\t\tstatus = Status.Success;\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tstatus,\n\t\t\t\tisResolving,\n\t\t\t\thasResolved,\n\t\t\t\tcanRead: hasResolved && read.data,\n\t\t\t\tcanCreate: hasResolved && create.data,\n\t\t\t\tcanUpdate: hasResolved && update.data,\n\t\t\t\tcanDelete: hasResolved && _delete.data,\n\t\t\t};\n\t\t},\n\t\t[ resource, id ]\n\t);\n}\n\nexport function __experimentalUseResourcePermissions(\n\tresource: string,\n\tid?: unknown\n) {\n\tdeprecated( `wp.data.__experimentalUseResourcePermissions`, {\n\t\talternative: 'wp.data.useResourcePermissions',\n\t\tsince: '6.1',\n\t} );\n\treturn useResourcePermissions( resource, id );\n}\n"]}
@@ -31,8 +31,8 @@ const EMPTY_OBJECT = {};
31
31
  * Returns true if a request is in progress for embed preview data, or false
32
32
  * otherwise.
33
33
  *
34
- * @param state Data state.
35
- * @param url URL the preview would be for.
34
+ * @param state Data state.
35
+ * @param url URL the preview would be for.
36
36
  *
37
37
  * @return Whether a request is in progress for an embed preview.
38
38
  */
@@ -45,9 +45,9 @@ export const isRequestingEmbedPreview = createRegistrySelector(select => (state,
45
45
  *
46
46
  * @deprecated since 11.3. Callers should use `select( 'core' ).getUsers({ who: 'authors' })` instead.
47
47
  *
48
- * @param state Data state.
49
- * @param query Optional object of query parameters to
50
- * include with request.
48
+ * @param state Data state.
49
+ * @param query Optional object of query parameters to
50
+ * include with request.
51
51
  * @return Authors list.
52
52
  */
53
53
 
@@ -62,7 +62,7 @@ export function getAuthors(state, query) {
62
62
  /**
63
63
  * Returns the current user.
64
64
  *
65
- * @param state Data state.
65
+ * @param state Data state.
66
66
  *
67
67
  * @return Current user object.
68
68
  */
@@ -73,8 +73,8 @@ export function getCurrentUser(state) {
73
73
  /**
74
74
  * Returns all the users returned by a query ID.
75
75
  *
76
- * @param state Data state.
77
- * @param queryID Query ID.
76
+ * @param state Data state.
77
+ * @param queryID Query ID.
78
78
  *
79
79
  * @return Users list.
80
80
  */
@@ -89,8 +89,8 @@ export const getUserQueryResults = createSelector((state, queryID) => {
89
89
  * Returns the loaded entities for the given kind.
90
90
  *
91
91
  * @deprecated since WordPress 6.0. Use getEntitiesConfig instead
92
- * @param state Data state.
93
- * @param kind Entity kind.
92
+ * @param state Data state.
93
+ * @param kind Entity kind.
94
94
  *
95
95
  * @return Array of entities with config matching kind.
96
96
  */
@@ -105,8 +105,8 @@ export function getEntitiesByKind(state, kind) {
105
105
  /**
106
106
  * Returns the loaded entities for the given kind.
107
107
  *
108
- * @param state Data state.
109
- * @param kind Entity kind.
108
+ * @param state Data state.
109
+ * @param kind Entity kind.
110
110
  *
111
111
  * @return Array of entities with config matching kind.
112
112
  */
@@ -118,9 +118,9 @@ export function getEntitiesConfig(state, kind) {
118
118
  * Returns the entity config given its kind and name.
119
119
  *
120
120
  * @deprecated since WordPress 6.0. Use getEntityConfig instead
121
- * @param state Data state.
122
- * @param kind Entity kind.
123
- * @param name Entity name.
121
+ * @param state Data state.
122
+ * @param kind Entity kind.
123
+ * @param name Entity name.
124
124
  *
125
125
  * @return Entity config
126
126
  */
@@ -135,9 +135,9 @@ export function getEntity(state, kind, name) {
135
135
  /**
136
136
  * Returns the entity config given its kind and name.
137
137
  *
138
- * @param state Data state.
139
- * @param kind Entity kind.
140
- * @param name Entity name.
138
+ * @param state Data state.
139
+ * @param kind Entity kind.
140
+ * @param name Entity name.
141
141
  *
142
142
  * @return Entity config
143
143
  */
@@ -177,12 +177,12 @@ export function getEntityConfig(state, kind, name) {
177
177
  * yet received, undefined if the value entity is known to not exist, or the
178
178
  * entity object if it exists and is received.
179
179
  *
180
- * @param state State tree
181
- * @param kind Entity kind.
182
- * @param name Entity name.
183
- * @param key Record's key
184
- * @param query Optional query. If requesting specific
185
- * fields, fields must always include the ID.
180
+ * @param state State tree
181
+ * @param kind Entity kind.
182
+ * @param name Entity name.
183
+ * @param key Record's key
184
+ * @param query Optional query. If requesting specific
185
+ * fields, fields must always include the ID.
186
186
  *
187
187
  * @return Record.
188
188
  */
@@ -235,10 +235,10 @@ export const getEntityRecord = createSelector((state, kind, name, key, query) =>
235
235
  /**
236
236
  * Returns the Entity's record object by key. Doesn't trigger a resolver nor requests the entity records from the API if the entity record isn't available in the local state.
237
237
  *
238
- * @param state State tree
239
- * @param kind Entity kind.
240
- * @param name Entity name.
241
- * @param key Record's key
238
+ * @param state State tree
239
+ * @param kind Entity kind.
240
+ * @param name Entity name.
241
+ * @param key Record's key
242
242
  *
243
243
  * @return Record.
244
244
  */
@@ -250,10 +250,10 @@ export function __experimentalGetEntityRecordNoResolver(state, kind, name, key)
250
250
  * Returns the entity's record object by key,
251
251
  * with its attributes mapped to their raw values.
252
252
  *
253
- * @param state State tree.
254
- * @param kind Entity kind.
255
- * @param name Entity name.
256
- * @param key Record's key.
253
+ * @param state State tree.
254
+ * @param kind Entity kind.
255
+ * @param name Entity name.
256
+ * @param key Record's key.
257
257
  *
258
258
  * @return Object with the entity's raw attributes.
259
259
  */
@@ -282,10 +282,10 @@ export const getRawEntityRecord = createSelector((state, kind, name, key) => {
282
282
  * Returns true if records have been received for the given set of parameters,
283
283
  * or false otherwise.
284
284
  *
285
- * @param state State tree
286
- * @param kind Entity kind.
287
- * @param name Entity name.
288
- * @param query Optional terms query.
285
+ * @param state State tree
286
+ * @param kind Entity kind.
287
+ * @param name Entity name.
288
+ * @param query Optional terms query.
289
289
  *
290
290
  * @return Whether entity records have been received.
291
291
  */
@@ -305,11 +305,11 @@ export function hasEntityRecords(state, kind, name, query) {
305
305
  /**
306
306
  * Returns the Entity's records.
307
307
  *
308
- * @param state State tree
309
- * @param kind Entity kind.
310
- * @param name Entity name.
311
- * @param query Optional terms query. If requesting specific
312
- * fields, fields must always include the ID.
308
+ * @param state State tree
309
+ * @param kind Entity kind.
310
+ * @param name Entity name.
311
+ * @param query Optional terms query. If requesting specific
312
+ * fields, fields must always include the ID.
313
313
  *
314
314
  * @return Records.
315
315
  */
@@ -328,7 +328,7 @@ export const getEntityRecords = (state, kind, name, query) => {
328
328
  /**
329
329
  * Returns the list of dirty entity records.
330
330
  *
331
- * @param state State tree.
331
+ * @param state State tree.
332
332
  *
333
333
  * @return The list of updated records
334
334
  */
@@ -368,7 +368,7 @@ export const __experimentalGetDirtyEntityRecords = createSelector(state => {
368
368
  /**
369
369
  * Returns the list of entities currently being saved.
370
370
  *
371
- * @param state State tree.
371
+ * @param state State tree.
372
372
  *
373
373
  * @return The list of records being saved.
374
374
  */
@@ -407,10 +407,10 @@ export const __experimentalGetEntitiesBeingSaved = createSelector(state => {
407
407
  /**
408
408
  * Returns the specified entity record's edits.
409
409
  *
410
- * @param state State tree.
411
- * @param kind Entity kind.
412
- * @param name Entity name.
413
- * @param recordId Record ID.
410
+ * @param state State tree.
411
+ * @param kind Entity kind.
412
+ * @param name Entity name.
413
+ * @param recordId Record ID.
414
414
  *
415
415
  * @return The entity record's edits.
416
416
  */
@@ -425,10 +425,10 @@ export function getEntityRecordEdits(state, kind, name, recordId) {
425
425
  * are not considered for change detection.
426
426
  * They are defined in the entity's config.
427
427
  *
428
- * @param state State tree.
429
- * @param kind Entity kind.
430
- * @param name Entity name.
431
- * @param recordId Record ID.
428
+ * @param state State tree.
429
+ * @param kind Entity kind.
430
+ * @param name Entity name.
431
+ * @param recordId Record ID.
432
432
  *
433
433
  * @return The entity record's non transient edits.
434
434
  */
@@ -455,10 +455,10 @@ export const getEntityRecordNonTransientEdits = createSelector((state, kind, nam
455
455
  * Returns true if the specified entity record has edits,
456
456
  * and false otherwise.
457
457
  *
458
- * @param state State tree.
459
- * @param kind Entity kind.
460
- * @param name Entity name.
461
- * @param recordId Record ID.
458
+ * @param state State tree.
459
+ * @param kind Entity kind.
460
+ * @param name Entity name.
461
+ * @param recordId Record ID.
462
462
  *
463
463
  * @return Whether the entity record has edits or not.
464
464
  */
@@ -469,10 +469,10 @@ export function hasEditsForEntityRecord(state, kind, name, recordId) {
469
469
  /**
470
470
  * Returns the specified entity record, merged with its edits.
471
471
  *
472
- * @param state State tree.
473
- * @param kind Entity kind.
474
- * @param name Entity name.
475
- * @param recordId Record ID.
472
+ * @param state State tree.
473
+ * @param kind Entity kind.
474
+ * @param name Entity name.
475
+ * @param recordId Record ID.
476
476
  *
477
477
  * @return The entity record, merged with its edits.
478
478
  */
@@ -488,10 +488,10 @@ export const getEditedEntityRecord = createSelector((state, kind, name, recordId
488
488
  /**
489
489
  * Returns true if the specified entity record is autosaving, and false otherwise.
490
490
  *
491
- * @param state State tree.
492
- * @param kind Entity kind.
493
- * @param name Entity name.
494
- * @param recordId Record ID.
491
+ * @param state State tree.
492
+ * @param kind Entity kind.
493
+ * @param name Entity name.
494
+ * @param recordId Record ID.
495
495
  *
496
496
  * @return Whether the entity record is autosaving or not.
497
497
  */
@@ -506,10 +506,10 @@ export function isAutosavingEntityRecord(state, kind, name, recordId) {
506
506
  /**
507
507
  * Returns true if the specified entity record is saving, and false otherwise.
508
508
  *
509
- * @param state State tree.
510
- * @param kind Entity kind.
511
- * @param name Entity name.
512
- * @param recordId Record ID.
509
+ * @param state State tree.
510
+ * @param kind Entity kind.
511
+ * @param name Entity name.
512
+ * @param recordId Record ID.
513
513
  *
514
514
  * @return Whether the entity record is saving or not.
515
515
  */
@@ -520,10 +520,10 @@ export function isSavingEntityRecord(state, kind, name, recordId) {
520
520
  /**
521
521
  * Returns true if the specified entity record is deleting, and false otherwise.
522
522
  *
523
- * @param state State tree.
524
- * @param kind Entity kind.
525
- * @param name Entity name.
526
- * @param recordId Record ID.
523
+ * @param state State tree.
524
+ * @param kind Entity kind.
525
+ * @param name Entity name.
526
+ * @param recordId Record ID.
527
527
  *
528
528
  * @return Whether the entity record is deleting or not.
529
529
  */
@@ -534,10 +534,10 @@ export function isDeletingEntityRecord(state, kind, name, recordId) {
534
534
  /**
535
535
  * Returns the specified entity record's last save error.
536
536
  *
537
- * @param state State tree.
538
- * @param kind Entity kind.
539
- * @param name Entity name.
540
- * @param recordId Record ID.
537
+ * @param state State tree.
538
+ * @param kind Entity kind.
539
+ * @param name Entity name.
540
+ * @param recordId Record ID.
541
541
  *
542
542
  * @return The entity record's save error.
543
543
  */
@@ -548,10 +548,10 @@ export function getLastEntitySaveError(state, kind, name, recordId) {
548
548
  /**
549
549
  * Returns the specified entity record's last delete error.
550
550
  *
551
- * @param state State tree.
552
- * @param kind Entity kind.
553
- * @param name Entity name.
554
- * @param recordId Record ID.
551
+ * @param state State tree.
552
+ * @param kind Entity kind.
553
+ * @param name Entity name.
554
+ * @param recordId Record ID.
555
555
  *
556
556
  * @return The entity record's save error.
557
557
  */
@@ -566,7 +566,7 @@ export function getLastEntityDeleteError(state, kind, name, recordId) {
566
566
  * of the history stack we are at. 0 is the
567
567
  * last edit, -1 is the second last, and so on.
568
568
  *
569
- * @param state State tree.
569
+ * @param state State tree.
570
570
  *
571
571
  * @return The current undo offset.
572
572
  */
@@ -578,7 +578,7 @@ function getCurrentUndoOffset(state) {
578
578
  * Returns the previous edit from the current undo offset
579
579
  * for the entity records edits history, if any.
580
580
  *
581
- * @param state State tree.
581
+ * @param state State tree.
582
582
  *
583
583
  * @return The edit.
584
584
  */
@@ -591,7 +591,7 @@ export function getUndoEdit(state) {
591
591
  * Returns the next edit from the current undo offset
592
592
  * for the entity records edits history, if any.
593
593
  *
594
- * @param state State tree.
594
+ * @param state State tree.
595
595
  *
596
596
  * @return The edit.
597
597
  */
@@ -603,7 +603,7 @@ export function getRedoEdit(state) {
603
603
  * Returns true if there is a previous edit from the current undo offset
604
604
  * for the entity records edits history, and false otherwise.
605
605
  *
606
- * @param state State tree.
606
+ * @param state State tree.
607
607
  *
608
608
  * @return Whether there is a previous edit or not.
609
609
  */
@@ -615,7 +615,7 @@ export function hasUndo(state) {
615
615
  * Returns true if there is a next edit from the current undo offset
616
616
  * for the entity records edits history, and false otherwise.
617
617
  *
618
- * @param state State tree.
618
+ * @param state State tree.
619
619
  *
620
620
  * @return Whether there is a next edit or not.
621
621
  */
@@ -626,7 +626,7 @@ export function hasRedo(state) {
626
626
  /**
627
627
  * Return the current theme.
628
628
  *
629
- * @param state Data state.
629
+ * @param state Data state.
630
630
  *
631
631
  * @return The current theme.
632
632
  */
@@ -637,7 +637,7 @@ export function getCurrentTheme(state) {
637
637
  /**
638
638
  * Return the ID of the current global styles object.
639
639
  *
640
- * @param state Data state.
640
+ * @param state Data state.
641
641
  *
642
642
  * @return The current global styles ID.
643
643
  */
@@ -648,7 +648,7 @@ export function __experimentalGetCurrentGlobalStylesId(state) {
648
648
  /**
649
649
  * Return theme supports data in the index.
650
650
  *
651
- * @param state Data state.
651
+ * @param state Data state.
652
652
  *
653
653
  * @return Index data.
654
654
  */
@@ -661,8 +661,8 @@ export function getThemeSupports(state) {
661
661
  /**
662
662
  * Returns the embed preview for the given URL.
663
663
  *
664
- * @param state Data state.
665
- * @param url Embedded URL.
664
+ * @param state Data state.
665
+ * @param url Embedded URL.
666
666
  *
667
667
  * @return Undefined if the preview has not been fetched, otherwise, the preview fetched from the embed preview API.
668
668
  */
@@ -677,8 +677,8 @@ export function getEmbedPreview(state, url) {
677
677
  * We need to be able to determine if a URL is embeddable or not, based on what we
678
678
  * get back from the oEmbed preview API.
679
679
  *
680
- * @param state Data state.
681
- * @param url Embedded URL.
680
+ * @param state Data state.
681
+ * @param url Embedded URL.
682
682
  *
683
683
  * @return Is the preview for the URL an oEmbed link fallback.
684
684
  */
@@ -702,10 +702,10 @@ export function isPreviewEmbedFallback(state, url) {
702
702
  *
703
703
  * https://developer.wordpress.org/rest-api/reference/
704
704
  *
705
- * @param state Data state.
706
- * @param action Action to check. One of: 'create', 'read', 'update', 'delete'.
707
- * @param resource REST resource to check, e.g. 'media' or 'posts'.
708
- * @param id Optional ID of the rest resource to check.
705
+ * @param state Data state.
706
+ * @param action Action to check. One of: 'create', 'read', 'update', 'delete'.
707
+ * @param resource REST resource to check, e.g. 'media' or 'posts'.
708
+ * @param id Optional ID of the rest resource to check.
709
709
  *
710
710
  * @return Whether or not the user can perform the action,
711
711
  * or `undefined` if the OPTIONS request is still being made.
@@ -723,10 +723,10 @@ export function canUser(state, action, resource, id) {
723
723
  *
724
724
  * https://developer.wordpress.org/rest-api/reference/
725
725
  *
726
- * @param state Data state.
727
- * @param kind Entity kind.
728
- * @param name Entity name.
729
- * @param recordId Record's id.
726
+ * @param state Data state.
727
+ * @param kind Entity kind.
728
+ * @param name Entity name.
729
+ * @param recordId Record's id.
730
730
  * @return Whether or not the user can edit,
731
731
  * or `undefined` if the OPTIONS request is still being made.
732
732
  */
@@ -747,9 +747,9 @@ export function canUserEditEntityRecord(state, kind, name, recordId) {
747
747
  * May return multiple autosaves since the backend stores one autosave per
748
748
  * author for each post.
749
749
  *
750
- * @param state State tree.
751
- * @param postType The type of the parent post.
752
- * @param postId The id of the parent post.
750
+ * @param state State tree.
751
+ * @param postType The type of the parent post.
752
+ * @param postId The id of the parent post.
753
753
  *
754
754
  * @return An array of autosaves for the post, or undefined if there is none.
755
755
  */
@@ -760,10 +760,10 @@ export function getAutosaves(state, postType, postId) {
760
760
  /**
761
761
  * Returns the autosave for the post and author.
762
762
  *
763
- * @param state State tree.
764
- * @param postType The type of the parent post.
765
- * @param postId The id of the parent post.
766
- * @param authorId The id of the author.
763
+ * @param state State tree.
764
+ * @param postType The type of the parent post.
765
+ * @param postId The id of the parent post.
766
+ * @param authorId The id of the author.
767
767
  *
768
768
  * @return The autosave for the post and author.
769
769
  */
@@ -779,9 +779,9 @@ export function getAutosave(state, postType, postId, authorId) {
779
779
  /**
780
780
  * Returns true if the REST request for autosaves has completed.
781
781
  *
782
- * @param state State tree.
783
- * @param postType The type of the parent post.
784
- * @param postId The id of the parent post.
782
+ * @param state State tree.
783
+ * @param postType The type of the parent post.
784
+ * @param postId The id of the parent post.
785
785
  *
786
786
  * @return True if the REST request was completed. False otherwise.
787
787
  */
@@ -803,7 +803,7 @@ export const hasFetchedAutosaves = createRegistrySelector(select => (state, post
803
803
  * );
804
804
  * ```
805
805
  *
806
- * @param state Editor state.
806
+ * @param state Editor state.
807
807
  *
808
808
  * @return A value whose reference will change only when an edit occurs.
809
809
  */
@@ -813,8 +813,8 @@ state => [], state => [state.undo.length, state.undo.offset, state.undo.flattene
813
813
  /**
814
814
  * Retrieve the frontend template used for a given link.
815
815
  *
816
- * @param state Editor state.
817
- * @param link Link.
816
+ * @param state Editor state.
817
+ * @param link Link.
818
818
  *
819
819
  * @return The template record.
820
820
  */
@@ -833,7 +833,7 @@ export function __experimentalGetTemplateForLink(state, link) {
833
833
  /**
834
834
  * Retrieve the current theme's base global styles
835
835
  *
836
- * @param state Editor state.
836
+ * @param state Editor state.
837
837
  *
838
838
  * @return The Global Styles object.
839
839
  */
@@ -850,7 +850,7 @@ export function __experimentalGetCurrentThemeBaseGlobalStyles(state) {
850
850
  /**
851
851
  * Return the ID of the current global styles object.
852
852
  *
853
- * @param state Data state.
853
+ * @param state Data state.
854
854
  *
855
855
  * @return The current global styles ID.
856
856
  */
@@ -867,7 +867,7 @@ export function __experimentalGetCurrentThemeGlobalStylesVariations(state) {
867
867
  /**
868
868
  * Retrieve the list of registered block patterns.
869
869
  *
870
- * @param state Data state.
870
+ * @param state Data state.
871
871
  *
872
872
  * @return Block pattern list.
873
873
  */
@@ -878,7 +878,7 @@ export function getBlockPatterns(state) {
878
878
  /**
879
879
  * Retrieve the list of registered block pattern categories.
880
880
  *
881
- * @param state Data state.
881
+ * @param state Data state.
882
882
  *
883
883
  * @return Block pattern category list.
884
884
  */