mirror of
https://github.com/WordPress/WordPress.git
synced 2024-11-05 10:22:23 +01:00
9aaa49f5a7
It brings with a set of iterations and follow-ups to the initial package update. It also fixes a regression that happened for interactive blocks. Props gziolo, luisherranz, cbravobernal. See #60315. Built from https://develop.svn.wordpress.org/trunk@57499 git-svn-id: http://core.svn.wordpress.org/trunk@57000 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2 lines
1.8 KiB
JavaScript
2 lines
1.8 KiB
JavaScript
/*! This file is auto-generated */
|
|
import*as e from"@wordpress/interactivity";var t={d:(e,r)=>{for(var o in r)t.o(r,o)&&!t.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:r[o]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)},r={};t.d(r,{N:()=>l,S:()=>d});const o=(e=>{var r={};return t.d(r,e),r})({directivePrefix:()=>e.directivePrefix,getRegionRootFragment:()=>e.getRegionRootFragment,render:()=>e.render,store:()=>e.store,toVdom:()=>e.toVdom}),n=new Map,i=e=>{const t=new URL(e,window.location);return t.pathname+t.search},a=e=>{const t={},r=`data-${o.directivePrefix}-router-region`;e.querySelectorAll(`[${r}]`).forEach((e=>{const n=e.getAttribute(r);t[n]=(0,o.toVdom)(e)}));const n=e.querySelector("title")?.innerText;return{regions:t,title:n}},s=e=>{const t=`data-${o.directivePrefix}-router-region`;document.querySelectorAll(`[${t}]`).forEach((r=>{const n=r.getAttribute(t),i=(0,o.getRegionRootFragment)(r);(0,o.render)(e.regions[n],i)})),e.title&&(document.title=e.title)};let c="";window.addEventListener("popstate",(async()=>{const e=i(window.location),t=n.has(e)&&await n.get(e);t?s(t):window.location.reload()})),n.set(i(window.location),Promise.resolve(a(document)));const{state:d,actions:l}=(0,o.store)("core/router",{actions:{*navigate(e,t={}){const r=i(e);c=e,l.prefetch(r,t);const o=new Promise((e=>{var r;return setTimeout(e,null!==(r=t.timeout)&&void 0!==r?r:1e4)})),a=yield Promise.race([n.get(r),o]);c===e&&(a?(s(a),window.history[t.replace?"replaceState":"pushState"]({},"",e)):(window.location.assign(e),yield new Promise((()=>{}))))},prefetch(e,t={}){e=i(e),!t.force&&n.has(e)||n.set(e,(async(e,{html:t})=>{try{if(!t){const r=await window.fetch(e);if(200!==r.status)return!1;t=await r.text()}const r=(new window.DOMParser).parseFromString(t,"text/html");return a(r)}catch(e){return!1}})(e,t))}}});var w=r.N,u=r.S;export{w as actions,u as state}; |