2024-01-31 13:59:56 +01:00
import * as _ _WEBPACK _EXTERNAL _MODULE _ _wordpress _interactivity _8e89b257 _ _ from "@wordpress/interactivity" ;
/******/ // The require scope
/******/ var _ _webpack _require _ _ = { } ;
/******/
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 22:07:12 +01:00
/************************************************************************/
2024-01-31 13:59:56 +01: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 22:07:12 +01:00
/******/ }
2024-01-31 13:59:56 +01: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 22:07:12 +01:00
/************************************************************************/
var _ _webpack _exports _ _ = { } ;
// EXPORTS
_ _webpack _require _ _ . d ( _ _webpack _exports _ _ , {
2024-02-15 17:53:15 +01: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 22:07:12 +01:00
} ) ;
2024-01-31 13:59:56 +01:00
; // CONCATENATED MODULE: external "@wordpress/interactivity"
2024-02-15 17:53:15 +01: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 22:07:12 +01:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/interactivity-router/build-module/index.js
2024-05-23 21:39:28 +02: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 22:07:12 +01:00
/ * *
* WordPress dependencies
* /
2024-05-23 21:39:28 +02:00
/ * *
* Internal dependencies
* /
2024-02-09 19:22:22 +01:00
const {
directivePrefix ,
getRegionRootFragment ,
initialVdom ,
toVdom ,
2024-02-27 15:48:23 +01:00
render ,
parseInitialData ,
populateInitialData ,
batch
2024-02-09 19:22:22 +01: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 21:39:28 +02: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 22:07:12 +01:00
const pages = new Map ( ) ;
2024-05-23 21:39:28 +02: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 22:07:12 +01:00
// Helper to remove domain and hash from the URL. We are only interesting in
// caching the path and the query.
2024-02-09 19:22:22 +01:00
const getPagePath = url => {
2024-05-31 20:59:00 +02: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 22:07:12 +01: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 21:39:28 +02: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 22:07:12 +01: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 21:39:28 +02:00
const regionsToVdom = async ( dom , {
2024-02-09 19:22:22 +01:00
vdom
} = { } ) => {
2024-05-31 20:59:00 +02:00
const regions = {
body : undefined
} ;
2024-05-23 21:39:28 +02: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 22:07:12 +01:00
const title = dom . querySelector ( 'title' ) ? . innerText ;
2024-02-27 15:48:23 +01:00
const initialData = parseInitialData ( 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 22:07:12 +01:00
return {
regions ,
2024-05-23 21:39:28 +02:00
head ,
2024-02-27 15:48:23 +01: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 22:07:12 +01:00
} ;
} ;
// Render all interactive regions contained in the given page.
const renderRegions = page => {
2024-02-27 15:48:23 +01:00
batch ( ( ) => {
2024-05-23 21:39:28 +02:00
if ( false ) { }
if ( navigationMode === 'regionBased' ) {
populateInitialData ( page . initialData ) ;
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 15:48:23 +01: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 22:07:12 +01:00
} ) ;
} ;
2024-02-09 19:22:22 +01: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 20:59:00 +02:00
* @ param href The page href .
* @ return Promise that never resolves .
2024-02-09 19:22:22 +01: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 22:07:12 +01: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 20:59:00 +02:00
const pagePath = getPagePath ( window . location . href ) ; // Remove hash.
2024-02-09 19:22:22 +01: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 22:07:12 +01:00
if ( page ) {
renderRegions ( page ) ;
2024-02-09 19:22:22 +01: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 22:07:12 +01:00
} else {
window . location . reload ( ) ;
}
} ) ;
2024-05-23 21:39:28 +02:00
// Initialize the router and cache the initial page using the initial vDOM.
2024-05-31 20:59:00 +02:00
// Once this code is tested and more mature, the head should be updated for
// region based navigation as well.
2024-05-23 21:39:28 +02:00
if ( false ) { }
2024-05-31 20:59:00 +02:00
pages . set ( getPagePath ( window . location . href ) , Promise . resolve ( regionsToVdom ( document , {
2024-02-09 19:22:22 +01:00
vdom : initialVdom
} ) ) ) ;
2024-05-23 21:39:28 +02: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 19:22:22 +01:00
// Variable to store the current navigation.
let navigatingTo = '' ;
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 22:07:12 +01:00
const {
state ,
actions
2024-01-31 13:59:56 +01:00
} = ( 0 , interactivity _namespaceObject . store ) ( 'core/router' , {
2024-02-09 19:22:22 +01:00
state : {
url : window . location . href ,
navigation : {
hasStarted : false ,
hasFinished : false ,
2024-05-31 20:59:00 +02:00
texts : {
loading : '' ,
loaded : ''
} ,
message : ''
2024-02-09 19:22:22 +01: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 22:07:12 +01: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 20:59:00 +02: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 22:07:12 +01:00
*
2024-05-31 20:59:00 +02: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 22:07:12 +01:00
* /
* navigate ( href , options = { } ) {
2024-02-09 19:22:22 +01: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 22:07:12 +01:00
navigatingTo = href ;
2024-02-09 19:22:22 +01: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 22:07:12 +01:00
// Create a promise that resolves when the specified timeout ends.
// The timeout value is 10 seconds by default.
2024-02-09 19:22:22 +01: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 21:39:28 +02:00
if ( navigatingTo !== href ) {
return ;
}
2024-02-09 19:22:22 +01:00
if ( loadingAnimation ) {
navigation . hasStarted = true ;
navigation . hasFinished = false ;
}
if ( screenReaderAnnouncement ) {
navigation . message = navigation . texts . loading ;
}
} , 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 22:07:12 +01: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 21:39:28 +02:00
if ( navigatingTo !== href ) {
return ;
}
2024-02-27 15:48:23 +01:00
if ( page && ! page . initialData ? . config ? . [ 'core/router' ] ? . clientNavigationDisabled ) {
2024-05-23 21:39:28 +02: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 22:07:12 +01:00
window . history [ options . replace ? 'replaceState' : 'pushState' ] ( { } , '' , href ) ;
2024-02-09 19:22:22 +01: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 ) {
// Announce that the page has been loaded. If the message is the
// same, we use a no-break space similar to the @wordpress/a11y
// package: https://github.com/WordPress/gutenberg/blob/c395242b8e6ee20f8b06c199e4fc2920d7018af1/packages/a11y/src/filter-message.js#L20-L26
navigation . message = navigation . texts . loaded + ( navigation . message === navigation . texts . loaded ? '\u00A0' : '' ) ;
}
2024-05-23 21:39:28 +02:00
// Scroll to the anchor if exits in the link.
const {
hash
2024-05-31 20:59:00 +02:00
} = new URL ( href , window . location . href ) ;
2024-05-23 21:39:28 +02: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 22:07:12 +01:00
} else {
2024-02-09 19:22:22 +01: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 22:07:12 +01: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 20:59:00 +02: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 22:07:12 +01:00
* /
prefetch ( url , options = { } ) {
2024-02-09 19:22:22 +01:00
const {
clientNavigationDisabled
} = ( 0 , interactivity _namespaceObject . getConfig ) ( ) ;
2024-05-23 21:39:28 +02:00
if ( clientNavigationDisabled ) {
return ;
}
2024-02-09 19:22:22 +01:00
const pagePath = getPagePath ( url ) ;
if ( options . force || ! pages . has ( pagePath ) ) {
2024-05-31 20:59:00 +02: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 22:07:12 +01:00
}
}
}
} ) ;
2024-05-23 21:39:28 +02:00
// Add click and prefetch to all links.
if ( false ) { }
2024-02-15 17:53:15 +01:00
var _ _webpack _exports _ _actions = _ _webpack _exports _ _ . o ;
var _ _webpack _exports _ _state = _ _webpack _exports _ _ . w ;
2024-01-31 13:59:56 +01:00
export { _ _webpack _exports _ _actions as actions , _ _webpack _exports _ _state as state } ;