mirror of
https://github.com/WordPress/WordPress.git
synced 2024-10-31 07:49:38 +01:00
1fbf5fa51d
Updates the editor npm packages to latest versions. See https://github.com/WordPress/wordpress-develop/pull/6612. Props ellatrix, mukesh27, youknowriad, mamaduka. Built from https://develop.svn.wordpress.org/trunk@58187 git-svn-id: http://core.svn.wordpress.org/trunk@57650 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2 lines
2.9 KiB
JavaScript
2 lines
2.9 KiB
JavaScript
/*! This file is auto-generated */
|
||
import*as e from"@wordpress/interactivity";var t={d:(e,i)=>{for(var o in i)t.o(i,o)&&!t.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:i[o]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)},i={};t.d(i,{o:()=>x,w:()=>b});const o=(e=>{var i={};return t.d(i,e),i})({getConfig:()=>e.getConfig,privateApis:()=>e.privateApis,store:()=>e.store});var n;const{directivePrefix:a,getRegionRootFragment:r,initialVdom:s,toVdom:c,render:l,parseInitialData:d,populateInitialData:g,batch:w}=(0,o.privateApis)("I acknowledge that using private APIs means my theme or plugin will inevitably break in the next version of WordPress."),u=null!==(n=(0,o.getConfig)("core/router").navigationMode)&&void 0!==n?n:"regionBased",h=new Map,m=(new Map,e=>{const t=new URL(e,window.location);return t.pathname+t.search}),p=async(e,{vdom:t}={})=>{const i={};if("regionBased"===u){const o=`data-${a}-router-region`;e.querySelectorAll(`[${o}]`).forEach((e=>{const n=e.getAttribute(o);i[n]=t?.has(e)?t.get(e):c(e)}))}const o=e.querySelector("title")?.innerText,n=d(e);return{regions:i,head:undefined,title:o,initialData:n}},f=e=>{w((()=>{if("regionBased"===u){g(e.initialData);const t=`data-${a}-router-region`;document.querySelectorAll(`[${t}]`).forEach((i=>{const o=i.getAttribute(t),n=r(i);l(e.regions[o],n)}))}e.title&&(document.title=e.title)}))},v=e=>(window.location.assign(e),new Promise((()=>{})));window.addEventListener("popstate",(async()=>{const e=m(window.location),t=h.has(e)&&await h.get(e);t?(f(t),b.url=window.location.href):window.location.reload()})),h.set(m(window.location),Promise.resolve(p(document,{vdom:s})));let y="";const{state:b,actions:x}=(0,o.store)("core/router",{state:{url:window.location.href,navigation:{hasStarted:!1,hasFinished:!1,texts:{}}},actions:{*navigate(e,t={}){const{clientNavigationDisabled:i}=(0,o.getConfig)();i&&(yield v(e));const n=m(e),{navigation:a}=b,{loadingAnimation:r=!0,screenReaderAnnouncement:s=!0,timeout:c=1e4}=t;y=e,x.prefetch(n,t);const l=new Promise((e=>setTimeout(e,c))),d=setTimeout((()=>{y===e&&(r&&(a.hasStarted=!0,a.hasFinished=!1),s&&(a.message=a.texts.loading))}),400),g=yield Promise.race([h.get(n),l]);if(clearTimeout(d),y===e)if(g&&!g.initialData?.config?.["core/router"]?.clientNavigationDisabled){yield f(g),window.history[t.replace?"replaceState":"pushState"]({},"",e),b.url=e,r&&(a.hasStarted=!1,a.hasFinished=!0),s&&(a.message=a.texts.loaded+(a.message===a.texts.loaded?" ":""));const{hash:i}=new URL(e,window.location);i&&document.querySelector(i)?.scrollIntoView()}else yield v(e)},prefetch(e,t={}){const{clientNavigationDisabled:i}=(0,o.getConfig)();if(i)return;const n=m(e);!t.force&&h.has(n)||h.set(n,(async(e,{html:t})=>{try{if(!t){const i=await window.fetch(e);if(200!==i.status)return!1;t=await i.text()}const i=(new window.DOMParser).parseFromString(t,"text/html");return p(i)}catch(e){return!1}})(n,t))}}});var A=i.o,P=i.w;export{A as actions,P as state}; |