2024-01-31 07:59:56 -05:00
import * as _ _WEBPACK _EXTERNAL _MODULE _ _wordpress _interactivity _8e89b257 _ _ from "@wordpress/interactivity" ;
2024-09-30 01:11:31 -04:00
/******/ var _ _webpack _modules _ _ = ( {
/***/ 317 :
/***/ ( ( module ) => {
module . exports = import ( "@wordpress/a11y" ) ; ;
/***/ } )
/******/ } ) ;
/************************************************************************/
/******/ // The module cache
/******/ var _ _webpack _module _cache _ _ = { } ;
/******/
/******/ // The require function
/******/ function _ _webpack _require _ _ ( moduleId ) {
/******/ // Check if module is in cache
/******/ var cachedModule = _ _webpack _module _cache _ _ [ moduleId ] ;
/******/ if ( cachedModule !== undefined ) {
/******/ return cachedModule . exports ;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = _ _webpack _module _cache _ _ [ moduleId ] = {
/******/ // no module.id needed
/******/ // no module.loaded needed
/******/ exports : { }
/******/ } ;
/******/
/******/ // Execute the module function
/******/ _ _webpack _modules _ _ [ moduleId ] ( module , module . exports , _ _webpack _require _ _ ) ;
/******/
/******/ // Return the exports of the module
/******/ return module . exports ;
/******/ }
2024-01-31 07:59:56 -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
/************************************************************************/
2024-01-31 07:59:56 -05:00
/******/ /* webpack/runtime/define property getters */
/******/ ( ( ) => {
/******/ // define getter functions for harmony exports
/******/ _ _webpack _require _ _ . d = ( exports , definition ) => {
/******/ 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 ] } ) ;
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-01-31 07:59:56 -05:00
/******/ }
/******/ } ;
/******/ } ) ( ) ;
/******/
/******/ /* webpack/runtime/hasOwnProperty shorthand */
/******/ ( ( ) => {
/******/ _ _webpack _require _ _ . o = ( obj , prop ) => ( Object . prototype . hasOwnProperty . call ( obj , prop ) )
/******/ } ) ( ) ;
/******/
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
/************************************************************************/
var _ _webpack _exports _ _ = { } ;
2024-09-30 01:11:31 -04:00
// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
( ( ) => {
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
// EXPORTS
_ _webpack _require _ _ . d ( _ _webpack _exports _ _ , {
2024-02-15 11:53:15 -05:00
o : ( ) => ( /* binding */ actions ) ,
w : ( ) => ( /* binding */ state )
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-01-31 07:59:56 -05:00
; // CONCATENATED MODULE: external "@wordpress/interactivity"
2024-02-15 11:53:15 -05:00
var x = ( y ) => {
var x = { } ; _ _webpack _require _ _ . d ( x , y ) ; return x
}
var y = ( x ) => ( ( ) => ( x ) )
const interactivity _namespaceObject = x ( { [ "getConfig" ] : ( ) => ( _ _WEBPACK _EXTERNAL _MODULE _ _wordpress _interactivity _8e89b257 _ _ . getConfig ) , [ "privateApis" ] : ( ) => ( _ _WEBPACK _EXTERNAL _MODULE _ _wordpress _interactivity _8e89b257 _ _ . privateApis ) , [ "store" ] : ( ) => ( _ _WEBPACK _EXTERNAL _MODULE _ _wordpress _interactivity _8e89b257 _ _ . store ) } ) ;
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: ./node_modules/@wordpress/interactivity-router/build-module/index.js
2024-05-23 15:39:28 -04:00
var _getConfig$navigation ;
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
/ * *
* WordPress dependencies
* /
2024-05-23 15:39:28 -04:00
/ * *
* Internal dependencies
* /
2024-02-09 13:22:22 -05:00
const {
directivePrefix ,
getRegionRootFragment ,
initialVdom ,
toVdom ,
2024-02-27 09:48:23 -05:00
render ,
2024-09-19 21:55:35 -04:00
parseServerData ,
populateServerData ,
2024-02-27 09:48:23 -05:00
batch
2024-02-09 13:22:22 -05:00
} = ( 0 , interactivity _namespaceObject . privateApis ) ( 'I acknowledge that using private APIs means my theme or plugin will inevitably break in the next version of WordPress.' ) ;
2024-05-23 15:39:28 -04:00
// Check if the navigation mode is full page or region based.
const navigationMode = ( _getConfig$navigation = ( 0 , interactivity _namespaceObject . getConfig ) ( 'core/router' ) . navigationMode ) !== null && _getConfig$navigation !== void 0 ? _getConfig$navigation : 'regionBased' ;
// The cache of visited and prefetched pages, stylesheets and scripts.
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 pages = new Map ( ) ;
2024-05-23 15:39:28 -04:00
const headElements = new Map ( ) ;
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
// Helper to remove domain and hash from the URL. We are only interesting in
// caching the path and the query.
2024-02-09 13:22:22 -05:00
const getPagePath = url => {
2024-05-31 14:59:00 -04:00
const u = new URL ( url , window . location . href ) ;
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
return u . pathname + u . search ;
} ;
// Fetch a new page and convert it to a static virtual DOM.
const fetchPage = async ( url , {
html
} ) => {
try {
if ( ! html ) {
const res = await window . fetch ( url ) ;
2024-05-23 15:39:28 -04:00
if ( res . status !== 200 ) {
return false ;
}
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
html = await res . text ( ) ;
}
const dom = new window . DOMParser ( ) . parseFromString ( html , 'text/html' ) ;
return regionsToVdom ( dom ) ;
} catch ( e ) {
return false ;
}
} ;
// Return an object with VDOM trees of those HTML regions marked with a
// `router-region` directive.
2024-05-23 15:39:28 -04:00
const regionsToVdom = async ( dom , {
2024-02-09 13:22:22 -05:00
vdom
} = { } ) => {
2024-05-31 14:59:00 -04:00
const regions = {
body : undefined
} ;
2024-05-23 15:39:28 -04:00
let head ;
if ( false ) { }
if ( navigationMode === 'regionBased' ) {
const attrName = ` data- ${ directivePrefix } -router-region ` ;
dom . querySelectorAll ( ` [ ${ attrName } ] ` ) . forEach ( region => {
const id = region . getAttribute ( attrName ) ;
regions [ id ] = vdom ? . has ( region ) ? vdom . get ( region ) : toVdom ( region ) ;
} ) ;
}
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 title = dom . querySelector ( 'title' ) ? . innerText ;
2024-09-19 21:55:35 -04:00
const initialData = parseServerData ( dom ) ;
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
return {
regions ,
2024-05-23 15:39:28 -04:00
head ,
2024-02-27 09:48:23 -05:00
title ,
initialData
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
} ;
} ;
// Render all interactive regions contained in the given page.
const renderRegions = page => {
2024-02-27 09:48:23 -05:00
batch ( ( ) => {
2024-05-23 15:39:28 -04:00
if ( false ) { }
if ( navigationMode === 'regionBased' ) {
2024-09-19 21:55:35 -04:00
populateServerData ( page . initialData ) ;
2024-05-23 15:39:28 -04:00
const attrName = ` data- ${ directivePrefix } -router-region ` ;
document . querySelectorAll ( ` [ ${ attrName } ] ` ) . forEach ( region => {
const id = region . getAttribute ( attrName ) ;
const fragment = getRegionRootFragment ( region ) ;
render ( page . regions [ id ] , fragment ) ;
} ) ;
}
2024-02-27 09:48:23 -05:00
if ( page . title ) {
document . title = page . title ;
}
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-02-09 13:22:22 -05:00
/ * *
* Load the given page forcing a full page reload .
*
* The function returns a promise that won ' t resolve , useful to prevent any
* potential feedback indicating that the navigation has finished while the new
* page is being loaded .
*
2024-05-31 14:59:00 -04:00
* @ param href The page href .
* @ return Promise that never resolves .
2024-02-09 13:22:22 -05:00
* /
const forcePageReload = href => {
window . location . assign ( href ) ;
return new Promise ( ( ) => { } ) ;
} ;
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
// Listen to the back and forward buttons and restore the page if it's in the
// cache.
window . addEventListener ( 'popstate' , async ( ) => {
2024-05-31 14:59:00 -04:00
const pagePath = getPagePath ( window . location . href ) ; // Remove hash.
2024-02-09 13:22:22 -05:00
const page = pages . has ( pagePath ) && ( await pages . get ( pagePath ) ) ;
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 ( page ) {
renderRegions ( page ) ;
2024-02-09 13:22:22 -05:00
// Update the URL in the state.
state . url = window . location . href ;
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
} else {
window . location . reload ( ) ;
}
} ) ;
2024-05-23 15:39:28 -04:00
// Initialize the router and cache the initial page using the initial vDOM.
2024-05-31 14:59:00 -04:00
// Once this code is tested and more mature, the head should be updated for
// region based navigation as well.
2024-05-23 15:39:28 -04:00
if ( false ) { }
2024-05-31 14:59:00 -04:00
pages . set ( getPagePath ( window . location . href ) , Promise . resolve ( regionsToVdom ( document , {
2024-02-09 13:22:22 -05:00
vdom : initialVdom
} ) ) ) ;
2024-05-23 15:39:28 -04:00
// Check if the link is valid for client-side navigation.
const isValidLink = ref => ref && ref instanceof window . HTMLAnchorElement && ref . href && ( ! ref . target || ref . target === '_self' ) && ref . origin === window . location . origin && ! ref . pathname . startsWith ( '/wp-admin' ) && ! ref . pathname . startsWith ( '/wp-login.php' ) && ! ref . getAttribute ( 'href' ) . startsWith ( '#' ) && ! new URL ( ref . href ) . searchParams . has ( '_wpnonce' ) ;
// Check if the event is valid for client-side navigation.
const isValidEvent = event => event && event . button === 0 &&
// Left clicks only.
! event . metaKey &&
// Open in new tab (Mac).
! event . ctrlKey &&
// Open in new tab (Windows).
! event . altKey &&
// Download.
! event . shiftKey && ! event . defaultPrevented ;
2024-02-09 13:22:22 -05:00
// Variable to store the current navigation.
let navigatingTo = '' ;
2024-09-19 21:55:35 -04:00
let hasLoadedNavigationTextsData = false ;
const navigationTexts = {
loading : 'Loading page, please wait.' ,
loaded : 'Page Loaded.'
} ;
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 {
state ,
actions
2024-01-31 07:59:56 -05:00
} = ( 0 , interactivity _namespaceObject . store ) ( 'core/router' , {
2024-02-09 13:22:22 -05:00
state : {
url : window . location . href ,
navigation : {
hasStarted : false ,
2024-09-30 01:11:31 -04:00
hasFinished : false
2024-02-09 13:22:22 -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
actions : {
/ * *
* Navigates to the specified page .
*
* This function normalizes the passed href , fetchs the page HTML if
* needed , and updates any interactive regions whose contents have
* changed . It also creates a new entry in the browser session history .
*
2024-05-31 14:59:00 -04:00
* @ param href The page href .
* @ param [ options ] Options object .
* @ param [ options . force ] If true , it forces re - fetching the URL .
* @ param [ options . html ] HTML string to be used instead of fetching the requested URL .
* @ param [ options . replace ] If true , it replaces the current entry in the browser session history .
* @ param [ options . timeout ] Time until the navigation is aborted , in milliseconds . Default is 10000.
* @ param [ options . loadingAnimation ] Whether an animation should be shown while navigating . Default to ` true ` .
* @ param [ options . screenReaderAnnouncement ] Whether a message for screen readers should be announced while navigating . Default to ` true ` .
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 Promise that resolves once the navigation is completed or aborted .
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
* /
* navigate ( href , options = { } ) {
2024-02-09 13:22:22 -05:00
const {
clientNavigationDisabled
} = ( 0 , interactivity _namespaceObject . getConfig ) ( ) ;
if ( clientNavigationDisabled ) {
yield forcePageReload ( href ) ;
}
const pagePath = getPagePath ( href ) ;
const {
navigation
} = state ;
const {
loadingAnimation = true ,
screenReaderAnnouncement = true ,
timeout = 10000
} = options ;
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
navigatingTo = href ;
2024-02-09 13:22:22 -05:00
actions . prefetch ( pagePath , options ) ;
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
// Create a promise that resolves when the specified timeout ends.
// The timeout value is 10 seconds by default.
2024-02-09 13:22:22 -05:00
const timeoutPromise = new Promise ( resolve => setTimeout ( resolve , timeout ) ) ;
// Don't update the navigation status immediately, wait 400 ms.
const loadingTimeout = setTimeout ( ( ) => {
2024-05-23 15:39:28 -04:00
if ( navigatingTo !== href ) {
return ;
}
2024-02-09 13:22:22 -05:00
if ( loadingAnimation ) {
navigation . hasStarted = true ;
navigation . hasFinished = false ;
}
if ( screenReaderAnnouncement ) {
2024-09-19 21:55:35 -04:00
a11ySpeak ( 'loading' ) ;
2024-02-09 13:22:22 -05:00
}
} , 400 ) ;
const page = yield Promise . race ( [ pages . get ( pagePath ) , timeoutPromise ] ) ;
// Dismiss loading message if it hasn't been added yet.
clearTimeout ( loadingTimeout ) ;
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
// Once the page is fetched, the destination URL could have changed
// (e.g., by clicking another link in the meantime). If so, bail
// out, and let the newer execution to update the HTML.
2024-05-23 15:39:28 -04:00
if ( navigatingTo !== href ) {
return ;
}
2024-02-27 09:48:23 -05:00
if ( page && ! page . initialData ? . config ? . [ 'core/router' ] ? . clientNavigationDisabled ) {
2024-05-23 15:39:28 -04:00
yield renderRegions ( page ) ;
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
window . history [ options . replace ? 'replaceState' : 'pushState' ] ( { } , '' , href ) ;
2024-02-09 13:22:22 -05:00
// Update the URL in the state.
state . url = href ;
// Update the navigation status once the the new page rendering
// has been completed.
if ( loadingAnimation ) {
navigation . hasStarted = false ;
navigation . hasFinished = true ;
}
if ( screenReaderAnnouncement ) {
2024-09-19 21:55:35 -04:00
a11ySpeak ( 'loaded' ) ;
2024-02-09 13:22:22 -05:00
}
2024-05-23 15:39:28 -04:00
// Scroll to the anchor if exits in the link.
const {
hash
2024-05-31 14:59:00 -04:00
} = new URL ( href , window . location . href ) ;
2024-05-23 15:39:28 -04:00
if ( hash ) {
document . querySelector ( hash ) ? . scrollIntoView ( ) ;
}
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
} else {
2024-02-09 13:22:22 -05:00
yield forcePageReload ( href ) ;
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
}
} ,
/ * *
* Prefetchs the page with the passed URL .
*
* The function normalizes the URL and stores internally the fetch
* promise , to avoid triggering a second fetch for an ongoing request .
*
2024-05-31 14:59:00 -04:00
* @ param url The page URL .
* @ param [ options ] Options object .
* @ param [ options . force ] Force fetching the URL again .
* @ param [ options . html ] HTML string to be used instead of fetching the requested URL .
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
* /
prefetch ( url , options = { } ) {
2024-02-09 13:22:22 -05:00
const {
clientNavigationDisabled
} = ( 0 , interactivity _namespaceObject . getConfig ) ( ) ;
2024-05-23 15:39:28 -04:00
if ( clientNavigationDisabled ) {
return ;
}
2024-02-09 13:22:22 -05:00
const pagePath = getPagePath ( url ) ;
if ( options . force || ! pages . has ( pagePath ) ) {
2024-05-31 14:59:00 -04:00
pages . set ( pagePath , fetchPage ( pagePath , {
html : options . html
} ) ) ;
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-09-19 21:55:35 -04:00
/ * *
* Announces a message to screen readers .
*
* This is a wrapper around the ` @wordpress/a11y ` package ' s ` speak ` function . It handles importing
* the package on demand and should be used instead of calling ` ally.speak ` direacly .
*
* @ param messageKey The message to be announced by assistive technologies .
* /
function a11ySpeak ( messageKey ) {
if ( ! hasLoadedNavigationTextsData ) {
hasLoadedNavigationTextsData = true ;
const content = document . getElementById ( 'wp-script-module-data-@wordpress/interactivity-router' ) ? . textContent ;
if ( content ) {
try {
const parsed = JSON . parse ( content ) ;
if ( typeof parsed ? . i18n ? . loading === 'string' ) {
navigationTexts . loading = parsed . i18n . loading ;
}
if ( typeof parsed ? . i18n ? . loaded === 'string' ) {
navigationTexts . loaded = parsed . i18n . loaded ;
}
} catch { }
} else {
// Fallback to localized strings from Interactivity API state.
2024-09-30 01:11:31 -04:00
// @todo This block is for Core < 6.7.0. Remove when support is dropped.
// @ts-expect-error
2024-09-19 21:55:35 -04:00
if ( state . navigation . texts ? . loading ) {
2024-09-30 01:11:31 -04:00
// @ts-expect-error
2024-09-19 21:55:35 -04:00
navigationTexts . loading = state . navigation . texts . loading ;
}
2024-09-30 01:11:31 -04:00
// @ts-expect-error
2024-09-19 21:55:35 -04:00
if ( state . navigation . texts ? . loaded ) {
2024-09-30 01:11:31 -04:00
// @ts-expect-error
2024-09-19 21:55:35 -04:00
navigationTexts . loaded = state . navigation . texts . loaded ;
}
}
}
const message = navigationTexts [ messageKey ] ;
2024-09-30 01:11:31 -04:00
Promise . resolve ( /* import() */ ) . then ( _ _webpack _require _ _ . bind ( _ _webpack _require _ _ , 317 ) ) . then ( ( {
speak
} ) => speak ( message ) ,
// Ignore failures to load the a11y module.
( ) => { } ) ;
2024-09-19 21:55:35 -04:00
}
2024-05-23 15:39:28 -04:00
// Add click and prefetch to all links.
if ( false ) { }
2024-09-30 01:11:31 -04:00
} ) ( ) ;
2024-02-15 11:53:15 -05:00
var _ _webpack _exports _ _actions = _ _webpack _exports _ _ . o ;
var _ _webpack _exports _ _state = _ _webpack _exports _ _ . w ;
2024-01-31 07:59:56 -05:00
export { _ _webpack _exports _ _actions as actions , _ _webpack _exports _ _state as state } ;