2024-01-31 07:59:56 -05:00
/******/ ( ( ) => { // webpackBootstrap
2022-04-11 08:04:30 -04:00
/******/ "use strict" ;
/******/ // The require scope
/******/ var _ _webpack _require _ _ = { } ;
/******/
/************************************************************************/
/******/ /* webpack/runtime/compat get default export */
2024-01-31 07:59:56 -05:00
/******/ ( ( ) => {
2022-04-11 08:04:30 -04:00
/******/ // getDefaultExport function for compatibility with non-harmony modules
2024-01-31 07:59:56 -05:00
/******/ _ _webpack _require _ _ . n = ( module ) => {
2022-04-11 08:04:30 -04:00
/******/ var getter = module && module . _ _esModule ?
2024-01-31 07:59:56 -05:00
/******/ ( ) => ( module [ 'default' ] ) :
/******/ ( ) => ( module ) ;
2022-04-11 08:04:30 -04:00
/******/ _ _webpack _require _ _ . d ( getter , { a : getter } ) ;
/******/ return getter ;
/******/ } ;
2024-01-31 07:59:56 -05:00
/******/ } ) ( ) ;
2022-04-11 08:04:30 -04:00
/******/
/******/ /* webpack/runtime/define property getters */
2024-01-31 07:59:56 -05:00
/******/ ( ( ) => {
2022-04-11 08:04:30 -04:00
/******/ // define getter functions for harmony exports
2024-01-31 07:59:56 -05:00
/******/ _ _webpack _require _ _ . d = ( exports , definition ) => {
2022-04-11 08:04:30 -04:00
/******/ for ( var key in definition ) {
/******/ if ( _ _webpack _require _ _ . o ( definition , key ) && ! _ _webpack _require _ _ . o ( exports , key ) ) {
/******/ Object . defineProperty ( exports , key , { enumerable : true , get : definition [ key ] } ) ;
/******/ }
/******/ }
2020-01-03 08:17:24 -05:00
/******/ } ;
2024-01-31 07:59:56 -05:00
/******/ } ) ( ) ;
2022-04-11 08:04:30 -04:00
/******/
/******/ /* webpack/runtime/hasOwnProperty shorthand */
2024-01-31 07:59:56 -05:00
/******/ ( ( ) => {
/******/ _ _webpack _require _ _ . o = ( obj , prop ) => ( Object . prototype . hasOwnProperty . call ( obj , prop ) )
/******/ } ) ( ) ;
2022-04-11 08:04:30 -04:00
/******/
/******/ /* webpack/runtime/make namespace object */
2024-01-31 07:59:56 -05:00
/******/ ( ( ) => {
2022-04-11 08:04:30 -04:00
/******/ // define __esModule on exports
2024-01-31 07:59:56 -05:00
/******/ _ _webpack _require _ _ . r = ( exports ) => {
2022-04-11 08:04:30 -04:00
/******/ if ( typeof Symbol !== 'undefined' && Symbol . toStringTag ) {
/******/ Object . defineProperty ( exports , Symbol . toStringTag , { value : 'Module' } ) ;
/******/ }
/******/ Object . defineProperty ( exports , '__esModule' , { value : true } ) ;
/******/ } ;
2024-01-31 07:59:56 -05:00
/******/ } ) ( ) ;
2022-04-11 08:04:30 -04:00
/******/
2020-01-03 08:17:24 -05:00
/************************************************************************/
2022-04-11 08:04:30 -04:00
var _ _webpack _exports _ _ = { } ;
2020-06-29 07:50:29 -04:00
// ESM COMPAT FLAG
2020-01-03 08:17:24 -05:00
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
2020-06-29 07:50:29 -04:00
2021-01-27 21:04:13 -05:00
// EXPORTS
2022-04-11 08:04:30 -04:00
_ _webpack _require _ _ . d ( _ _webpack _exports _ _ , {
2024-01-31 07:59:56 -05:00
store : ( ) => ( /* reexport */ store )
2022-04-11 08:04:30 -04:00
} ) ;
2021-01-27 21:04:13 -05:00
2020-06-29 07:50:29 -04:00
// NAMESPACE OBJECT: ./node_modules/@wordpress/block-directory/build-module/store/selectors.js
2020-01-03 08:17:24 -05:00
var selectors _namespaceObject = { } ;
_ _webpack _require _ _ . r ( selectors _namespaceObject ) ;
2022-04-11 08:04:30 -04:00
_ _webpack _require _ _ . d ( selectors _namespaceObject , {
2024-01-31 07:59:56 -05:00
getDownloadableBlocks : ( ) => ( getDownloadableBlocks ) ,
getErrorNoticeForBlock : ( ) => ( getErrorNoticeForBlock ) ,
getErrorNotices : ( ) => ( getErrorNotices ) ,
getInstalledBlockTypes : ( ) => ( getInstalledBlockTypes ) ,
getNewBlockTypes : ( ) => ( getNewBlockTypes ) ,
getUnusedBlockTypes : ( ) => ( getUnusedBlockTypes ) ,
isInstalling : ( ) => ( isInstalling ) ,
isRequestingDownloadableBlocks : ( ) => ( isRequestingDownloadableBlocks )
2022-04-11 08:04:30 -04:00
} ) ;
2020-06-29 07:50:29 -04:00
// NAMESPACE OBJECT: ./node_modules/@wordpress/block-directory/build-module/store/actions.js
2020-01-03 08:17:24 -05:00
var actions _namespaceObject = { } ;
_ _webpack _require _ _ . r ( actions _namespaceObject ) ;
2022-04-11 08:04:30 -04:00
_ _webpack _require _ _ . d ( actions _namespaceObject , {
2024-01-31 07:59:56 -05:00
addInstalledBlockType : ( ) => ( addInstalledBlockType ) ,
clearErrorNotice : ( ) => ( clearErrorNotice ) ,
fetchDownloadableBlocks : ( ) => ( fetchDownloadableBlocks ) ,
installBlockType : ( ) => ( installBlockType ) ,
receiveDownloadableBlocks : ( ) => ( receiveDownloadableBlocks ) ,
removeInstalledBlockType : ( ) => ( removeInstalledBlockType ) ,
setErrorNotice : ( ) => ( setErrorNotice ) ,
setIsInstalling : ( ) => ( setIsInstalling ) ,
uninstallBlockType : ( ) => ( uninstallBlockType )
2022-04-11 08:04:30 -04:00
} ) ;
2020-06-26 09:33:47 -04:00
2021-11-08 09:29:21 -05:00
// NAMESPACE OBJECT: ./node_modules/@wordpress/block-directory/build-module/store/resolvers.js
var resolvers _namespaceObject = { } ;
_ _webpack _require _ _ . r ( resolvers _namespaceObject ) ;
2022-04-11 08:04:30 -04:00
_ _webpack _require _ _ . d ( resolvers _namespaceObject , {
2024-01-31 07:59:56 -05:00
getDownloadableBlocks : ( ) => ( resolvers _getDownloadableBlocks )
2022-04-11 08:04:30 -04:00
} ) ;
2020-01-03 08:17:24 -05:00
2022-04-11 08:04:30 -04:00
; // CONCATENATED MODULE: external ["wp","plugins"]
2024-01-31 07:59:56 -05:00
const external _wp _plugins _namespaceObject = window [ "wp" ] [ "plugins" ] ;
2022-04-11 08:04:30 -04:00
; // CONCATENATED MODULE: external ["wp","hooks"]
2024-01-31 07:59:56 -05:00
const external _wp _hooks _namespaceObject = window [ "wp" ] [ "hooks" ] ;
2022-04-11 08:04:30 -04:00
; // CONCATENATED MODULE: external ["wp","blocks"]
2024-01-31 07:59:56 -05:00
const external _wp _blocks _namespaceObject = window [ "wp" ] [ "blocks" ] ;
2022-04-11 08:04:30 -04:00
; // CONCATENATED MODULE: external ["wp","data"]
2024-01-31 07:59:56 -05:00
const external _wp _data _namespaceObject = window [ "wp" ] [ "data" ] ;
Editor: Update the WordPress packages to the Gutenberg 16.7 RC2 version.
This patch, somewhat small brings a lot to WordPress.
This includes features like:
- DataViews.
- Customization tools like box shadow, background size and repeat.
- UI improvements in the site editor.
- Preferences sharing between the post and site editors.
- Unified panels and editors between post and site editors.
- Improved template mode in the post editor.
- Iterations to multiple interactive blocks.
- Preparing the blocks and UI for pattern overrides.
- and a lot more.
Props luisherranz, gziolo, isabel_brison, costdev, jonsurrell, peterwilsoncc, get_dave, antonvlasenko, desrosj.
See #60315.
Built from https://develop.svn.wordpress.org/trunk@57377
git-svn-id: http://core.svn.wordpress.org/trunk@56883 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-29 16:07:12 -05:00
; // CONCATENATED MODULE: external ["wp","element"]
2024-01-31 07:59:56 -05:00
const external _wp _element _namespaceObject = window [ "wp" ] [ "element" ] ;
2022-04-11 08:04:30 -04:00
; // CONCATENATED MODULE: external ["wp","editor"]
2024-01-31 07:59:56 -05:00
const external _wp _editor _namespaceObject = window [ "wp" ] [ "editor" ] ;
2022-04-11 08:04:30 -04:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/store/reducer.js
2020-01-03 08:17:24 -05:00
/ * *
* WordPress dependencies
* /
2023-09-26 10:23:26 -04:00
2020-01-03 08:17:24 -05:00
/ * *
* Reducer returning an array of downloadable blocks .
*
* @ param { Object } state Current state .
* @ param { Object } action Dispatched action .
*
* @ return { Object } Updated state .
* /
2023-06-27 10:24:19 -04:00
const downloadableBlocks = ( state = { } , action ) => {
2020-01-03 08:17:24 -05:00
switch ( action . type ) {
case 'FETCH_DOWNLOADABLE_BLOCKS' :
2023-09-26 10:23:26 -04:00
return {
... state ,
2021-05-19 11:09:27 -04:00
[ action . filterValue ] : {
isRequesting : true
}
} ;
2020-01-03 08:17:24 -05:00
case 'RECEIVE_DOWNLOADABLE_BLOCKS' :
2023-09-26 10:23:26 -04:00
return {
... state ,
2021-05-19 11:09:27 -04:00
[ action . filterValue ] : {
results : action . downloadableBlocks ,
isRequesting : false
}
} ;
2020-02-06 16:03:31 -05:00
}
return state ;
} ;
2023-09-26 10:23:26 -04:00
2020-02-06 16:03:31 -05:00
/ * *
* Reducer managing the installation and deletion of blocks .
*
* @ param { Object } state Current state .
* @ param { Object } action Dispatched action .
*
* @ return { Object } Updated state .
* /
2023-06-27 10:24:19 -04:00
const blockManagement = ( state = {
installedBlockTypes : [ ] ,
isInstalling : { }
} , action ) => {
2020-02-06 16:03:31 -05:00
switch ( action . type ) {
2020-01-03 08:17:24 -05:00
case 'ADD_INSTALLED_BLOCK_TYPE' :
2023-09-26 10:23:26 -04:00
return {
... state ,
2021-05-19 11:09:27 -04:00
installedBlockTypes : [ ... state . installedBlockTypes , action . item ]
} ;
2020-01-03 08:17:24 -05:00
case 'REMOVE_INSTALLED_BLOCK_TYPE' :
2023-09-26 10:23:26 -04:00
return {
... state ,
2021-05-19 11:09:27 -04:00
installedBlockTypes : state . installedBlockTypes . filter ( blockType => blockType . name !== action . item . name )
} ;
2020-06-26 09:33:47 -04:00
case 'SET_INSTALLING_BLOCK' :
2023-09-26 10:23:26 -04:00
return {
... state ,
isInstalling : {
... state . isInstalling ,
2021-05-19 11:09:27 -04:00
[ action . blockId ] : action . isInstalling
}
} ;
2020-01-03 08:17:24 -05:00
}
return state ;
} ;
2023-09-26 10:23:26 -04:00
2020-06-26 09:33:47 -04:00
/ * *
* Reducer returning an object of error notices .
*
* @ param { Object } state Current state .
* @ param { Object } action Dispatched action .
*
* @ return { Object } Updated state .
* /
2023-06-27 10:24:19 -04:00
const errorNotices = ( state = { } , action ) => {
2020-06-26 09:33:47 -04:00
switch ( action . type ) {
case 'SET_ERROR_NOTICE' :
2023-09-26 10:23:26 -04:00
return {
... state ,
2021-05-19 11:09:27 -04:00
[ action . blockId ] : {
message : action . message ,
isFatal : action . isFatal
}
} ;
2020-07-07 10:43:35 -04:00
case 'CLEAR_ERROR_NOTICE' :
2022-09-20 11:43:29 -04:00
const {
[ action . blockId ] : blockId ,
... restState
} = state ;
return restState ;
2020-06-26 09:33:47 -04:00
}
return state ;
} ;
2024-01-31 07:59:56 -05:00
/* harmony default export */ const reducer = ( ( 0 , external _wp _data _namespaceObject . combineReducers ) ( {
2021-05-19 11:09:27 -04:00
downloadableBlocks ,
blockManagement ,
errorNotices
2020-01-03 08:17:24 -05:00
} ) ) ;
2022-04-11 08:04:30 -04:00
; // CONCATENATED MODULE: external ["wp","blockEditor"]
2024-01-31 07:59:56 -05:00
const external _wp _blockEditor _namespaceObject = window [ "wp" ] [ "blockEditor" ] ;
2022-04-11 08:04:30 -04:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/store/utils/has-block-type.js
2020-06-26 09:33:47 -04:00
/ * *
* Check if a block list contains a specific block type . Recursively searches
* through ` innerBlocks ` if they exist .
*
2021-11-08 09:29:21 -05:00
* @ param { Object } blockType A block object to search for .
* @ param { Object [ ] } blocks The list of blocks to look through .
2020-06-26 09:33:47 -04:00
*
* @ return { boolean } Whether the blockType is found .
* /
2023-06-27 10:24:19 -04:00
function hasBlockType ( blockType , blocks = [ ] ) {
2020-06-26 09:33:47 -04:00
if ( ! blocks . length ) {
return false ;
}
2023-06-27 10:24:19 -04:00
if ( blocks . some ( ( {
name
} ) => name === blockType . name ) ) {
2020-06-26 09:33:47 -04:00
return true ;
}
2021-05-19 11:09:27 -04:00
for ( let i = 0 ; i < blocks . length ; i ++ ) {
2020-06-26 09:33:47 -04:00
if ( hasBlockType ( blockType , blocks [ i ] . innerBlocks ) ) {
return true ;
}
}
return false ;
}
2022-04-11 08:04:30 -04:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/store/selectors.js
2020-06-26 09:33:47 -04:00
/ * *
* WordPress dependencies
* /
2021-04-15 11:19:43 -04:00
2023-09-26 10:23:26 -04:00
2020-06-26 09:33:47 -04:00
/ * *
* Internal dependencies
* /
2020-01-03 08:17:24 -05:00
/ * *
* Returns true if application is requesting for downloadable blocks .
*
2020-10-13 09:10:30 -04:00
* @ param { Object } state Global application state .
2020-06-26 09:33:47 -04:00
* @ param { string } filterValue Search string .
*
2020-10-13 09:10:30 -04:00
* @ return { boolean } Whether a request is in progress for the blocks list .
2020-01-03 08:17:24 -05:00
* /
2022-04-11 08:04:30 -04:00
function isRequestingDownloadableBlocks ( state , filterValue ) {
2023-06-27 10:24:19 -04:00
var _state$downloadableBl ;
return ( _state$downloadableBl = state . downloadableBlocks [ filterValue ] ? . isRequesting ) !== null && _state$downloadableBl !== void 0 ? _state$downloadableBl : false ;
2020-01-03 08:17:24 -05:00
}
2023-09-26 10:23:26 -04:00
2020-01-03 08:17:24 -05:00
/ * *
2020-10-13 09:10:30 -04:00
* Returns the available uninstalled blocks .
2020-01-03 08:17:24 -05:00
*
* @ param { Object } state Global application state .
* @ param { string } filterValue Search string .
*
2020-10-13 09:10:30 -04:00
* @ return { Array } Downloadable blocks .
2020-01-03 08:17:24 -05:00
* /
2022-04-11 08:04:30 -04:00
function getDownloadableBlocks ( state , filterValue ) {
2023-06-27 10:24:19 -04:00
var _state$downloadableBl2 ;
return ( _state$downloadableBl2 = state . downloadableBlocks [ filterValue ] ? . results ) !== null && _state$downloadableBl2 !== void 0 ? _state$downloadableBl2 : [ ] ;
2020-01-03 08:17:24 -05:00
}
2023-09-26 10:23:26 -04:00
2020-01-03 08:17:24 -05:00
/ * *
2020-10-13 09:10:30 -04:00
* Returns the block types that have been installed on the server in this
* session .
2020-01-03 08:17:24 -05:00
*
* @ param { Object } state Global application state .
*
2020-10-13 09:10:30 -04:00
* @ return { Array } Block type items
2020-01-03 08:17:24 -05:00
* /
function getInstalledBlockTypes ( state ) {
2020-02-06 16:03:31 -05:00
return state . blockManagement . installedBlockTypes ;
2020-01-03 08:17:24 -05:00
}
2023-09-26 10:23:26 -04:00
2020-01-03 08:17:24 -05:00
/ * *
2020-06-26 09:33:47 -04:00
* Returns block types that have been installed on the server and used in the
* current post .
*
* @ param { Object } state Global application state .
*
* @ return { Array } Block type items .
2020-01-03 08:17:24 -05:00
* /
2024-09-19 21:55:35 -04:00
const getNewBlockTypes = ( 0 , external _wp _data _namespaceObject . createRegistrySelector ) ( select => ( 0 , external _wp _data _namespaceObject . createSelector ) ( state => {
2022-04-11 08:04:30 -04:00
const usedBlockTree = select ( external _wp _blockEditor _namespaceObject . store ) . getBlocks ( ) ;
2021-05-19 11:09:27 -04:00
const installedBlockTypes = getInstalledBlockTypes ( state ) ;
return installedBlockTypes . filter ( blockType => hasBlockType ( blockType , usedBlockTree ) ) ;
2024-09-19 21:55:35 -04:00
} , state => [ getInstalledBlockTypes ( state ) , select ( external _wp _blockEditor _namespaceObject . store ) . getBlocks ( ) ] ) ) ;
2023-09-26 10:23:26 -04:00
2020-01-03 08:17:24 -05:00
/ * *
2020-06-26 09:33:47 -04:00
* Returns the block types that have been installed on the server but are not
* used in the current post .
*
* @ param { Object } state Global application state .
*
* @ return { Array } Block type items .
2020-01-03 08:17:24 -05:00
* /
2024-09-19 21:55:35 -04:00
const getUnusedBlockTypes = ( 0 , external _wp _data _namespaceObject . createRegistrySelector ) ( select => ( 0 , external _wp _data _namespaceObject . createSelector ) ( state => {
2022-04-11 08:04:30 -04:00
const usedBlockTree = select ( external _wp _blockEditor _namespaceObject . store ) . getBlocks ( ) ;
2021-05-19 11:09:27 -04:00
const installedBlockTypes = getInstalledBlockTypes ( state ) ;
return installedBlockTypes . filter ( blockType => ! hasBlockType ( blockType , usedBlockTree ) ) ;
2024-09-19 21:55:35 -04:00
} , state => [ getInstalledBlockTypes ( state ) , select ( external _wp _blockEditor _namespaceObject . store ) . getBlocks ( ) ] ) ) ;
2023-09-26 10:23:26 -04:00
2020-01-03 08:17:24 -05:00
/ * *
2020-10-13 09:10:30 -04:00
* Returns true if a block plugin install is in progress .
2020-01-03 08:17:24 -05:00
*
2020-10-13 09:10:30 -04:00
* @ param { Object } state Global application state .
2020-06-26 09:33:47 -04:00
* @ param { string } blockId Id of the block .
2020-01-03 08:17:24 -05:00
*
2020-10-13 09:10:30 -04:00
* @ return { boolean } Whether this block is currently being installed .
2020-01-03 08:17:24 -05:00
* /
2022-04-11 08:04:30 -04:00
function isInstalling ( state , blockId ) {
2020-06-26 09:33:47 -04:00
return state . blockManagement . isInstalling [ blockId ] || false ;
2020-01-03 08:17:24 -05:00
}
2023-09-26 10:23:26 -04:00
2020-01-03 08:17:24 -05:00
/ * *
2020-10-13 09:10:30 -04:00
* Returns all block error notices .
2020-01-03 08:17:24 -05:00
*
2020-06-26 09:33:47 -04:00
* @ param { Object } state Global application state .
2020-01-03 08:17:24 -05:00
*
2020-06-26 09:33:47 -04:00
* @ return { Object } Object with error notices .
2020-01-03 08:17:24 -05:00
* /
2020-06-26 09:33:47 -04:00
function getErrorNotices ( state ) {
return state . errorNotices ;
2020-01-03 08:17:24 -05:00
}
2023-09-26 10:23:26 -04:00
2020-01-03 08:17:24 -05:00
/ * *
2020-06-26 09:33:47 -04:00
* Returns the error notice for a given block .
2020-01-03 08:17:24 -05:00
*
2020-06-26 09:33:47 -04:00
* @ param { Object } state Global application state .
* @ param { string } blockId The ID of the block plugin . eg : my - block
2020-01-03 08:17:24 -05:00
*
2020-06-26 09:33:47 -04:00
* @ return { string | boolean } The error text , or false if no error .
2020-01-03 08:17:24 -05:00
* /
2022-04-11 08:04:30 -04:00
function getErrorNoticeForBlock ( state , blockId ) {
2020-07-07 10:43:35 -04:00
return state . errorNotices [ blockId ] ;
2020-01-03 08:17:24 -05:00
}
2020-06-26 09:33:47 -04:00
2022-04-11 08:04:30 -04:00
; // CONCATENATED MODULE: external ["wp","i18n"]
2024-01-31 07:59:56 -05:00
const external _wp _i18n _namespaceObject = window [ "wp" ] [ "i18n" ] ;
2022-04-11 08:04:30 -04:00
; // CONCATENATED MODULE: external ["wp","apiFetch"]
2024-01-31 07:59:56 -05:00
const external _wp _apiFetch _namespaceObject = window [ "wp" ] [ "apiFetch" ] ;
2022-04-11 08:04:30 -04:00
var external _wp _apiFetch _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( external _wp _apiFetch _namespaceObject ) ;
; // CONCATENATED MODULE: external ["wp","notices"]
2024-01-31 07:59:56 -05:00
const external _wp _notices _namespaceObject = window [ "wp" ] [ "notices" ] ;
2022-04-12 11:12:47 -04:00
; // CONCATENATED MODULE: external ["wp","url"]
2024-01-31 07:59:56 -05:00
const external _wp _url _namespaceObject = window [ "wp" ] [ "url" ] ;
2022-04-11 08:04:30 -04:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/store/load-assets.js
2020-07-07 10:43:35 -04:00
/ * *
* WordPress dependencies
* /
2023-09-26 10:23:26 -04:00
2020-01-03 08:17:24 -05:00
/ * *
2020-07-27 16:10:36 -04:00
* Load an asset for a block .
*
* This function returns a Promise that will resolve once the asset is loaded ,
2021-01-27 21:04:13 -05:00
* or in the case of Stylesheets and Inline JavaScript , will resolve immediately .
2020-06-26 09:33:47 -04:00
*
2020-07-27 16:10:36 -04:00
* @ param { HTMLElement } el A HTML Element asset to inject .
2020-01-03 08:17:24 -05:00
*
2020-06-26 09:33:47 -04:00
* @ return { Promise } Promise which will resolve when the asset is loaded .
2020-01-03 08:17:24 -05:00
* /
2021-05-19 11:09:27 -04:00
const loadAsset = el => {
return new Promise ( ( resolve , reject ) => {
2020-07-27 16:10:36 -04:00
/ *
* Reconstruct the passed element , this is required as inserting the Node directly
* won 't always fire the required onload events, even if the asset wasn' t already loaded .
* /
2021-05-19 11:09:27 -04:00
const newNode = document . createElement ( el . nodeName ) ;
[ 'id' , 'rel' , 'src' , 'href' , 'type' ] . forEach ( attr => {
2020-07-27 16:10:36 -04:00
if ( el [ attr ] ) {
newNode [ attr ] = el [ attr ] ;
}
2023-09-26 10:23:26 -04:00
} ) ;
2020-01-03 08:17:24 -05:00
2023-09-26 10:23:26 -04:00
// Append inline <script> contents.
2020-07-27 16:10:36 -04:00
if ( el . innerHTML ) {
newNode . appendChild ( document . createTextNode ( el . innerHTML ) ) ;
2020-06-26 09:33:47 -04:00
}
2021-05-19 11:09:27 -04:00
newNode . onload = ( ) => resolve ( true ) ;
newNode . onerror = ( ) => reject ( new Error ( 'Error loading asset.' ) ) ;
2023-09-26 10:23:26 -04:00
document . body . appendChild ( newNode ) ;
2020-06-26 09:33:47 -04:00
2023-09-26 10:23:26 -04:00
// Resolve Stylesheets and Inline JavaScript immediately.
2020-07-27 16:10:36 -04:00
if ( 'link' === newNode . nodeName . toLowerCase ( ) || 'script' === newNode . nodeName . toLowerCase ( ) && ! newNode . src ) {
resolve ( ) ;
}
2020-06-26 09:33:47 -04:00
} ) ;
2020-01-03 08:17:24 -05:00
} ;
2023-09-26 10:23:26 -04:00
2020-01-03 08:17:24 -05:00
/ * *
* Load the asset files for a block
* /
2021-11-08 09:29:21 -05:00
async function loadAssets ( ) {
/ *
* Fetch the current URL ( post - new . php , or post . php ? post = 1 & action = edit ) and compare the
* JavaScript and CSS assets loaded between the pages . This imports the required assets
* for the block into the current page while not requiring that we know them up - front .
* In the future this can be improved by reliance upon block . json and / or a script - loader
* dependency API .
* /
const response = await external _wp _apiFetch _default ( ) ( {
url : document . location . href ,
parse : false
} ) ;
const data = await response . text ( ) ;
const doc = new window . DOMParser ( ) . parseFromString ( data , 'text/html' ) ;
const newAssets = Array . from ( doc . querySelectorAll ( 'link[rel="stylesheet"],script' ) ) . filter ( asset => asset . id && ! document . getElementById ( asset . id ) ) ;
2023-09-26 10:23:26 -04:00
2021-11-08 09:29:21 -05:00
/ *
* Load each asset in order , as they may depend upon an earlier loaded script .
* Stylesheets and Inline Scripts will resolve immediately upon insertion .
* /
for ( const newAsset of newAssets ) {
await loadAsset ( newAsset ) ;
2020-01-03 08:17:24 -05:00
}
2021-11-08 09:29:21 -05:00
}
2020-01-03 08:17:24 -05:00
2022-04-11 08:04:30 -04:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/store/utils/get-plugin-url.js
2020-07-07 10:43:35 -04:00
/ * *
* Get the plugin ' s direct API link out of a block - directory response .
*
* @ param { Object } block The block object
*
* @ return { string } The plugin URL , if exists .
* /
function getPluginUrl ( block ) {
if ( ! block ) {
return false ;
}
2021-05-19 11:09:27 -04:00
const link = block . links [ 'wp:plugin' ] || block . links . self ;
2020-07-07 10:43:35 -04:00
if ( link && link . length ) {
return link [ 0 ] . href ;
}
return false ;
}
2022-04-11 08:04:30 -04:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/store/actions.js
2020-01-03 08:17:24 -05:00
/ * *
* WordPress dependencies
* /
2020-06-26 09:33:47 -04:00
2021-01-27 21:04:13 -05:00
2022-04-12 11:12:47 -04:00
2023-09-26 10:23:26 -04:00
2020-01-03 08:17:24 -05:00
/ * *
* Internal dependencies
* /
2020-07-07 10:43:35 -04:00
2020-01-03 08:17:24 -05:00
/ * *
2020-06-26 09:33:47 -04:00
* Returns an action object used in signalling that the downloadable blocks
2020-10-13 09:10:30 -04:00
* have been requested and are loading .
2020-06-26 09:33:47 -04:00
*
* @ param { string } filterValue Search string .
2020-01-03 08:17:24 -05:00
*
* @ return { Object } Action object .
* /
2020-06-26 09:33:47 -04:00
function fetchDownloadableBlocks ( filterValue ) {
2020-01-03 08:17:24 -05:00
return {
2020-06-26 09:33:47 -04:00
type : 'FETCH_DOWNLOADABLE_BLOCKS' ,
2021-05-19 11:09:27 -04:00
filterValue
2020-01-03 08:17:24 -05:00
} ;
}
2023-09-26 10:23:26 -04:00
2020-01-03 08:17:24 -05:00
/ * *
2020-06-26 09:33:47 -04:00
* Returns an action object used in signalling that the downloadable blocks
* have been updated .
2020-01-03 08:17:24 -05:00
*
2020-06-26 09:33:47 -04:00
* @ param { Array } downloadableBlocks Downloadable blocks .
* @ param { string } filterValue Search string .
2020-01-03 08:17:24 -05:00
*
* @ return { Object } Action object .
* /
function receiveDownloadableBlocks ( downloadableBlocks , filterValue ) {
return {
type : 'RECEIVE_DOWNLOADABLE_BLOCKS' ,
2021-05-19 11:09:27 -04:00
downloadableBlocks ,
filterValue
2020-01-03 08:17:24 -05:00
} ;
}
2023-09-26 10:23:26 -04:00
2020-01-03 08:17:24 -05:00
/ * *
2020-06-26 09:33:47 -04:00
* Action triggered to install a block plugin .
*
* @ param { Object } block The block item returned by search .
2020-01-03 08:17:24 -05:00
*
2020-06-26 09:33:47 -04:00
* @ return { boolean } Whether the block was successfully installed & loaded .
2020-01-03 08:17:24 -05:00
* /
2023-06-27 10:24:19 -04:00
const installBlockType = block => async ( {
registry ,
dispatch
} ) => {
2021-05-19 11:09:27 -04:00
const {
2022-04-12 11:12:47 -04:00
id ,
name
2021-05-19 11:09:27 -04:00
} = block ;
let success = false ;
2021-11-08 09:29:21 -05:00
dispatch . clearErrorNotice ( id ) ;
2021-05-19 11:09:27 -04:00
try {
2023-09-26 10:23:26 -04:00
dispatch . setIsInstalling ( id , true ) ;
2021-05-19 11:09:27 -04:00
2023-09-26 10:23:26 -04:00
// If we have a wp:plugin link, the plugin is installed but inactive.
2021-05-19 11:09:27 -04:00
const url = getPluginUrl ( block ) ;
let links = { } ;
if ( url ) {
2021-11-08 09:29:21 -05:00
await external _wp _apiFetch _default ( ) ( {
method : 'PUT' ,
2021-05-19 11:09:27 -04:00
url ,
data : {
status : 'active'
2021-11-08 09:29:21 -05:00
}
2021-05-19 11:09:27 -04:00
} ) ;
} else {
2021-11-08 09:29:21 -05:00
const response = await external _wp _apiFetch _default ( ) ( {
method : 'POST' ,
2021-05-19 11:09:27 -04:00
path : 'wp/v2/plugins' ,
data : {
2021-11-08 09:29:21 -05:00
slug : id ,
2021-05-19 11:09:27 -04:00
status : 'active'
2021-11-08 09:29:21 -05:00
}
2023-09-26 10:23:26 -04:00
} ) ;
// Add the `self` link for newly-installed blocks.
2021-05-19 11:09:27 -04:00
links = response . _links ;
}
2023-09-26 10:23:26 -04:00
dispatch . addInstalledBlockType ( {
... block ,
links : {
... block . links ,
2021-05-19 11:09:27 -04:00
... links
}
2023-09-26 10:23:26 -04:00
} ) ;
2022-04-12 11:12:47 -04:00
2023-09-26 10:23:26 -04:00
// Ensures that the block metadata is propagated to the editor when registered on the server.
2022-04-12 11:12:47 -04:00
const metadataFields = [ 'api_version' , 'title' , 'category' , 'parent' , 'icon' , 'description' , 'keywords' , 'attributes' , 'provides_context' , 'uses_context' , 'supports' , 'styles' , 'example' , 'variations' ] ;
await external _wp _apiFetch _default ( ) ( {
path : ( 0 , external _wp _url _namespaceObject . addQueryArgs ) ( ` /wp/v2/block-types/ ${ name } ` , {
_fields : metadataFields
} )
2023-09-26 10:23:26 -04:00
} )
// Ignore when the block is not registered on the server.
2022-04-12 11:12:47 -04:00
. catch ( ( ) => { } ) . then ( response => {
if ( ! response ) {
return ;
}
( 0 , external _wp _blocks _namespaceObject . unstable _ _bootstrapServerSideBlockDefinitions ) ( {
2023-06-27 10:24:19 -04:00
[ name ] : Object . fromEntries ( Object . entries ( response ) . filter ( ( [ key ] ) => metadataFields . includes ( key ) ) )
2022-04-12 11:12:47 -04:00
} ) ;
2021-05-19 11:09:27 -04:00
} ) ;
2021-11-08 09:29:21 -05:00
await loadAssets ( ) ;
2022-04-11 08:04:30 -04:00
const registeredBlocks = registry . select ( external _wp _blocks _namespaceObject . store ) . getBlockTypes ( ) ;
2022-04-12 11:12:47 -04:00
if ( ! registeredBlocks . some ( i => i . name === name ) ) {
2022-04-11 08:04:30 -04:00
throw new Error ( ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Error registering block. Try reloading the page.' ) ) ;
2021-05-19 11:09:27 -04:00
}
2023-09-26 10:23:26 -04:00
registry . dispatch ( external _wp _notices _namespaceObject . store ) . createInfoNotice ( ( 0 , external _wp _i18n _namespaceObject . sprintf ) (
// translators: %s is the block title.
2022-04-11 08:04:30 -04:00
( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Block %s installed and added.' ) , block . title ) , {
2021-05-19 11:09:27 -04:00
speak : true ,
type : 'snackbar'
} ) ;
success = true ;
} catch ( error ) {
2023-09-26 10:23:26 -04:00
let message = error . message || ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'An error occurred.' ) ;
2020-07-07 10:43:35 -04:00
2023-09-26 10:23:26 -04:00
// Errors we throw are fatal.
let isFatal = error instanceof Error ;
2020-07-07 10:43:35 -04:00
2023-09-26 10:23:26 -04:00
// Specific API errors that are fatal.
2021-05-19 11:09:27 -04:00
const fatalAPIErrors = {
2022-04-11 08:04:30 -04:00
folder _exists : ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'This block is already installed. Try reloading the page.' ) ,
unable _to _connect _to _filesystem : ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Error installing block. You can reload the page and try again.' )
2021-05-19 11:09:27 -04:00
} ;
if ( fatalAPIErrors [ error . code ] ) {
isFatal = true ;
message = fatalAPIErrors [ error . code ] ;
}
2021-11-08 09:29:21 -05:00
dispatch . setErrorNotice ( id , message , isFatal ) ;
2022-04-11 08:04:30 -04:00
registry . dispatch ( external _wp _notices _namespaceObject . store ) . createErrorNotice ( message , {
2021-05-19 11:09:27 -04:00
speak : true ,
isDismissible : true
} ) ;
}
2021-11-08 09:29:21 -05:00
dispatch . setIsInstalling ( id , false ) ;
2021-05-19 11:09:27 -04:00
return success ;
2021-11-08 09:29:21 -05:00
} ;
2023-09-26 10:23:26 -04:00
2020-01-03 08:17:24 -05:00
/ * *
* Action triggered to uninstall a block plugin .
*
2020-06-26 09:33:47 -04:00
* @ param { Object } block The blockType object .
2020-01-03 08:17:24 -05:00
* /
2023-06-27 10:24:19 -04:00
const uninstallBlockType = block => async ( {
registry ,
dispatch
} ) => {
2021-05-19 11:09:27 -04:00
try {
2021-11-08 09:29:21 -05:00
const url = getPluginUrl ( block ) ;
await external _wp _apiFetch _default ( ) ( {
method : 'PUT' ,
url ,
2021-05-19 11:09:27 -04:00
data : {
status : 'inactive'
2021-11-08 09:29:21 -05:00
}
2021-05-19 11:09:27 -04:00
} ) ;
2021-11-08 09:29:21 -05:00
await external _wp _apiFetch _default ( ) ( {
method : 'DELETE' ,
url
2021-05-19 11:09:27 -04:00
} ) ;
2021-11-08 09:29:21 -05:00
dispatch . removeInstalledBlockType ( block ) ;
2021-05-19 11:09:27 -04:00
} catch ( error ) {
2022-04-11 08:04:30 -04:00
registry . dispatch ( external _wp _notices _namespaceObject . store ) . createErrorNotice ( error . message || ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'An error occurred.' ) ) ;
2021-05-19 11:09:27 -04:00
}
2021-11-08 09:29:21 -05:00
} ;
2023-09-26 10:23:26 -04:00
2020-01-03 08:17:24 -05:00
/ * *
2020-10-13 09:10:30 -04:00
* Returns an action object used to add a block type to the "newly installed"
* tracking list .
2020-01-03 08:17:24 -05:00
*
2020-06-26 09:33:47 -04:00
* @ param { Object } item The block item with the block id and name .
2020-01-03 08:17:24 -05:00
*
* @ return { Object } Action object .
* /
function addInstalledBlockType ( item ) {
return {
type : 'ADD_INSTALLED_BLOCK_TYPE' ,
2021-05-19 11:09:27 -04:00
item
2020-01-03 08:17:24 -05:00
} ;
}
2023-09-26 10:23:26 -04:00
2020-01-03 08:17:24 -05:00
/ * *
2020-10-13 09:10:30 -04:00
* Returns an action object used to remove a block type from the "newly installed"
* tracking list .
2020-01-03 08:17:24 -05:00
*
* @ param { string } item The block item with the block id and name .
*
* @ return { Object } Action object .
* /
function removeInstalledBlockType ( item ) {
return {
type : 'REMOVE_INSTALLED_BLOCK_TYPE' ,
2021-05-19 11:09:27 -04:00
item
2020-01-03 08:17:24 -05:00
} ;
}
2023-09-26 10:23:26 -04:00
2020-06-26 09:33:47 -04:00
/ * *
2020-10-13 09:10:30 -04:00
* Returns an action object used to indicate install in progress .
2020-06-26 09:33:47 -04:00
*
2021-11-08 09:29:21 -05:00
* @ param { string } blockId
2020-06-26 09:33:47 -04:00
* @ param { boolean } isInstalling
*
* @ return { Object } Action object .
* /
function setIsInstalling ( blockId , isInstalling ) {
return {
type : 'SET_INSTALLING_BLOCK' ,
2021-05-19 11:09:27 -04:00
blockId ,
isInstalling
2020-06-26 09:33:47 -04:00
} ;
}
2023-09-26 10:23:26 -04:00
2020-06-26 09:33:47 -04:00
/ * *
2020-10-13 09:10:30 -04:00
* Sets an error notice to be displayed to the user for a given block .
2020-06-26 09:33:47 -04:00
*
2021-11-08 09:29:21 -05:00
* @ param { string } blockId The ID of the block plugin . eg : my - block
* @ param { string } message The message shown in the notice .
2020-10-13 09:10:30 -04:00
* @ param { boolean } isFatal Whether the user can recover from the error .
2020-06-26 09:33:47 -04:00
*
* @ return { Object } Action object .
* /
2023-06-27 10:24:19 -04:00
function setErrorNotice ( blockId , message , isFatal = false ) {
2020-06-26 09:33:47 -04:00
return {
type : 'SET_ERROR_NOTICE' ,
2021-05-19 11:09:27 -04:00
blockId ,
message ,
isFatal
2020-06-26 09:33:47 -04:00
} ;
}
2023-09-26 10:23:26 -04:00
2020-06-26 09:33:47 -04:00
/ * *
2020-10-13 09:10:30 -04:00
* Sets the error notice to empty for specific block .
2020-06-26 09:33:47 -04:00
*
* @ param { string } blockId The ID of the block plugin . eg : my - block
*
* @ return { Object } Action object .
* /
function clearErrorNotice ( blockId ) {
return {
2020-07-07 10:43:35 -04:00
type : 'CLEAR_ERROR_NOTICE' ,
2021-05-19 11:09:27 -04:00
blockId
2020-06-26 09:33:47 -04:00
} ;
}
2023-06-27 10:24:19 -04:00
; // CONCATENATED MODULE: ./node_modules/tslib/tslib.es6.mjs
/ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
Copyright ( c ) Microsoft Corporation .
Permission to use , copy , modify , and / or distribute this software for any
purpose with or without fee is hereby granted .
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS . IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL , DIRECT ,
INDIRECT , OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE , DATA OR PROFITS , WHETHER IN AN ACTION OF CONTRACT , NEGLIGENCE OR
OTHER TORTIOUS ACTION , ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE .
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
2024-10-10 11:58:22 -04:00
/* global Reflect, Promise, SuppressedError, Symbol, Iterator */
2023-06-27 10:24:19 -04:00
var extendStatics = function ( d , b ) {
extendStatics = Object . setPrototypeOf ||
( { _ _proto _ _ : [ ] } instanceof Array && function ( d , b ) { d . _ _proto _ _ = b ; } ) ||
function ( d , b ) { for ( var p in b ) if ( Object . prototype . hasOwnProperty . call ( b , p ) ) d [ p ] = b [ p ] ; } ;
return extendStatics ( d , b ) ;
} ;
function _ _extends ( d , b ) {
if ( typeof b !== "function" && b !== null )
throw new TypeError ( "Class extends value " + String ( b ) + " is not a constructor or null" ) ;
extendStatics ( d , b ) ;
function _ _ ( ) { this . constructor = d ; }
d . prototype = b === null ? Object . create ( b ) : ( _ _ . prototype = b . prototype , new _ _ ( ) ) ;
}
var _ _assign = function ( ) {
_ _assign = Object . assign || function _ _assign ( t ) {
for ( var s , i = 1 , n = arguments . length ; i < n ; i ++ ) {
s = arguments [ i ] ;
for ( var p in s ) if ( Object . prototype . hasOwnProperty . call ( s , p ) ) t [ p ] = s [ p ] ;
}
return t ;
}
return _ _assign . apply ( this , arguments ) ;
}
function _ _rest ( s , e ) {
var t = { } ;
for ( var p in s ) if ( Object . prototype . hasOwnProperty . call ( s , p ) && e . indexOf ( p ) < 0 )
t [ p ] = s [ p ] ;
if ( s != null && typeof Object . getOwnPropertySymbols === "function" )
for ( var i = 0 , p = Object . getOwnPropertySymbols ( s ) ; i < p . length ; i ++ ) {
if ( e . indexOf ( p [ i ] ) < 0 && Object . prototype . propertyIsEnumerable . call ( s , p [ i ] ) )
t [ p [ i ] ] = s [ p [ i ] ] ;
}
return t ;
}
function _ _decorate ( decorators , target , key , desc ) {
var c = arguments . length , r = c < 3 ? target : desc === null ? desc = Object . getOwnPropertyDescriptor ( target , key ) : desc , d ;
if ( typeof Reflect === "object" && typeof Reflect . decorate === "function" ) r = Reflect . decorate ( decorators , target , key , desc ) ;
else for ( var i = decorators . length - 1 ; i >= 0 ; i -- ) if ( d = decorators [ i ] ) r = ( c < 3 ? d ( r ) : c > 3 ? d ( target , key , r ) : d ( target , key ) ) || r ;
return c > 3 && r && Object . defineProperty ( target , key , r ) , r ;
}
function _ _param ( paramIndex , decorator ) {
return function ( target , key ) { decorator ( target , key , paramIndex ) ; }
}
function _ _esDecorate ( ctor , descriptorIn , decorators , contextIn , initializers , extraInitializers ) {
function accept ( f ) { if ( f !== void 0 && typeof f !== "function" ) throw new TypeError ( "Function expected" ) ; return f ; }
var kind = contextIn . kind , key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value" ;
var target = ! descriptorIn && ctor ? contextIn [ "static" ] ? ctor : ctor . prototype : null ;
var descriptor = descriptorIn || ( target ? Object . getOwnPropertyDescriptor ( target , contextIn . name ) : { } ) ;
var _ , done = false ;
for ( var i = decorators . length - 1 ; i >= 0 ; i -- ) {
var context = { } ;
for ( var p in contextIn ) context [ p ] = p === "access" ? { } : contextIn [ p ] ;
for ( var p in contextIn . access ) context . access [ p ] = contextIn . access [ p ] ;
context . addInitializer = function ( f ) { if ( done ) throw new TypeError ( "Cannot add initializers after decoration has completed" ) ; extraInitializers . push ( accept ( f || null ) ) ; } ;
var result = ( 0 , decorators [ i ] ) ( kind === "accessor" ? { get : descriptor . get , set : descriptor . set } : descriptor [ key ] , context ) ;
if ( kind === "accessor" ) {
if ( result === void 0 ) continue ;
if ( result === null || typeof result !== "object" ) throw new TypeError ( "Object expected" ) ;
if ( _ = accept ( result . get ) ) descriptor . get = _ ;
if ( _ = accept ( result . set ) ) descriptor . set = _ ;
if ( _ = accept ( result . init ) ) initializers . unshift ( _ ) ;
}
else if ( _ = accept ( result ) ) {
if ( kind === "field" ) initializers . unshift ( _ ) ;
else descriptor [ key ] = _ ;
}
}
if ( target ) Object . defineProperty ( target , contextIn . name , descriptor ) ;
done = true ;
} ;
function _ _runInitializers ( thisArg , initializers , value ) {
var useValue = arguments . length > 2 ;
for ( var i = 0 ; i < initializers . length ; i ++ ) {
value = useValue ? initializers [ i ] . call ( thisArg , value ) : initializers [ i ] . call ( thisArg ) ;
}
return useValue ? value : void 0 ;
} ;
function _ _propKey ( x ) {
return typeof x === "symbol" ? x : "" . concat ( x ) ;
} ;
function _ _setFunctionName ( f , name , prefix ) {
if ( typeof name === "symbol" ) name = name . description ? "[" . concat ( name . description , "]" ) : "" ;
return Object . defineProperty ( f , "name" , { configurable : true , value : prefix ? "" . concat ( prefix , " " , name ) : name } ) ;
} ;
function _ _metadata ( metadataKey , metadataValue ) {
if ( typeof Reflect === "object" && typeof Reflect . metadata === "function" ) return Reflect . metadata ( metadataKey , metadataValue ) ;
}
function _ _awaiter ( thisArg , _arguments , P , generator ) {
function adopt ( value ) { return value instanceof P ? value : new P ( function ( resolve ) { resolve ( value ) ; } ) ; }
return new ( P || ( P = Promise ) ) ( function ( resolve , reject ) {
function fulfilled ( value ) { try { step ( generator . next ( value ) ) ; } catch ( e ) { reject ( e ) ; } }
function rejected ( value ) { try { step ( generator [ "throw" ] ( value ) ) ; } catch ( e ) { reject ( e ) ; } }
function step ( result ) { result . done ? resolve ( result . value ) : adopt ( result . value ) . then ( fulfilled , rejected ) ; }
step ( ( generator = generator . apply ( thisArg , _arguments || [ ] ) ) . next ( ) ) ;
} ) ;
}
function _ _generator ( thisArg , body ) {
2024-10-10 11:58:22 -04:00
var _ = { label : 0 , sent : function ( ) { if ( t [ 0 ] & 1 ) throw t [ 1 ] ; return t [ 1 ] ; } , trys : [ ] , ops : [ ] } , f , y , t , g = Object . create ( ( typeof Iterator === "function" ? Iterator : Object ) . prototype ) ;
return g . next = verb ( 0 ) , g [ "throw" ] = verb ( 1 ) , g [ "return" ] = verb ( 2 ) , typeof Symbol === "function" && ( g [ Symbol . iterator ] = function ( ) { return this ; } ) , g ;
2023-06-27 10:24:19 -04:00
function verb ( n ) { return function ( v ) { return step ( [ n , v ] ) ; } ; }
function step ( op ) {
if ( f ) throw new TypeError ( "Generator is already executing." ) ;
while ( g && ( g = 0 , op [ 0 ] && ( _ = 0 ) ) , _ ) try {
if ( f = 1 , y && ( t = op [ 0 ] & 2 ? y [ "return" ] : op [ 0 ] ? y [ "throw" ] || ( ( t = y [ "return" ] ) && t . call ( y ) , 0 ) : y . next ) && ! ( t = t . call ( y , op [ 1 ] ) ) . done ) return t ;
if ( y = 0 , t ) op = [ op [ 0 ] & 2 , t . value ] ;
switch ( op [ 0 ] ) {
case 0 : case 1 : t = op ; break ;
case 4 : _ . label ++ ; return { value : op [ 1 ] , done : false } ;
case 5 : _ . label ++ ; y = op [ 1 ] ; op = [ 0 ] ; continue ;
case 7 : op = _ . ops . pop ( ) ; _ . trys . pop ( ) ; continue ;
default :
if ( ! ( t = _ . trys , t = t . length > 0 && t [ t . length - 1 ] ) && ( op [ 0 ] === 6 || op [ 0 ] === 2 ) ) { _ = 0 ; continue ; }
if ( op [ 0 ] === 3 && ( ! t || ( op [ 1 ] > t [ 0 ] && op [ 1 ] < t [ 3 ] ) ) ) { _ . label = op [ 1 ] ; break ; }
if ( op [ 0 ] === 6 && _ . label < t [ 1 ] ) { _ . label = t [ 1 ] ; t = op ; break ; }
if ( t && _ . label < t [ 2 ] ) { _ . label = t [ 2 ] ; _ . ops . push ( op ) ; break ; }
if ( t [ 2 ] ) _ . ops . pop ( ) ;
_ . trys . pop ( ) ; continue ;
}
op = body . call ( thisArg , _ ) ;
} catch ( e ) { op = [ 6 , e ] ; y = 0 ; } finally { f = t = 0 ; }
if ( op [ 0 ] & 5 ) throw op [ 1 ] ; return { value : op [ 0 ] ? op [ 1 ] : void 0 , done : true } ;
}
}
var _ _createBinding = Object . create ? ( function ( o , m , k , k2 ) {
if ( k2 === undefined ) k2 = k ;
var desc = Object . getOwnPropertyDescriptor ( m , k ) ;
if ( ! desc || ( "get" in desc ? ! m . _ _esModule : desc . writable || desc . configurable ) ) {
desc = { enumerable : true , get : function ( ) { return m [ k ] ; } } ;
}
Object . defineProperty ( o , k2 , desc ) ;
} ) : ( function ( o , m , k , k2 ) {
if ( k2 === undefined ) k2 = k ;
o [ k2 ] = m [ k ] ;
} ) ;
function _ _exportStar ( m , o ) {
for ( var p in m ) if ( p !== "default" && ! Object . prototype . hasOwnProperty . call ( o , p ) ) _ _createBinding ( o , m , p ) ;
}
function _ _values ( o ) {
var s = typeof Symbol === "function" && Symbol . iterator , m = s && o [ s ] , i = 0 ;
if ( m ) return m . call ( o ) ;
if ( o && typeof o . length === "number" ) return {
next : function ( ) {
if ( o && i >= o . length ) o = void 0 ;
return { value : o && o [ i ++ ] , done : ! o } ;
}
} ;
throw new TypeError ( s ? "Object is not iterable." : "Symbol.iterator is not defined." ) ;
}
function _ _read ( o , n ) {
var m = typeof Symbol === "function" && o [ Symbol . iterator ] ;
if ( ! m ) return o ;
var i = m . call ( o ) , r , ar = [ ] , e ;
try {
while ( ( n === void 0 || n -- > 0 ) && ! ( r = i . next ( ) ) . done ) ar . push ( r . value ) ;
}
catch ( error ) { e = { error : error } ; }
finally {
try {
if ( r && ! r . done && ( m = i [ "return" ] ) ) m . call ( i ) ;
}
finally { if ( e ) throw e . error ; }
}
return ar ;
}
/** @deprecated */
function _ _spread ( ) {
for ( var ar = [ ] , i = 0 ; i < arguments . length ; i ++ )
ar = ar . concat ( _ _read ( arguments [ i ] ) ) ;
return ar ;
}
/** @deprecated */
function _ _spreadArrays ( ) {
for ( var s = 0 , i = 0 , il = arguments . length ; i < il ; i ++ ) s += arguments [ i ] . length ;
for ( var r = Array ( s ) , k = 0 , i = 0 ; i < il ; i ++ )
for ( var a = arguments [ i ] , j = 0 , jl = a . length ; j < jl ; j ++ , k ++ )
r [ k ] = a [ j ] ;
return r ;
}
function _ _spreadArray ( to , from , pack ) {
if ( pack || arguments . length === 2 ) for ( var i = 0 , l = from . length , ar ; i < l ; i ++ ) {
if ( ar || ! ( i in from ) ) {
if ( ! ar ) ar = Array . prototype . slice . call ( from , 0 , i ) ;
ar [ i ] = from [ i ] ;
}
}
return to . concat ( ar || Array . prototype . slice . call ( from ) ) ;
}
function _ _await ( v ) {
return this instanceof _ _await ? ( this . v = v , this ) : new _ _await ( v ) ;
}
function _ _asyncGenerator ( thisArg , _arguments , generator ) {
if ( ! Symbol . asyncIterator ) throw new TypeError ( "Symbol.asyncIterator is not defined." ) ;
var g = generator . apply ( thisArg , _arguments || [ ] ) , i , q = [ ] ;
2024-10-10 11:58:22 -04:00
return i = Object . create ( ( typeof AsyncIterator === "function" ? AsyncIterator : Object ) . prototype ) , verb ( "next" ) , verb ( "throw" ) , verb ( "return" , awaitReturn ) , i [ Symbol . asyncIterator ] = function ( ) { return this ; } , i ;
function awaitReturn ( f ) { return function ( v ) { return Promise . resolve ( v ) . then ( f , reject ) ; } ; }
function verb ( n , f ) { if ( g [ n ] ) { i [ n ] = function ( v ) { return new Promise ( function ( a , b ) { q . push ( [ n , v , a , b ] ) > 1 || resume ( n , v ) ; } ) ; } ; if ( f ) i [ n ] = f ( i [ n ] ) ; } }
2023-06-27 10:24:19 -04:00
function resume ( n , v ) { try { step ( g [ n ] ( v ) ) ; } catch ( e ) { settle ( q [ 0 ] [ 3 ] , e ) ; } }
function step ( r ) { r . value instanceof _ _await ? Promise . resolve ( r . value . v ) . then ( fulfill , reject ) : settle ( q [ 0 ] [ 2 ] , r ) ; }
function fulfill ( value ) { resume ( "next" , value ) ; }
function reject ( value ) { resume ( "throw" , value ) ; }
function settle ( f , v ) { if ( f ( v ) , q . shift ( ) , q . length ) resume ( q [ 0 ] [ 0 ] , q [ 0 ] [ 1 ] ) ; }
}
function _ _asyncDelegator ( o ) {
var i , p ;
return i = { } , verb ( "next" ) , verb ( "throw" , function ( e ) { throw e ; } ) , verb ( "return" ) , i [ Symbol . iterator ] = function ( ) { return this ; } , i ;
function verb ( n , f ) { i [ n ] = o [ n ] ? function ( v ) { return ( p = ! p ) ? { value : _ _await ( o [ n ] ( v ) ) , done : false } : f ? f ( v ) : v ; } : f ; }
}
function _ _asyncValues ( o ) {
if ( ! Symbol . asyncIterator ) throw new TypeError ( "Symbol.asyncIterator is not defined." ) ;
var m = o [ Symbol . asyncIterator ] , i ;
return m ? m . call ( o ) : ( o = typeof _ _values === "function" ? _ _values ( o ) : o [ Symbol . iterator ] ( ) , i = { } , verb ( "next" ) , verb ( "throw" ) , verb ( "return" ) , i [ Symbol . asyncIterator ] = function ( ) { return this ; } , i ) ;
function verb ( n ) { i [ n ] = o [ n ] && function ( v ) { return new Promise ( function ( resolve , reject ) { v = o [ n ] ( v ) , settle ( resolve , reject , v . done , v . value ) ; } ) ; } ; }
function settle ( resolve , reject , d , v ) { Promise . resolve ( v ) . then ( function ( v ) { resolve ( { value : v , done : d } ) ; } , reject ) ; }
}
function _ _makeTemplateObject ( cooked , raw ) {
if ( Object . defineProperty ) { Object . defineProperty ( cooked , "raw" , { value : raw } ) ; } else { cooked . raw = raw ; }
return cooked ;
} ;
var _ _setModuleDefault = Object . create ? ( function ( o , v ) {
Object . defineProperty ( o , "default" , { enumerable : true , value : v } ) ;
} ) : function ( o , v ) {
o [ "default" ] = v ;
} ;
function _ _importStar ( mod ) {
if ( mod && mod . _ _esModule ) return mod ;
var result = { } ;
if ( mod != null ) for ( var k in mod ) if ( k !== "default" && Object . prototype . hasOwnProperty . call ( mod , k ) ) _ _createBinding ( result , mod , k ) ;
_ _setModuleDefault ( result , mod ) ;
return result ;
}
function _ _importDefault ( mod ) {
return ( mod && mod . _ _esModule ) ? mod : { default : mod } ;
}
function _ _classPrivateFieldGet ( receiver , state , kind , f ) {
if ( kind === "a" && ! f ) throw new TypeError ( "Private accessor was defined without a getter" ) ;
if ( typeof state === "function" ? receiver !== state || ! f : ! state . has ( receiver ) ) throw new TypeError ( "Cannot read private member from an object whose class did not declare it" ) ;
return kind === "m" ? f : kind === "a" ? f . call ( receiver ) : f ? f . value : state . get ( receiver ) ;
}
function _ _classPrivateFieldSet ( receiver , state , value , kind , f ) {
if ( kind === "m" ) throw new TypeError ( "Private method is not writable" ) ;
if ( kind === "a" && ! f ) throw new TypeError ( "Private accessor was defined without a setter" ) ;
if ( typeof state === "function" ? receiver !== state || ! f : ! state . has ( receiver ) ) throw new TypeError ( "Cannot write private member to an object whose class did not declare it" ) ;
return ( kind === "a" ? f . call ( receiver , value ) : f ? f . value = value : state . set ( receiver , value ) ) , value ;
}
function _ _classPrivateFieldIn ( state , receiver ) {
if ( receiver === null || ( typeof receiver !== "object" && typeof receiver !== "function" ) ) throw new TypeError ( "Cannot use 'in' operator on non-object" ) ;
return typeof state === "function" ? receiver === state : state . has ( receiver ) ;
}
function _ _addDisposableResource ( env , value , async ) {
if ( value !== null && value !== void 0 ) {
2023-09-21 09:26:32 -04:00
if ( typeof value !== "object" && typeof value !== "function" ) throw new TypeError ( "Object expected." ) ;
2024-10-10 11:58:22 -04:00
var dispose , inner ;
2023-06-27 10:24:19 -04:00
if ( async ) {
2024-10-10 11:58:22 -04:00
if ( ! Symbol . asyncDispose ) throw new TypeError ( "Symbol.asyncDispose is not defined." ) ;
dispose = value [ Symbol . asyncDispose ] ;
2023-06-27 10:24:19 -04:00
}
if ( dispose === void 0 ) {
2024-10-10 11:58:22 -04:00
if ( ! Symbol . dispose ) throw new TypeError ( "Symbol.dispose is not defined." ) ;
dispose = value [ Symbol . dispose ] ;
if ( async ) inner = dispose ;
2023-06-27 10:24:19 -04:00
}
if ( typeof dispose !== "function" ) throw new TypeError ( "Object not disposable." ) ;
2024-10-10 11:58:22 -04:00
if ( inner ) dispose = function ( ) { try { inner . call ( this ) ; } catch ( e ) { return Promise . reject ( e ) ; } } ;
2023-06-27 10:24:19 -04:00
env . stack . push ( { value : value , dispose : dispose , async : async } ) ;
}
else if ( async ) {
env . stack . push ( { async : true } ) ;
}
return value ;
}
var _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function ( error , suppressed , message ) {
var e = new Error ( message ) ;
return e . name = "SuppressedError" , e . error = error , e . suppressed = suppressed , e ;
} ;
function _ _disposeResources ( env ) {
function fail ( e ) {
env . error = env . hasError ? new _SuppressedError ( e , env . error , "An error was suppressed during disposal." ) : e ;
env . hasError = true ;
}
2024-10-10 11:58:22 -04:00
var r , s = 0 ;
2023-06-27 10:24:19 -04:00
function next ( ) {
2024-10-10 11:58:22 -04:00
while ( r = env . stack . pop ( ) ) {
2023-06-27 10:24:19 -04:00
try {
2024-10-10 11:58:22 -04:00
if ( ! r . async && s === 1 ) return s = 0 , env . stack . push ( r ) , Promise . resolve ( ) . then ( next ) ;
if ( r . dispose ) {
var result = r . dispose . call ( r . value ) ;
if ( r . async ) return s |= 2 , Promise . resolve ( result ) . then ( next , function ( e ) { fail ( e ) ; return next ( ) ; } ) ;
}
else s |= 1 ;
2023-06-27 10:24:19 -04:00
}
catch ( e ) {
2024-10-10 11:58:22 -04:00
fail ( e ) ;
2023-06-27 10:24:19 -04:00
}
}
2024-10-10 11:58:22 -04:00
if ( s === 1 ) return env . hasError ? Promise . reject ( env . error ) : Promise . resolve ( ) ;
2023-06-27 10:24:19 -04:00
if ( env . hasError ) throw env . error ;
}
return next ( ) ;
}
2024-01-31 07:59:56 -05:00
/* harmony default export */ const tslib _es6 = ( {
2023-06-27 10:24:19 -04:00
_ _extends ,
_ _assign ,
_ _rest ,
_ _decorate ,
_ _param ,
_ _metadata ,
_ _awaiter ,
_ _generator ,
_ _createBinding ,
_ _exportStar ,
_ _values ,
_ _read ,
_ _spread ,
_ _spreadArrays ,
_ _spreadArray ,
_ _await ,
_ _asyncGenerator ,
_ _asyncDelegator ,
_ _asyncValues ,
_ _makeTemplateObject ,
_ _importStar ,
_ _importDefault ,
_ _classPrivateFieldGet ,
_ _classPrivateFieldSet ,
_ _classPrivateFieldIn ,
_ _addDisposableResource ,
_ _disposeResources ,
} ) ;
2022-09-20 11:43:29 -04:00
; // CONCATENATED MODULE: ./node_modules/lower-case/dist.es2015/index.js
/ * *
* Source : ftp : //ftp.unicode.org/Public/UCD/latest/ucd/SpecialCasing.txt
* /
var SUPPORTED _LOCALE = {
tr : {
regexp : /\u0130|\u0049|\u0049\u0307/g ,
map : {
İ : "\u0069" ,
I : "\u0131" ,
I ̇ : "\u0069" ,
} ,
} ,
az : {
regexp : /\u0130/g ,
map : {
İ : "\u0069" ,
I : "\u0131" ,
I ̇ : "\u0069" ,
} ,
} ,
lt : {
regexp : /\u0049|\u004A|\u012E|\u00CC|\u00CD|\u0128/g ,
map : {
I : "\u0069\u0307" ,
J : "\u006A\u0307" ,
Į : "\u012F\u0307" ,
Ì : "\u0069\u0307\u0300" ,
Í : "\u0069\u0307\u0301" ,
Ĩ : "\u0069\u0307\u0303" ,
} ,
} ,
} ;
/ * *
* Localized lower case .
* /
function localeLowerCase ( str , locale ) {
var lang = SUPPORTED _LOCALE [ locale . toLowerCase ( ) ] ;
if ( lang )
return lowerCase ( str . replace ( lang . regexp , function ( m ) { return lang . map [ m ] ; } ) ) ;
return lowerCase ( str ) ;
}
/ * *
* Lower case as a function .
* /
function lowerCase ( str ) {
return str . toLowerCase ( ) ;
}
; // CONCATENATED MODULE: ./node_modules/no-case/dist.es2015/index.js
// Support camel case ("camelCase" -> "camel Case" and "CAMELCase" -> "CAMEL Case").
var DEFAULT _SPLIT _REGEXP = [ /([a-z0-9])([A-Z])/g , /([A-Z])([A-Z][a-z])/g ] ;
// Remove all non-word characters.
var DEFAULT _STRIP _REGEXP = /[^A-Z0-9]+/gi ;
/ * *
* Normalize the string into something other libraries can manipulate easier .
* /
function noCase ( input , options ) {
if ( options === void 0 ) { options = { } ; }
var _a = options . splitRegexp , splitRegexp = _a === void 0 ? DEFAULT _SPLIT _REGEXP : _a , _b = options . stripRegexp , stripRegexp = _b === void 0 ? DEFAULT _STRIP _REGEXP : _b , _c = options . transform , transform = _c === void 0 ? lowerCase : _c , _d = options . delimiter , delimiter = _d === void 0 ? " " : _d ;
var result = replace ( replace ( input , splitRegexp , "$1\0$2" ) , stripRegexp , "\0" ) ;
var start = 0 ;
var end = result . length ;
// Trim the delimiter from around the output string.
while ( result . charAt ( start ) === "\0" )
start ++ ;
while ( result . charAt ( end - 1 ) === "\0" )
end -- ;
// Transform each token independently.
return result . slice ( start , end ) . split ( "\0" ) . map ( transform ) . join ( delimiter ) ;
}
/ * *
* Replace ` re ` in the input string with the replacement value .
* /
function replace ( input , re , value ) {
if ( re instanceof RegExp )
return input . replace ( re , value ) ;
return re . reduce ( function ( input , re ) { return input . replace ( re , value ) ; } , input ) ;
}
; // CONCATENATED MODULE: ./node_modules/pascal-case/dist.es2015/index.js
function pascalCaseTransform ( input , index ) {
var firstChar = input . charAt ( 0 ) ;
var lowerChars = input . substr ( 1 ) . toLowerCase ( ) ;
if ( index > 0 && firstChar >= "0" && firstChar <= "9" ) {
return "_" + firstChar + lowerChars ;
}
return "" + firstChar . toUpperCase ( ) + lowerChars ;
}
function dist _es2015 _pascalCaseTransformMerge ( input ) {
return input . charAt ( 0 ) . toUpperCase ( ) + input . slice ( 1 ) . toLowerCase ( ) ;
}
function pascalCase ( input , options ) {
if ( options === void 0 ) { options = { } ; }
return noCase ( input , _ _assign ( { delimiter : "" , transform : pascalCaseTransform } , options ) ) ;
}
; // CONCATENATED MODULE: ./node_modules/camel-case/dist.es2015/index.js
function camelCaseTransform ( input , index ) {
if ( index === 0 )
return input . toLowerCase ( ) ;
return pascalCaseTransform ( input , index ) ;
}
function camelCaseTransformMerge ( input , index ) {
if ( index === 0 )
return input . toLowerCase ( ) ;
return pascalCaseTransformMerge ( input ) ;
}
function camelCase ( input , options ) {
if ( options === void 0 ) { options = { } ; }
return pascalCase ( input , _ _assign ( { transform : camelCaseTransform } , options ) ) ;
}
2022-04-11 08:04:30 -04:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/store/resolvers.js
2020-01-03 08:17:24 -05:00
/ * *
* External dependencies
* /
2023-09-26 10:23:26 -04:00
2020-01-03 08:17:24 -05:00
/ * *
2020-06-26 09:33:47 -04:00
* WordPress dependencies
2020-01-03 08:17:24 -05:00
* /
2020-06-26 09:33:47 -04:00
/ * *
* Internal dependencies
* /
2023-06-27 10:24:19 -04:00
const resolvers _getDownloadableBlocks = filterValue => async ( {
dispatch
} ) => {
2021-11-08 09:29:21 -05:00
if ( ! filterValue ) {
return ;
2021-05-19 11:09:27 -04:00
}
2021-11-08 09:29:21 -05:00
try {
dispatch ( fetchDownloadableBlocks ( filterValue ) ) ;
const results = await external _wp _apiFetch _default ( ) ( {
path : ` wp/v2/block-directory/search?term= ${ filterValue } `
} ) ;
2023-06-27 10:24:19 -04:00
const blocks = results . map ( result => Object . fromEntries ( Object . entries ( result ) . map ( ( [ key , value ] ) => [ camelCase ( key ) , value ] ) ) ) ;
2021-11-08 09:29:21 -05:00
dispatch ( receiveDownloadableBlocks ( blocks , filterValue ) ) ;
} catch { }
} ;
2020-01-03 08:17:24 -05:00
2022-04-11 08:04:30 -04:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/store/index.js
2020-01-03 08:17:24 -05:00
/ * *
* WordPress dependencies
* /
2023-09-26 10:23:26 -04:00
2020-01-03 08:17:24 -05:00
/ * *
* Internal dependencies
* /
/ * *
* Module Constants
* /
2021-05-19 11:09:27 -04:00
const STORE _NAME = 'core/block-directory' ;
2023-09-26 10:23:26 -04:00
2020-01-03 08:17:24 -05:00
/ * *
* Block editor data store configuration .
*
2021-02-02 00:17:13 -05:00
* @ see https : //github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#registerStore
2020-01-03 08:17:24 -05:00
*
* @ type { Object }
* /
2021-05-19 11:09:27 -04:00
const storeConfig = {
2020-01-03 08:17:24 -05:00
reducer : reducer ,
selectors : selectors _namespaceObject ,
actions : actions _namespaceObject ,
2022-04-12 11:12:47 -04:00
resolvers : resolvers _namespaceObject
2020-01-03 08:17:24 -05:00
} ;
2023-09-26 10:23:26 -04:00
2021-01-27 21:04:13 -05:00
/ * *
* Store definition for the block directory namespace .
*
2021-02-02 00:17:13 -05:00
* @ see https : //github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore
2021-01-27 21:04:13 -05:00
*
* @ type { Object }
* /
2022-04-11 08:04:30 -04:00
const store = ( 0 , external _wp _data _namespaceObject . createReduxStore ) ( STORE _NAME , storeConfig ) ;
( 0 , external _wp _data _namespaceObject . register ) ( store ) ;
2020-06-26 09:33:47 -04:00
2022-04-11 08:04:30 -04:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/components/auto-block-uninstaller/index.js
2020-06-26 09:33:47 -04:00
/ * *
* WordPress dependencies
* /
2021-04-15 11:19:43 -04:00
2023-09-26 10:23:26 -04:00
2021-01-27 21:04:13 -05:00
/ * *
* Internal dependencies
* /
2020-06-26 09:33:47 -04:00
function AutoBlockUninstaller ( ) {
2021-05-19 11:09:27 -04:00
const {
uninstallBlockType
2022-04-11 08:04:30 -04:00
} = ( 0 , external _wp _data _namespaceObject . useDispatch ) ( store ) ;
const shouldRemoveBlockTypes = ( 0 , external _wp _data _namespaceObject . useSelect ) ( select => {
2021-05-19 11:09:27 -04:00
const {
isAutosavingPost ,
isSavingPost
2022-04-11 08:04:30 -04:00
} = select ( external _wp _editor _namespaceObject . store ) ;
2020-06-26 09:33:47 -04:00
return isSavingPost ( ) && ! isAutosavingPost ( ) ;
2020-07-07 10:43:35 -04:00
} , [ ] ) ;
2022-04-11 08:04:30 -04:00
const unusedBlockTypes = ( 0 , external _wp _data _namespaceObject . useSelect ) ( select => select ( store ) . getUnusedBlockTypes ( ) , [ ] ) ;
( 0 , external _wp _element _namespaceObject . useEffect ) ( ( ) => {
2020-06-26 09:33:47 -04:00
if ( shouldRemoveBlockTypes && unusedBlockTypes . length ) {
2021-05-19 11:09:27 -04:00
unusedBlockTypes . forEach ( blockType => {
2020-06-26 09:33:47 -04:00
uninstallBlockType ( blockType ) ;
2022-04-11 08:04:30 -04:00
( 0 , external _wp _blocks _namespaceObject . unregisterBlockType ) ( blockType . name ) ;
2020-06-26 09:33:47 -04:00
} ) ;
}
} , [ shouldRemoveBlockTypes ] ) ;
return null ;
}
2020-01-08 06:57:23 -05:00
2022-04-11 08:04:30 -04:00
; // CONCATENATED MODULE: external ["wp","compose"]
2024-01-31 07:59:56 -05:00
const external _wp _compose _namespaceObject = window [ "wp" ] [ "compose" ] ;
2023-02-07 02:04:52 -05:00
; // CONCATENATED MODULE: external ["wp","components"]
2024-01-31 07:59:56 -05:00
const external _wp _components _namespaceObject = window [ "wp" ] [ "components" ] ;
2022-04-11 08:04:30 -04:00
; // CONCATENATED MODULE: external ["wp","coreData"]
2024-01-31 07:59:56 -05:00
const external _wp _coreData _namespaceObject = window [ "wp" ] [ "coreData" ] ;
2024-10-06 18:45:30 -04:00
; // CONCATENATED MODULE: ./node_modules/clsx/dist/clsx.mjs
function r ( e ) { var t , f , n = "" ; if ( "string" == typeof e || "number" == typeof e ) n += e ; else if ( "object" == typeof e ) if ( Array . isArray ( e ) ) { var o = e . length ; for ( t = 0 ; t < o ; t ++ ) e [ t ] && ( f = r ( e [ t ] ) ) && ( n && ( n += " " ) , n += f ) } else for ( f in e ) e [ f ] && ( n && ( n += " " ) , n += f ) ; return n } function clsx ( ) { for ( var e , t , f = 0 , n = "" , o = arguments . length ; f < o ; f ++ ) ( e = arguments [ f ] ) && ( t = r ( e ) ) && ( n && ( n += " " ) , n += t ) ; return n } /* harmony default export */ const dist _clsx = ( clsx ) ;
2022-04-11 08:04:30 -04:00
; // CONCATENATED MODULE: external ["wp","htmlEntities"]
2024-01-31 07:59:56 -05:00
const external _wp _htmlEntities _namespaceObject = window [ "wp" ] [ "htmlEntities" ] ;
2022-04-11 08:04:30 -04:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/icon/index.js
/ * *
* WordPress dependencies
* /
2020-06-26 09:33:47 -04:00
2023-09-26 10:23:26 -04:00
2022-04-11 08:04:30 -04:00
/** @typedef {{icon: JSX.Element, size?: number} & import('@wordpress/primitives').SVGProps} IconProps */
2020-10-13 09:10:30 -04:00
2022-04-11 08:04:30 -04:00
/ * *
* Return an SVG icon .
*
2023-09-26 10:23:26 -04:00
* @ param { IconProps } props icon is the SVG component to render
* size is a number specifiying the icon size in pixels
* Other props will be passed to wrapped SVG component
* @ param { import ( 'react' ) . ForwardedRef < HTMLElement > } ref The forwarded ref to the SVG element .
2022-04-11 08:04:30 -04:00
*
* @ return { JSX . Element } Icon component
* /
2023-06-27 10:24:19 -04:00
function Icon ( {
icon ,
size = 24 ,
... props
2023-09-26 10:23:26 -04:00
} , ref ) {
2022-04-11 08:04:30 -04:00
return ( 0 , external _wp _element _namespaceObject . cloneElement ) ( icon , {
width : size ,
height : size ,
2023-09-26 10:23:26 -04:00
... props ,
ref
2022-04-11 08:04:30 -04:00
} ) ;
}
2024-01-31 07:59:56 -05:00
/* harmony default export */ const icon = ( ( 0 , external _wp _element _namespaceObject . forwardRef ) ( Icon ) ) ;
2021-05-21 06:14:23 -04:00
2022-04-11 08:04:30 -04:00
; // CONCATENATED MODULE: external ["wp","primitives"]
2024-01-31 07:59:56 -05:00
const external _wp _primitives _namespaceObject = window [ "wp" ] [ "primitives" ] ;
2024-05-31 14:59:00 -04:00
; // CONCATENATED MODULE: external "ReactJSXRuntime"
const external _ReactJSXRuntime _namespaceObject = window [ "ReactJSXRuntime" ] ;
2022-04-11 08:04:30 -04:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/star-filled.js
2021-05-21 06:14:23 -04:00
/ * *
* WordPress dependencies
* /
2024-05-31 14:59:00 -04:00
const starFilled = /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( external _wp _primitives _namespaceObject . SVG , {
2021-05-21 06:14:23 -04:00
xmlns : "http://www.w3.org/2000/svg" ,
2024-05-31 14:59:00 -04:00
viewBox : "0 0 24 24" ,
children : /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( external _wp _primitives _namespaceObject . Path , {
d : "M11.776 4.454a.25.25 0 01.448 0l2.069 4.192a.25.25 0 00.188.137l4.626.672a.25.25 0 01.139.426l-3.348 3.263a.25.25 0 00-.072.222l.79 4.607a.25.25 0 01-.362.263l-4.138-2.175a.25.25 0 00-.232 0l-4.138 2.175a.25.25 0 01-.363-.263l.79-4.607a.25.25 0 00-.071-.222L4.754 9.881a.25.25 0 01.139-.426l4.626-.672a.25.25 0 00.188-.137l2.069-4.192z"
} )
} ) ;
2024-01-31 07:59:56 -05:00
/* harmony default export */ const star _filled = ( starFilled ) ;
2022-04-11 08:04:30 -04:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/star-half.js
/ * *
* WordPress dependencies
* /
2024-05-31 14:59:00 -04:00
const starHalf = /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( external _wp _primitives _namespaceObject . SVG , {
2022-04-11 08:04:30 -04:00
xmlns : "http://www.w3.org/2000/svg" ,
2024-05-31 14:59:00 -04:00
viewBox : "0 0 24 24" ,
children : /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( external _wp _primitives _namespaceObject . Path , {
d : "M9.518 8.783a.25.25 0 00.188-.137l2.069-4.192a.25.25 0 01.448 0l2.07 4.192a.25.25 0 00.187.137l4.626.672a.25.25 0 01.139.427l-3.347 3.262a.25.25 0 00-.072.222l.79 4.607a.25.25 0 01-.363.264l-4.137-2.176a.25.25 0 00-.233 0l-4.138 2.175a.25.25 0 01-.362-.263l.79-4.607a.25.25 0 00-.072-.222L4.753 9.882a.25.25 0 01.14-.427l4.625-.672zM12 14.533c.28 0 .559.067.814.2l1.895.997-.362-2.11a1.75 1.75 0 01.504-1.55l1.533-1.495-2.12-.308a1.75 1.75 0 01-1.317-.957L12 7.39v7.143z"
} )
} ) ;
2024-01-31 07:59:56 -05:00
/* harmony default export */ const star _half = ( starHalf ) ;
2020-06-26 09:33:47 -04:00
2022-04-11 08:04:30 -04:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/star-empty.js
/ * *
* WordPress dependencies
* /
2024-05-31 14:59:00 -04:00
const starEmpty = /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( external _wp _primitives _namespaceObject . SVG , {
2022-04-11 08:04:30 -04:00
xmlns : "http://www.w3.org/2000/svg" ,
2024-05-31 14:59:00 -04:00
viewBox : "0 0 24 24" ,
children : /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( external _wp _primitives _namespaceObject . Path , {
fillRule : "evenodd" ,
d : "M9.706 8.646a.25.25 0 01-.188.137l-4.626.672a.25.25 0 00-.139.427l3.348 3.262a.25.25 0 01.072.222l-.79 4.607a.25.25 0 00.362.264l4.138-2.176a.25.25 0 01.233 0l4.137 2.175a.25.25 0 00.363-.263l-.79-4.607a.25.25 0 01.072-.222l3.347-3.262a.25.25 0 00-.139-.427l-4.626-.672a.25.25 0 01-.188-.137l-2.069-4.192a.25.25 0 00-.448 0L9.706 8.646zM12 7.39l-.948 1.921a1.75 1.75 0 01-1.317.957l-2.12.308 1.534 1.495c.412.402.6.982.503 1.55l-.362 2.11 1.896-.997a1.75 1.75 0 011.629 0l1.895.997-.362-2.11a1.75 1.75 0 01.504-1.55l1.533-1.495-2.12-.308a1.75 1.75 0 01-1.317-.957L12 7.39z" ,
clipRule : "evenodd"
} )
} ) ;
2024-01-31 07:59:56 -05:00
/* harmony default export */ const star _empty = ( starEmpty ) ;
2022-04-11 08:04:30 -04:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/components/block-ratings/stars.js
2020-01-03 08:17:24 -05:00
/ * *
* WordPress dependencies
* /
2024-05-31 14:59:00 -04:00
2023-06-27 10:24:19 -04:00
function Stars ( {
rating
} ) {
2021-05-19 11:09:27 -04:00
const stars = Math . round ( rating / 0.5 ) * 0.5 ;
const fullStarCount = Math . floor ( rating ) ;
const halfStarCount = Math . ceil ( rating - fullStarCount ) ;
const emptyStarCount = 5 - ( fullStarCount + halfStarCount ) ;
2024-05-31 14:59:00 -04:00
return /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsxs ) ( "span" , {
2023-09-26 10:23:26 -04:00
"aria-label" : ( 0 , external _wp _i18n _namespaceObject . sprintf ) ( /* translators: %s: number of stars. */
2024-05-31 14:59:00 -04:00
( 0 , external _wp _i18n _namespaceObject . _ _ ) ( '%s out of 5 stars' ) , stars ) ,
children : [ Array . from ( {
length : fullStarCount
} ) . map ( ( _ , i ) => /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( icon , {
className : "block-directory-block-ratings__star-full" ,
icon : star _filled ,
size : 16
} , ` full_stars_ ${ i } ` ) ) , Array . from ( {
length : halfStarCount
} ) . map ( ( _ , i ) => /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( icon , {
className : "block-directory-block-ratings__star-half-full" ,
icon : star _half ,
size : 16
} , ` half_stars_ ${ i } ` ) ) , Array . from ( {
length : emptyStarCount
} ) . map ( ( _ , i ) => /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( icon , {
className : "block-directory-block-ratings__star-empty" ,
icon : star _empty ,
size : 16
} , ` empty_stars_ ${ i } ` ) ) ]
} ) ;
2020-01-03 08:17:24 -05:00
}
2024-01-31 07:59:56 -05:00
/* harmony default export */ const stars = ( Stars ) ;
2020-01-03 08:17:24 -05:00
2022-04-11 08:04:30 -04:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/components/block-ratings/index.js
2020-01-03 08:17:24 -05:00
/ * *
* Internal dependencies
* /
2024-05-31 14:59:00 -04:00
2023-06-27 10:24:19 -04:00
const BlockRatings = ( {
rating
2024-05-31 14:59:00 -04:00
} ) => /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( "span" , {
className : "block-directory-block-ratings" ,
children : /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( stars , {
rating : rating
} )
} ) ;
2024-01-31 07:59:56 -05:00
/* harmony default export */ const block _ratings = ( BlockRatings ) ;
2020-01-03 08:17:24 -05:00
2022-04-11 08:04:30 -04:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/components/downloadable-block-icon/index.js
2020-06-26 09:33:47 -04:00
/ * *
* WordPress dependencies
* /
2024-05-31 14:59:00 -04:00
2023-06-27 10:24:19 -04:00
function DownloadableBlockIcon ( {
icon
} ) {
2021-05-19 11:09:27 -04:00
const className = 'block-directory-downloadable-block-icon' ;
2024-05-31 14:59:00 -04:00
return icon . match ( /\.(jpeg|jpg|gif|png|svg)(?:\?.*)?$/ ) !== null ? /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( "img" , {
2021-04-15 11:19:43 -04:00
className : className ,
2020-06-26 09:33:47 -04:00
src : icon ,
2021-04-15 11:19:43 -04:00
alt : ""
2024-05-31 14:59:00 -04:00
} ) : /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( external _wp _blockEditor _namespaceObject . BlockIcon , {
2021-04-15 11:19:43 -04:00
className : className ,
2020-06-26 09:33:47 -04:00
icon : icon ,
showColors : true
2021-04-15 11:19:43 -04:00
} ) ;
2020-06-26 09:33:47 -04:00
}
2024-01-31 07:59:56 -05:00
/* harmony default export */ const downloadable _block _icon = ( DownloadableBlockIcon ) ;
2020-06-26 09:33:47 -04:00
2022-04-11 08:04:30 -04:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/components/downloadable-block-notice/index.js
2020-01-03 08:17:24 -05:00
/ * *
* WordPress dependencies
* /
2023-09-26 10:23:26 -04:00
2020-01-03 08:17:24 -05:00
/ * *
* Internal dependencies
* /
2024-05-31 14:59:00 -04:00
2023-06-27 10:24:19 -04:00
const DownloadableBlockNotice = ( {
block
} ) => {
2022-04-11 08:04:30 -04:00
const errorNotice = ( 0 , external _wp _data _namespaceObject . useSelect ) ( select => select ( store ) . getErrorNoticeForBlock ( block . id ) , [ block ] ) ;
2021-04-15 11:19:43 -04:00
if ( ! errorNotice ) {
return null ;
}
2024-05-31 14:59:00 -04:00
return /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( "div" , {
className : "block-directory-downloadable-block-notice" ,
children : /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsxs ) ( "div" , {
className : "block-directory-downloadable-block-notice__content" ,
children : [ errorNotice . message , errorNotice . isFatal ? ' ' + ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Try reloading the page.' ) : null ]
} )
} ) ;
2021-04-15 11:19:43 -04:00
} ;
2024-01-31 07:59:56 -05:00
/* harmony default export */ const downloadable _block _notice = ( DownloadableBlockNotice ) ;
2020-01-03 08:17:24 -05:00
2022-04-11 08:04:30 -04:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/components/downloadable-block-list-item/index.js
2024-10-06 18:45:30 -04:00
/ * *
* External dependencies
* /
2020-01-03 08:17:24 -05:00
/ * *
* WordPress dependencies
* /
2020-02-10 17:33:27 -05:00
2020-01-03 08:17:24 -05:00
2023-09-26 10:23:26 -04:00
2020-01-03 08:17:24 -05:00
/ * *
2021-04-15 11:19:43 -04:00
* Internal dependencies
2020-01-03 08:17:24 -05:00
* /
2020-10-13 09:10:30 -04:00
2024-09-19 21:55:35 -04:00
// Return the appropriate block item label, given the block data and status.
2024-05-31 14:59:00 -04:00
2023-06-27 10:24:19 -04:00
function getDownloadableBlockLabel ( {
title ,
rating ,
ratingCount
} , {
hasNotice ,
isInstalled ,
isInstalling
} ) {
2021-05-19 11:09:27 -04:00
const stars = Math . round ( rating / 0.5 ) * 0.5 ;
2021-04-15 11:19:43 -04:00
if ( ! isInstalled && hasNotice ) {
/* translators: %1$s: block title */
2022-04-11 08:04:30 -04:00
return ( 0 , external _wp _i18n _namespaceObject . sprintf ) ( 'Retry installing %s.' , ( 0 , external _wp _htmlEntities _namespaceObject . decodeEntities ) ( title ) ) ;
2020-10-13 09:10:30 -04:00
}
2021-04-15 11:19:43 -04:00
if ( isInstalled ) {
/* translators: %1$s: block title */
2022-04-11 08:04:30 -04:00
return ( 0 , external _wp _i18n _namespaceObject . sprintf ) ( 'Add %s.' , ( 0 , external _wp _htmlEntities _namespaceObject . decodeEntities ) ( title ) ) ;
2020-06-26 09:33:47 -04:00
}
2021-04-15 11:19:43 -04:00
if ( isInstalling ) {
/* translators: %1$s: block title */
2022-04-11 08:04:30 -04:00
return ( 0 , external _wp _i18n _namespaceObject . sprintf ) ( 'Installing %s.' , ( 0 , external _wp _htmlEntities _namespaceObject . decodeEntities ) ( title ) ) ;
2023-09-26 10:23:26 -04:00
}
2020-01-03 08:17:24 -05:00
2023-09-26 10:23:26 -04:00
// No ratings yet, just use the title.
2021-04-15 11:19:43 -04:00
if ( ratingCount < 1 ) {
/* translators: %1$s: block title */
2022-04-11 08:04:30 -04:00
return ( 0 , external _wp _i18n _namespaceObject . sprintf ) ( 'Install %s.' , ( 0 , external _wp _htmlEntities _namespaceObject . decodeEntities ) ( title ) ) ;
2021-04-15 11:19:43 -04:00
}
2023-09-26 10:23:26 -04:00
return ( 0 , external _wp _i18n _namespaceObject . sprintf ) ( /* translators: %1$s: block title, %2$s: average rating, %3$s: total ratings count. */
2022-04-11 08:04:30 -04:00
( 0 , external _wp _i18n _namespaceObject . _n ) ( 'Install %1$s. %2$s stars with %3$s review.' , 'Install %1$s. %2$s stars with %3$s reviews.' , ratingCount ) , ( 0 , external _wp _htmlEntities _namespaceObject . decodeEntities ) ( title ) , stars , ratingCount ) ;
2021-04-15 11:19:43 -04:00
}
2023-06-27 10:24:19 -04:00
function DownloadableBlockListItem ( {
item ,
onClick
} ) {
2021-05-19 11:09:27 -04:00
const {
author ,
description ,
icon ,
rating ,
title
2023-09-26 10:23:26 -04:00
} = item ;
// getBlockType returns a block object if this block exists, or null if not.
2022-04-11 08:04:30 -04:00
const isInstalled = ! ! ( 0 , external _wp _blocks _namespaceObject . getBlockType ) ( item . name ) ;
2021-05-19 11:09:27 -04:00
const {
hasNotice ,
isInstalling ,
isInstallable
2022-04-11 08:04:30 -04:00
} = ( 0 , external _wp _data _namespaceObject . useSelect ) ( select => {
2021-05-19 11:09:27 -04:00
const {
getErrorNoticeForBlock ,
isInstalling : isBlockInstalling
} = select ( store ) ;
const notice = getErrorNoticeForBlock ( item . id ) ;
const hasFatal = notice && notice . isFatal ;
2020-07-07 10:43:35 -04:00
return {
2021-04-15 11:19:43 -04:00
hasNotice : ! ! notice ,
isInstalling : isBlockInstalling ( item . id ) ,
2020-07-07 10:43:35 -04:00
isInstallable : ! hasFatal
} ;
2021-05-19 11:09:27 -04:00
} , [ item ] ) ;
let statusText = '' ;
2021-04-15 11:19:43 -04:00
if ( isInstalled ) {
2022-04-11 08:04:30 -04:00
statusText = ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Installed!' ) ;
2021-04-15 11:19:43 -04:00
} else if ( isInstalling ) {
2022-04-11 08:04:30 -04:00
statusText = ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Installing…' ) ;
2021-04-15 11:19:43 -04:00
}
2024-10-06 18:45:30 -04:00
const itemLabel = getDownloadableBlockLabel ( item , {
hasNotice ,
isInstalled ,
isInstalling
} ) ;
return /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( external _wp _components _namespaceObject . Tooltip , {
placement : "top" ,
text : itemLabel ,
children : /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsxs ) ( external _wp _components _namespaceObject . Composite . Item , {
className : dist _clsx ( 'block-directory-downloadable-block-list-item' , isInstalling && 'is-installing' ) ,
2024-09-19 21:55:35 -04:00
accessibleWhenDisabled : true ,
2024-10-06 18:45:30 -04:00
disabled : isInstalling || ! isInstallable ,
Editor: Update the WordPress packages to the Gutenberg 16.7 RC2 version.
This patch, somewhat small brings a lot to WordPress.
This includes features like:
- DataViews.
- Customization tools like box shadow, background size and repeat.
- UI improvements in the site editor.
- Preferences sharing between the post and site editors.
- Unified panels and editors between post and site editors.
- Improved template mode in the post editor.
- Iterations to multiple interactive blocks.
- Preparing the blocks and UI for pattern overrides.
- and a lot more.
Props luisherranz, gziolo, isabel_brison, costdev, jonsurrell, peterwilsoncc, get_dave, antonvlasenko, desrosj.
See #60315.
Built from https://develop.svn.wordpress.org/trunk@57377
git-svn-id: http://core.svn.wordpress.org/trunk@56883 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-29 16:07:12 -05:00
onClick : event => {
event . preventDefault ( ) ;
onClick ( ) ;
} ,
2024-10-06 18:45:30 -04:00
"aria-label" : itemLabel ,
type : "button" ,
role : "option" ,
children : [ /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsxs ) ( "div" , {
className : "block-directory-downloadable-block-list-item__icon" ,
children : [ /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( downloadable _block _icon , {
icon : icon ,
title : title
} ) , isInstalling ? /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( "span" , {
className : "block-directory-downloadable-block-list-item__spinner" ,
children : /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( external _wp _components _namespaceObject . Spinner , { } )
} ) : /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( block _ratings , {
rating : rating
} ) ]
} ) , /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsxs ) ( "span" , {
className : "block-directory-downloadable-block-list-item__details" ,
2024-05-31 14:59:00 -04:00
children : [ /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( "span" , {
2024-10-06 18:45:30 -04:00
className : "block-directory-downloadable-block-list-item__title" ,
children : ( 0 , external _wp _element _namespaceObject . createInterpolateElement ) ( ( 0 , external _wp _i18n _namespaceObject . sprintf ) ( /* translators: %1$s: block title, %2$s: author name. */
( 0 , external _wp _i18n _namespaceObject . _ _ ) ( '%1$s <span>by %2$s</span>' ) , ( 0 , external _wp _htmlEntities _namespaceObject . decodeEntities ) ( title ) , author ) , {
span : /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( "span" , {
className : "block-directory-downloadable-block-list-item__author"
} )
} )
} ) , hasNotice ? /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( downloadable _block _notice , {
block : item
} ) : /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsxs ) ( external _ReactJSXRuntime _namespaceObject . Fragment , {
children : [ /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( "span" , {
className : "block-directory-downloadable-block-list-item__desc" ,
children : ! ! statusText ? statusText : ( 0 , external _wp _htmlEntities _namespaceObject . decodeEntities ) ( description )
} ) , isInstallable && ! ( isInstalled || isInstalling ) && /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( external _wp _components _namespaceObject . VisuallyHidden , {
children : ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Install block' )
} ) ]
2024-05-31 14:59:00 -04:00
} ) ]
} ) ]
2024-10-06 18:45:30 -04:00
} )
2024-05-31 14:59:00 -04:00
} ) ;
2020-01-03 08:17:24 -05:00
}
2024-01-31 07:59:56 -05:00
/* harmony default export */ const downloadable _block _list _item = ( DownloadableBlockListItem ) ;
2021-04-15 11:19:43 -04:00
2022-04-11 08:04:30 -04:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/components/downloadable-blocks-list/index.js
2020-01-03 08:17:24 -05:00
/ * *
* WordPress dependencies
* /
2021-01-27 21:04:13 -05:00
2021-04-15 11:19:43 -04:00
2023-09-26 10:23:26 -04:00
2020-01-03 08:17:24 -05:00
/ * *
* Internal dependencies
* /
Editor: Update the WordPress packages to the Gutenberg 16.7 RC2 version.
This patch, somewhat small brings a lot to WordPress.
This includes features like:
- DataViews.
- Customization tools like box shadow, background size and repeat.
- UI improvements in the site editor.
- Preferences sharing between the post and site editors.
- Unified panels and editors between post and site editors.
- Improved template mode in the post editor.
- Iterations to multiple interactive blocks.
- Preparing the blocks and UI for pattern overrides.
- and a lot more.
Props luisherranz, gziolo, isabel_brison, costdev, jonsurrell, peterwilsoncc, get_dave, antonvlasenko, desrosj.
See #60315.
Built from https://develop.svn.wordpress.org/trunk@57377
git-svn-id: http://core.svn.wordpress.org/trunk@56883 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-29 16:07:12 -05:00
2022-09-20 11:43:29 -04:00
const noop = ( ) => { } ;
2023-06-27 10:24:19 -04:00
function DownloadableBlocksList ( {
items ,
onHover = noop ,
onSelect
} ) {
2021-05-19 11:09:27 -04:00
const {
installBlockType
2022-04-11 08:04:30 -04:00
} = ( 0 , external _wp _data _namespaceObject . useDispatch ) ( store ) ;
2020-06-26 09:33:47 -04:00
if ( ! items . length ) {
return null ;
}
2024-09-19 21:55:35 -04:00
return /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( external _wp _components _namespaceObject . Composite , {
2021-04-15 11:19:43 -04:00
role : "listbox" ,
className : "block-directory-downloadable-blocks-list" ,
2024-05-31 14:59:00 -04:00
"aria-label" : ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Blocks available for install' ) ,
children : items . map ( item => {
return /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( downloadable _block _list _item , {
onClick : ( ) => {
// Check if the block is registered (`getBlockType`
// will return an object). If so, insert the block.
// This prevents installing existing plugins.
if ( ( 0 , external _wp _blocks _namespaceObject . getBlockType ) ( item . name ) ) {
onSelect ( item ) ;
} else {
installBlockType ( item ) . then ( success => {
if ( success ) {
onSelect ( item ) ;
}
} ) ;
}
onHover ( null ) ;
} ,
onHover : onHover ,
item : item
} , item . id ) ;
} )
} ) ;
2021-04-15 11:19:43 -04:00
}
2024-01-31 07:59:56 -05:00
/* harmony default export */ const downloadable _blocks _list = ( DownloadableBlocksList ) ;
2021-04-15 11:19:43 -04:00
2022-04-11 08:04:30 -04:00
; // CONCATENATED MODULE: external ["wp","a11y"]
2024-01-31 07:59:56 -05:00
const external _wp _a11y _namespaceObject = window [ "wp" ] [ "a11y" ] ;
2022-04-11 08:04:30 -04:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/components/downloadable-blocks-panel/inserter-panel.js
2021-04-15 11:19:43 -04:00
/ * *
* WordPress dependencies
* /
2020-01-03 08:17:24 -05:00
2021-04-15 11:19:43 -04:00
2024-05-31 14:59:00 -04:00
2023-06-27 10:24:19 -04:00
function DownloadableBlocksInserterPanel ( {
children ,
downloadableItems ,
hasLocalBlocks
} ) {
2021-05-19 11:09:27 -04:00
const count = downloadableItems . length ;
2022-04-11 08:04:30 -04:00
( 0 , external _wp _element _namespaceObject . useEffect ) ( ( ) => {
2023-09-26 10:23:26 -04:00
( 0 , external _wp _a11y _namespaceObject . speak ) ( ( 0 , external _wp _i18n _namespaceObject . sprintf ) ( /* translators: %d: number of available blocks. */
2022-04-11 08:04:30 -04:00
( 0 , external _wp _i18n _namespaceObject . _n ) ( '%d additional block is available to install.' , '%d additional blocks are available to install.' , count ) , count ) ) ;
2021-04-15 11:19:43 -04:00
} , [ count ] ) ;
2024-05-31 14:59:00 -04:00
return /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsxs ) ( external _ReactJSXRuntime _namespaceObject . Fragment , {
children : [ ! hasLocalBlocks && /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( "p" , {
className : "block-directory-downloadable-blocks-panel__no-local" ,
children : ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'No results available from your installed blocks.' )
} ) , /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( "div" , {
className : "block-editor-inserter__quick-inserter-separator"
} ) , /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsxs ) ( "div" , {
className : "block-directory-downloadable-blocks-panel" ,
children : [ /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsxs ) ( "div" , {
className : "block-directory-downloadable-blocks-panel__header" ,
children : [ /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( "h2" , {
className : "block-directory-downloadable-blocks-panel__title" ,
children : ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Available to install' )
} ) , /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( "p" , {
className : "block-directory-downloadable-blocks-panel__description" ,
children : ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Select a block to install and add it to your post.' )
} ) ]
} ) , children ]
} ) ]
} ) ;
2020-01-03 08:17:24 -05:00
}
2024-01-31 07:59:56 -05:00
/* harmony default export */ const inserter _panel = ( DownloadableBlocksInserterPanel ) ;
2020-01-03 08:17:24 -05:00
2022-04-11 08:04:30 -04:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/block-default.js
/ * *
* WordPress dependencies
* /
2024-05-31 14:59:00 -04:00
const blockDefault = /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( external _wp _primitives _namespaceObject . SVG , {
2022-04-11 08:04:30 -04:00
xmlns : "http://www.w3.org/2000/svg" ,
2024-05-31 14:59:00 -04:00
viewBox : "0 0 24 24" ,
children : /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( external _wp _primitives _namespaceObject . Path , {
d : "M19 8h-1V6h-5v2h-2V6H6v2H5c-1.1 0-2 .9-2 2v8c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2v-8c0-1.1-.9-2-2-2zm.5 10c0 .3-.2.5-.5.5H5c-.3 0-.5-.2-.5-.5v-8c0-.3.2-.5.5-.5h14c.3 0 .5.2.5.5v8z"
} )
} ) ;
2024-01-31 07:59:56 -05:00
/* harmony default export */ const block _default = ( blockDefault ) ;
2021-04-15 11:19:43 -04:00
2022-04-11 08:04:30 -04:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/components/downloadable-blocks-panel/no-results.js
2020-01-03 08:17:24 -05:00
/ * *
* WordPress dependencies
* /
2024-05-31 14:59:00 -04:00
2021-04-15 11:19:43 -04:00
function DownloadableBlocksNoResults ( ) {
2024-05-31 14:59:00 -04:00
return /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsxs ) ( external _ReactJSXRuntime _namespaceObject . Fragment , {
children : [ /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsxs ) ( "div" , {
className : "block-editor-inserter__no-results" ,
children : [ /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( icon , {
className : "block-editor-inserter__no-results-icon" ,
icon : block _default
} ) , /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( "p" , {
children : ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'No results found.' )
} ) ]
} ) , /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( "div" , {
className : "block-editor-inserter__tips" ,
children : /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsxs ) ( external _wp _components _namespaceObject . Tip , {
children : [ ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Interested in creating your own block?' ) , /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( "br" , { } ) , /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsxs ) ( external _wp _components _namespaceObject . ExternalLink , {
href : "https://developer.wordpress.org/block-editor/" ,
children : [ ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Get started here' ) , "." ]
} ) ]
} )
} ) ]
} ) ;
2021-04-15 11:19:43 -04:00
}
2024-01-31 07:59:56 -05:00
/* harmony default export */ const no _results = ( DownloadableBlocksNoResults ) ;
2021-04-15 11:19:43 -04:00
2022-04-11 08:04:30 -04:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/components/downloadable-blocks-panel/index.js
2021-04-15 11:19:43 -04:00
/ * *
* WordPress dependencies
* /
2020-01-03 08:17:24 -05:00
2020-10-20 09:36:16 -04:00
2021-02-02 00:17:13 -05:00
2020-01-03 08:17:24 -05:00
/ * *
* Internal dependencies
* /
2021-01-27 21:04:13 -05:00
2024-05-31 14:59:00 -04:00
2023-06-27 10:24:19 -04:00
const EMPTY _ARRAY = [ ] ;
Editor: Update the WordPress packages to the Gutenberg 16.7 RC2 version.
This patch, somewhat small brings a lot to WordPress.
This includes features like:
- DataViews.
- Customization tools like box shadow, background size and repeat.
- UI improvements in the site editor.
- Preferences sharing between the post and site editors.
- Unified panels and editors between post and site editors.
- Improved template mode in the post editor.
- Iterations to multiple interactive blocks.
- Preparing the blocks and UI for pattern overrides.
- and a lot more.
Props luisherranz, gziolo, isabel_brison, costdev, jonsurrell, peterwilsoncc, get_dave, antonvlasenko, desrosj.
See #60315.
Built from https://develop.svn.wordpress.org/trunk@57377
git-svn-id: http://core.svn.wordpress.org/trunk@56883 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-29 16:07:12 -05:00
const useDownloadableBlocks = filterValue => ( 0 , external _wp _data _namespaceObject . useSelect ) ( select => {
const {
getDownloadableBlocks ,
isRequestingDownloadableBlocks ,
getInstalledBlockTypes
} = select ( store ) ;
const hasPermission = select ( external _wp _coreData _namespaceObject . store ) . canUser ( 'read' , 'block-directory/search' ) ;
let downloadableBlocks = EMPTY _ARRAY ;
if ( hasPermission ) {
downloadableBlocks = getDownloadableBlocks ( filterValue ) ;
// Filter out blocks that are already installed.
const installedBlockTypes = getInstalledBlockTypes ( ) ;
const installableBlocks = downloadableBlocks . filter ( ( {
name
} ) => {
// Check if the block has just been installed, in which case it
// should still show in the list to avoid suddenly disappearing.
// `installedBlockTypes` only returns blocks stored in state
// immediately after installation, not all installed blocks.
const isJustInstalled = installedBlockTypes . some ( blockType => blockType . name === name ) ;
const isPreviouslyInstalled = ( 0 , external _wp _blocks _namespaceObject . getBlockType ) ( name ) ;
return isJustInstalled || ! isPreviouslyInstalled ;
} ) ;
// Keep identity of the `downloadableBlocks` array if nothing was filtered out
if ( installableBlocks . length !== downloadableBlocks . length ) {
downloadableBlocks = installableBlocks ;
}
// Return identical empty array when there are no blocks
if ( downloadableBlocks . length === 0 ) {
downloadableBlocks = EMPTY _ARRAY ;
}
}
return {
hasPermission ,
downloadableBlocks ,
isLoading : isRequestingDownloadableBlocks ( filterValue )
} ;
} , [ filterValue ] ) ;
2023-06-27 10:24:19 -04:00
function DownloadableBlocksPanel ( {
onSelect ,
onHover ,
hasLocalBlocks ,
Editor: Update the WordPress packages to the Gutenberg 16.7 RC2 version.
This patch, somewhat small brings a lot to WordPress.
This includes features like:
- DataViews.
- Customization tools like box shadow, background size and repeat.
- UI improvements in the site editor.
- Preferences sharing between the post and site editors.
- Unified panels and editors between post and site editors.
- Improved template mode in the post editor.
- Iterations to multiple interactive blocks.
- Preparing the blocks and UI for pattern overrides.
- and a lot more.
Props luisherranz, gziolo, isabel_brison, costdev, jonsurrell, peterwilsoncc, get_dave, antonvlasenko, desrosj.
See #60315.
Built from https://develop.svn.wordpress.org/trunk@57377
git-svn-id: http://core.svn.wordpress.org/trunk@56883 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-29 16:07:12 -05:00
isTyping ,
filterValue
2023-06-27 10:24:19 -04:00
} ) {
Editor: Update the WordPress packages to the Gutenberg 16.7 RC2 version.
This patch, somewhat small brings a lot to WordPress.
This includes features like:
- DataViews.
- Customization tools like box shadow, background size and repeat.
- UI improvements in the site editor.
- Preferences sharing between the post and site editors.
- Unified panels and editors between post and site editors.
- Improved template mode in the post editor.
- Iterations to multiple interactive blocks.
- Preparing the blocks and UI for pattern overrides.
- and a lot more.
Props luisherranz, gziolo, isabel_brison, costdev, jonsurrell, peterwilsoncc, get_dave, antonvlasenko, desrosj.
See #60315.
Built from https://develop.svn.wordpress.org/trunk@57377
git-svn-id: http://core.svn.wordpress.org/trunk@56883 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-29 16:07:12 -05:00
const {
hasPermission ,
downloadableBlocks ,
isLoading
} = useDownloadableBlocks ( filterValue ) ;
if ( hasPermission === undefined || isLoading || isTyping ) {
2024-05-31 14:59:00 -04:00
return /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsxs ) ( external _ReactJSXRuntime _namespaceObject . Fragment , {
children : [ hasPermission && ! hasLocalBlocks && /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsxs ) ( external _ReactJSXRuntime _namespaceObject . Fragment , {
children : [ /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( "p" , {
className : "block-directory-downloadable-blocks-panel__no-local" ,
children : ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'No results available from your installed blocks.' )
} ) , /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( "div" , {
className : "block-editor-inserter__quick-inserter-separator"
} ) ]
} ) , /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( "div" , {
className : "block-directory-downloadable-blocks-panel has-blocks-loading" ,
children : /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( external _wp _components _namespaceObject . Spinner , { } )
} ) ]
} ) ;
2020-01-03 08:17:24 -05:00
}
2021-04-15 11:19:43 -04:00
if ( false === hasPermission ) {
if ( ! hasLocalBlocks ) {
2024-05-31 14:59:00 -04:00
return /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( no _results , { } ) ;
2021-04-15 11:19:43 -04:00
}
return null ;
2020-01-03 08:17:24 -05:00
}
Editor: Update the WordPress packages to the Gutenberg 16.7 RC2 version.
This patch, somewhat small brings a lot to WordPress.
This includes features like:
- DataViews.
- Customization tools like box shadow, background size and repeat.
- UI improvements in the site editor.
- Preferences sharing between the post and site editors.
- Unified panels and editors between post and site editors.
- Improved template mode in the post editor.
- Iterations to multiple interactive blocks.
- Preparing the blocks and UI for pattern overrides.
- and a lot more.
Props luisherranz, gziolo, isabel_brison, costdev, jonsurrell, peterwilsoncc, get_dave, antonvlasenko, desrosj.
See #60315.
Built from https://develop.svn.wordpress.org/trunk@57377
git-svn-id: http://core.svn.wordpress.org/trunk@56883 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-29 16:07:12 -05:00
if ( downloadableBlocks . length === 0 ) {
2024-05-31 14:59:00 -04:00
return hasLocalBlocks ? null : /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( no _results , { } ) ;
Editor: Update the WordPress packages to the Gutenberg 16.7 RC2 version.
This patch, somewhat small brings a lot to WordPress.
This includes features like:
- DataViews.
- Customization tools like box shadow, background size and repeat.
- UI improvements in the site editor.
- Preferences sharing between the post and site editors.
- Unified panels and editors between post and site editors.
- Improved template mode in the post editor.
- Iterations to multiple interactive blocks.
- Preparing the blocks and UI for pattern overrides.
- and a lot more.
Props luisherranz, gziolo, isabel_brison, costdev, jonsurrell, peterwilsoncc, get_dave, antonvlasenko, desrosj.
See #60315.
Built from https://develop.svn.wordpress.org/trunk@57377
git-svn-id: http://core.svn.wordpress.org/trunk@56883 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-29 16:07:12 -05:00
}
2024-05-31 14:59:00 -04:00
return /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( inserter _panel , {
Editor: Update the WordPress packages to the Gutenberg 16.7 RC2 version.
This patch, somewhat small brings a lot to WordPress.
This includes features like:
- DataViews.
- Customization tools like box shadow, background size and repeat.
- UI improvements in the site editor.
- Preferences sharing between the post and site editors.
- Unified panels and editors between post and site editors.
- Improved template mode in the post editor.
- Iterations to multiple interactive blocks.
- Preparing the blocks and UI for pattern overrides.
- and a lot more.
Props luisherranz, gziolo, isabel_brison, costdev, jonsurrell, peterwilsoncc, get_dave, antonvlasenko, desrosj.
See #60315.
Built from https://develop.svn.wordpress.org/trunk@57377
git-svn-id: http://core.svn.wordpress.org/trunk@56883 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-29 16:07:12 -05:00
downloadableItems : downloadableBlocks ,
2024-05-31 14:59:00 -04:00
hasLocalBlocks : hasLocalBlocks ,
children : /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( downloadable _blocks _list , {
items : downloadableBlocks ,
onSelect : onSelect ,
onHover : onHover
} )
} ) ;
2020-01-03 08:17:24 -05:00
}
2022-04-11 08:04:30 -04:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/plugins/inserter-menu-downloadable-blocks-panel/index.js
2020-01-08 06:57:23 -05:00
/ * *
* WordPress dependencies
* /
2023-09-26 10:23:26 -04:00
2020-01-08 06:57:23 -05:00
/ * *
* Internal dependencies
* /
2024-05-31 14:59:00 -04:00
2020-01-08 06:57:23 -05:00
function InserterMenuDownloadableBlocksPanel ( ) {
2022-04-11 08:04:30 -04:00
const [ debouncedFilterValue , setFilterValue ] = ( 0 , external _wp _element _namespaceObject . useState ) ( '' ) ;
2023-02-07 02:04:52 -05:00
const debouncedSetFilterValue = ( 0 , external _wp _compose _namespaceObject . debounce ) ( setFilterValue , 400 ) ;
2024-05-31 14:59:00 -04:00
return /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( external _wp _blockEditor _namespaceObject . _ _unstableInserterMenuExtension , {
children : ( {
onSelect ,
onHover ,
filterValue ,
hasItems
} ) => {
if ( debouncedFilterValue !== filterValue ) {
debouncedSetFilterValue ( filterValue ) ;
}
if ( ! debouncedFilterValue ) {
return null ;
}
return /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( DownloadableBlocksPanel , {
onSelect : onSelect ,
onHover : onHover ,
filterValue : debouncedFilterValue ,
hasLocalBlocks : hasItems ,
isTyping : filterValue !== debouncedFilterValue
} ) ;
2021-04-15 11:19:43 -04:00
}
2020-01-08 06:57:23 -05:00
} ) ;
}
2024-01-31 07:59:56 -05:00
/* harmony default export */ const inserter _menu _downloadable _blocks _panel = ( InserterMenuDownloadableBlocksPanel ) ;
2020-01-08 06:57:23 -05:00
2022-04-11 08:04:30 -04:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/components/compact-list/index.js
2020-06-26 09:33:47 -04:00
/ * *
* WordPress dependencies
* /
2023-09-26 10:23:26 -04:00
2020-06-26 09:33:47 -04:00
/ * *
* Internal dependencies
* /
2024-05-31 14:59:00 -04:00
2023-06-27 10:24:19 -04:00
function CompactList ( {
items
} ) {
2020-06-26 09:33:47 -04:00
if ( ! items . length ) {
return null ;
}
2024-05-31 14:59:00 -04:00
return /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( "ul" , {
className : "block-directory-compact-list" ,
children : items . map ( ( {
icon ,
id ,
title ,
author
} ) => /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsxs ) ( "li" , {
className : "block-directory-compact-list__item" ,
children : [ /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( downloadable _block _icon , {
icon : icon ,
title : title
} ) , /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsxs ) ( "div" , {
className : "block-directory-compact-list__item-details" ,
children : [ /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( "div" , {
className : "block-directory-compact-list__item-title" ,
children : title
} ) , /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( "div" , {
className : "block-directory-compact-list__item-author" ,
children : ( 0 , external _wp _i18n _namespaceObject . sprintf ) ( /* translators: %s: Name of the block author. */
( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'By %s' ) , author )
} ) ]
} ) ]
} , id ) )
} ) ;
2020-06-26 09:33:47 -04:00
}
2022-04-11 08:04:30 -04:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/plugins/installed-blocks-pre-publish-panel/index.js
2020-06-26 09:33:47 -04:00
/ * *
* WordPress dependencies
* /
2023-09-26 10:23:26 -04:00
2024-09-19 21:55:35 -04:00
2020-06-26 09:33:47 -04:00
/ * *
* Internal dependencies
* /
2021-01-27 21:04:13 -05:00
2024-05-31 14:59:00 -04:00
2020-06-26 09:33:47 -04:00
function InstalledBlocksPrePublishPanel ( ) {
2022-04-11 08:04:30 -04:00
const newBlockTypes = ( 0 , external _wp _data _namespaceObject . useSelect ) ( select => select ( store ) . getNewBlockTypes ( ) , [ ] ) ;
2020-06-26 09:33:47 -04:00
if ( ! newBlockTypes . length ) {
return null ;
}
2024-09-19 21:55:35 -04:00
return /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsxs ) ( external _wp _editor _namespaceObject . PluginPrePublishPanel , {
2022-04-11 08:04:30 -04:00
icon : block _default ,
2023-09-26 10:23:26 -04:00
title : ( 0 , external _wp _i18n _namespaceObject . sprintf ) (
// translators: %d: number of blocks (number).
2022-04-11 08:04:30 -04:00
( 0 , external _wp _i18n _namespaceObject . _n ) ( 'Added: %d block' , 'Added: %d blocks' , newBlockTypes . length ) , newBlockTypes . length ) ,
2024-05-31 14:59:00 -04:00
initialOpen : true ,
children : [ /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( "p" , {
className : "installed-blocks-pre-publish-panel__copy" ,
children : ( 0 , external _wp _i18n _namespaceObject . _n ) ( 'The following block has been added to your site.' , 'The following blocks have been added to your site.' , newBlockTypes . length )
} ) , /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( CompactList , {
items : newBlockTypes
} ) ]
} ) ;
2020-06-26 09:33:47 -04:00
}
2022-04-11 08:04:30 -04:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/plugins/get-install-missing/install-button.js
2020-10-13 09:10:30 -04:00
/ * *
* WordPress dependencies
* /
2021-04-15 11:19:43 -04:00
2023-09-26 10:23:26 -04:00
2021-01-27 21:04:13 -05:00
/ * *
* Internal dependencies
* /
2024-05-31 14:59:00 -04:00
2023-06-27 10:24:19 -04:00
function InstallButton ( {
attributes ,
block ,
clientId
} ) {
2022-04-11 08:04:30 -04:00
const isInstallingBlock = ( 0 , external _wp _data _namespaceObject . useSelect ) ( select => select ( store ) . isInstalling ( block . id ) , [ block . id ] ) ;
2021-05-19 11:09:27 -04:00
const {
installBlockType
2022-04-11 08:04:30 -04:00
} = ( 0 , external _wp _data _namespaceObject . useDispatch ) ( store ) ;
2021-05-19 11:09:27 -04:00
const {
replaceBlock
2022-04-11 08:04:30 -04:00
} = ( 0 , external _wp _data _namespaceObject . useDispatch ) ( external _wp _blockEditor _namespaceObject . store ) ;
2024-10-06 18:45:30 -04:00
return /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( external _wp _components _namespaceObject . Button , {
_ _next40pxDefaultSize : true ,
2021-05-19 11:09:27 -04:00
onClick : ( ) => installBlockType ( block ) . then ( success => {
if ( success ) {
2022-04-11 08:04:30 -04:00
const blockType = ( 0 , external _wp _blocks _namespaceObject . getBlockType ) ( block . name ) ;
const [ originalBlock ] = ( 0 , external _wp _blocks _namespaceObject . parse ) ( attributes . originalContent ) ;
2021-11-08 09:29:21 -05:00
if ( originalBlock && blockType ) {
2022-04-11 08:04:30 -04:00
replaceBlock ( clientId , ( 0 , external _wp _blocks _namespaceObject . createBlock ) ( blockType . name , originalBlock . attributes , originalBlock . innerBlocks ) ) ;
2020-10-13 09:10:30 -04:00
}
2021-05-19 11:09:27 -04:00
}
} ) ,
2024-09-19 21:55:35 -04:00
accessibleWhenDisabled : true ,
2020-10-13 09:10:30 -04:00
disabled : isInstallingBlock ,
isBusy : isInstallingBlock ,
2024-05-31 14:59:00 -04:00
variant : "primary" ,
children : ( 0 , external _wp _i18n _namespaceObject . sprintf ) ( /* translators: %s: block name */
( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Install %s' ) , block . title )
} ) ;
2020-10-13 09:10:30 -04:00
}
2022-04-11 08:04:30 -04:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/plugins/get-install-missing/index.js
2020-01-08 06:57:23 -05:00
/ * *
* WordPress dependencies
* /
2020-10-13 09:10:30 -04:00
2021-04-15 11:19:43 -04:00
2023-09-26 10:23:26 -04:00
2020-01-08 06:57:23 -05:00
/ * *
* Internal dependencies
* /
2024-05-31 14:59:00 -04:00
2021-05-19 11:09:27 -04:00
const getInstallMissing = OriginalComponent => props => {
const {
originalName
2023-09-26 10:23:26 -04:00
} = props . attributes ;
// Disable reason: This is a valid component, but it's mistaken for a callback.
2021-05-19 11:09:27 -04:00
// eslint-disable-next-line react-hooks/rules-of-hooks
const {
block ,
hasPermission
2022-04-11 08:04:30 -04:00
} = ( 0 , external _wp _data _namespaceObject . useSelect ) ( select => {
2021-05-19 11:09:27 -04:00
const {
getDownloadableBlocks
} = select ( store ) ;
2023-06-27 10:24:19 -04:00
const blocks = getDownloadableBlocks ( 'block:' + originalName ) . filter ( ( {
name
} ) => originalName === name ) ;
2021-05-19 11:09:27 -04:00
return {
2022-04-11 08:04:30 -04:00
hasPermission : select ( external _wp _coreData _namespaceObject . store ) . canUser ( 'read' , 'block-directory/search' ) ,
2021-05-19 11:09:27 -04:00
block : blocks . length && blocks [ 0 ]
} ;
2023-09-26 10:23:26 -04:00
} , [ originalName ] ) ;
2020-10-13 09:10:30 -04:00
2023-09-26 10:23:26 -04:00
// The user can't install blocks, or the block isn't available for download.
2021-05-19 11:09:27 -04:00
if ( ! hasPermission || ! block ) {
2024-05-31 14:59:00 -04:00
return /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( OriginalComponent , {
2023-09-26 10:23:26 -04:00
... props
2023-06-27 10:24:19 -04:00
} ) ;
2021-05-19 11:09:27 -04:00
}
2024-05-31 14:59:00 -04:00
return /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( ModifiedWarning , {
2023-09-26 10:23:26 -04:00
... props ,
2021-05-19 11:09:27 -04:00
originalBlock : block
2023-06-27 10:24:19 -04:00
} ) ;
2021-01-27 21:04:13 -05:00
} ;
2023-06-27 10:24:19 -04:00
const ModifiedWarning = ( {
originalBlock ,
... props
} ) => {
2021-05-19 11:09:27 -04:00
const {
originalName ,
2023-02-07 02:04:52 -05:00
originalUndelimitedContent ,
clientId
2021-05-19 11:09:27 -04:00
} = props . attributes ;
const {
replaceBlock
2022-04-11 08:04:30 -04:00
} = ( 0 , external _wp _data _namespaceObject . useDispatch ) ( external _wp _blockEditor _namespaceObject . store ) ;
2021-05-19 11:09:27 -04:00
const convertToHTML = ( ) => {
2022-04-11 08:04:30 -04:00
replaceBlock ( props . clientId , ( 0 , external _wp _blocks _namespaceObject . createBlock ) ( 'core/html' , {
2021-01-27 21:04:13 -05:00
content : originalUndelimitedContent
} ) ) ;
2020-10-13 09:10:30 -04:00
} ;
2021-05-19 11:09:27 -04:00
const hasContent = ! ! originalUndelimitedContent ;
2023-02-07 02:04:52 -05:00
const hasHTMLBlock = ( 0 , external _wp _data _namespaceObject . useSelect ) ( select => {
const {
canInsertBlockType ,
getBlockRootClientId
} = select ( external _wp _blockEditor _namespaceObject . store ) ;
return canInsertBlockType ( 'core/html' , getBlockRootClientId ( clientId ) ) ;
} , [ clientId ] ) ;
2023-09-26 10:23:26 -04:00
let messageHTML = ( 0 , external _wp _i18n _namespaceObject . sprintf ) ( /* translators: %s: block name */
2022-04-11 08:04:30 -04:00
( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Your site doesn’ t include support for the %s block. You can try installing the block or remove it entirely.' ) , originalBlock . title || originalName ) ;
2024-05-31 14:59:00 -04:00
const actions = [ /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( InstallButton , {
2021-01-27 21:04:13 -05:00
block : originalBlock ,
attributes : props . attributes ,
clientId : props . clientId
2024-05-31 14:59:00 -04:00
} , "install" ) ] ;
2021-01-27 21:04:13 -05:00
if ( hasContent && hasHTMLBlock ) {
2023-09-26 10:23:26 -04:00
messageHTML = ( 0 , external _wp _i18n _namespaceObject . sprintf ) ( /* translators: %s: block name */
2022-04-11 08:04:30 -04:00
( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Your site doesn’ t include support for the %s block. You can try installing the block, convert it to a Custom HTML block, or remove it entirely.' ) , originalBlock . title || originalName ) ;
2024-10-06 18:45:30 -04:00
actions . push ( /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( external _wp _components _namespaceObject . Button , {
_ _next40pxDefaultSize : true ,
2021-01-27 21:04:13 -05:00
onClick : convertToHTML ,
2024-05-31 14:59:00 -04:00
variant : "tertiary" ,
children : ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Keep as HTML' )
} , "convert" ) ) ;
2021-01-27 21:04:13 -05:00
}
2024-05-31 14:59:00 -04:00
return /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsxs ) ( "div" , {
... ( 0 , external _wp _blockEditor _namespaceObject . useBlockProps ) ( ) ,
children : [ /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( external _wp _blockEditor _namespaceObject . Warning , {
actions : actions ,
children : messageHTML
} ) , /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( external _wp _element _namespaceObject . RawHTML , {
children : originalUndelimitedContent
} ) ]
} ) ;
2020-10-13 09:10:30 -04:00
} ;
2024-01-31 07:59:56 -05:00
/* harmony default export */ const get _install _missing = ( getInstallMissing ) ;
2020-10-13 09:10:30 -04:00
2022-04-11 08:04:30 -04:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/plugins/index.js
2020-07-07 10:43:35 -04:00
/ * *
* WordPress dependencies
* /
2020-10-13 09:10:30 -04:00
2023-09-26 10:23:26 -04:00
2020-01-03 08:17:24 -05:00
/ * *
* Internal dependencies
* /
2024-05-31 14:59:00 -04:00
2022-04-11 08:04:30 -04:00
( 0 , external _wp _plugins _namespaceObject . registerPlugin ) ( 'block-directory' , {
2021-05-19 11:09:27 -04:00
render ( ) {
2024-05-31 14:59:00 -04:00
return /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsxs ) ( external _ReactJSXRuntime _namespaceObject . Fragment , {
children : [ /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( AutoBlockUninstaller , { } ) , /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( inserter _menu _downloadable _blocks _panel , { } ) , /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( InstalledBlocksPrePublishPanel , { } ) ]
} ) ;
2020-10-13 09:10:30 -04:00
}
} ) ;
2022-04-11 08:04:30 -04:00
( 0 , external _wp _hooks _namespaceObject . addFilter ) ( 'blocks.registerBlockType' , 'block-directory/fallback' , ( settings , name ) => {
2020-10-13 09:10:30 -04:00
if ( name !== 'core/missing' ) {
return settings ;
}
settings . edit = get _install _missing ( settings . edit ) ;
return settings ;
} ) ;
2020-07-27 16:10:36 -04:00
2022-04-11 08:04:30 -04:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/index.js
2020-10-13 09:10:30 -04:00
/ * *
* Internal dependencies
* /
2020-07-27 16:10:36 -04:00
2020-01-08 06:57:23 -05:00
2020-01-03 08:17:24 -05:00
2022-04-11 08:04:30 -04:00
( window . wp = window . wp || { } ) . blockDirectory = _ _webpack _exports _ _ ;
/******/ } ) ( )
;