mirror of
https://github.com/WordPress/WordPress.git
synced 2024-11-08 11:50:03 +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
4.2 KiB
JavaScript
2 lines
4.2 KiB
JavaScript
/*! This file is auto-generated */
|
|
(()=>{"use strict";var e={d:(t,n)=>{for(var r in n)e.o(n,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:n[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{privateApis:()=>E});const n=window.React,r=window.wp.element;function o(){return o=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},o.apply(this,arguments)}var a;!function(e){e.Pop="POP",e.Push="PUSH",e.Replace="REPLACE"}(a||(a={}));var u=function(e){return e};var i="beforeunload",c="popstate";function s(e){e.preventDefault(),e.returnValue=""}function l(){var e=[];return{get length(){return e.length},push:function(t){return e.push(t),function(){e=e.filter((function(e){return e!==t}))}},call:function(t){e.forEach((function(e){return e&&e(t)}))}}}function f(){return Math.random().toString(36).substr(2,8)}function p(e){var t=e.pathname,n=void 0===t?"/":t,r=e.search,o=void 0===r?"":r,a=e.hash,u=void 0===a?"":a;return o&&"?"!==o&&(n+="?"===o.charAt(0)?o:"?"+o),u&&"#"!==u&&(n+="#"===u.charAt(0)?u:"#"+u),n}function h(e){var t={};if(e){var n=e.indexOf("#");n>=0&&(t.hash=e.substr(n),e=e.substr(0,n));var r=e.indexOf("?");r>=0&&(t.search=e.substr(r),e=e.substr(0,r)),e&&(t.pathname=e)}return t}const v=window.wp.url,d=function(e){void 0===e&&(e={});var t=e.window,n=void 0===t?document.defaultView:t,r=n.history;function v(){var e=n.location,t=e.pathname,o=e.search,a=e.hash,i=r.state||{};return[i.idx,u({pathname:t,search:o,hash:a,state:i.usr||null,key:i.key||"default"})]}var d=null;n.addEventListener(c,(function(){if(d)P.call(d),d=null;else{var e=a.Pop,t=v(),n=t[0],r=t[1];if(P.length){if(null!=n){var o=g-n;o&&(d={action:e,location:r,retry:function(){_(-1*o)}},_(o))}}else E(e)}}));var w=a.Pop,y=v(),g=y[0],b=y[1],m=l(),P=l();function O(e){return"string"==typeof e?e:p(e)}function S(e,t){return void 0===t&&(t=null),u(o({pathname:b.pathname,hash:"",search:""},"string"==typeof e?h(e):e,{state:t,key:f()}))}function k(e,t){return[{usr:e.state,key:e.key,idx:t},O(e)]}function x(e,t,n){return!P.length||(P.call({action:e,location:t,retry:n}),!1)}function E(e){w=e;var t=v();g=t[0],b=t[1],m.call({action:w,location:b})}function _(e){r.go(e)}null==g&&(g=0,r.replaceState(o({},r.state,{idx:g}),""));var j={get action(){return w},get location(){return b},createHref:O,push:function e(t,o){var u=a.Push,i=S(t,o);if(x(u,i,(function(){e(t,o)}))){var c=k(i,g+1),s=c[0],l=c[1];try{r.pushState(s,"",l)}catch(e){n.location.assign(l)}E(u)}},replace:function e(t,n){var o=a.Replace,u=S(t,n);if(x(o,u,(function(){e(t,n)}))){var i=k(u,g),c=i[0],s=i[1];r.replaceState(c,"",s),E(o)}},go:_,back:function(){_(-1)},forward:function(){_(1)},listen:function(e){return m.push(e)},block:function(e){var t=P.push(e);return 1===P.length&&n.addEventListener(i,s),function(){t(),P.length||n.removeEventListener(i,s)}}};return j}(),w=d.push,y=d.replace;function g(e){if(e.hasOwnProperty("wp_theme_preview"))return e;const t=new URLSearchParams(d.location.search).get("wp_theme_preview");return null===t?e:{...e,wp_theme_preview:t}}d.push=function(e,t){const n=(0,v.buildQueryString)(g(e));return w.call(d,{search:n},t)},d.replace=function(e,t){const n=(0,v.buildQueryString)(g(e));return y.call(d,{search:n},t)};const b=d,m=(0,r.createContext)(),P=(0,r.createContext)();function O(e){const t=new URLSearchParams(e.search);return{...e,params:Object.fromEntries(t.entries())}}const S=window.wp.privateApis,{lock:k,unlock:x}=(0,S.__dangerousOptInToUnstableAPIsOnlyForCoreModules)("I know using unstable features means my theme or plugin will inevitably break in the next version of WordPress.","@wordpress/router"),E={};k(E,{useHistory:function(){return(0,r.useContext)(P)},useLocation:function(){return(0,r.useContext)(m)},RouterProvider:function({children:e}){const[t,o]=(0,r.useState)((()=>O(b.location)));return(0,r.useEffect)((()=>b.listen((({location:e})=>{o(O(e))}))),[]),(0,n.createElement)(P.Provider,{value:b},(0,n.createElement)(m.Provider,{value:t},e))}}),(window.wp=window.wp||{}).router=t})(); |