WordPress/wp-includes/js/dist/router.min.js
youknowriad 1de40f71be 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 21:07:12 +00:00

2 lines
4.3 KiB
JavaScript

/*! This file is auto-generated */
!function(){"use strict";var e={d:function(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:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r:function(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:function(){return S}});var n,r=window.React,o=window.wp.element;function a(){return a=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},a.apply(this,arguments)}!function(e){e.Pop="POP",e.Push="PUSH",e.Replace="REPLACE"}(n||(n={}));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 h(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 d(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}var p=window.wp.url;const v=function(e){void 0===e&&(e={});var t=e.window,r=void 0===t?document.defaultView:t,o=r.history;function p(){var e=r.location,t=e.pathname,n=e.search,a=e.hash,i=o.state||{};return[i.idx,u({pathname:t,search:n,hash:a,state:i.usr||null,key:i.key||"default"})]}var v=null;r.addEventListener(c,(function(){if(v)P.call(v),v=null;else{var e=n.Pop,t=p(),r=t[0],o=t[1];if(P.length){if(null!=r){var a=g-r;a&&(v={action:e,location:o,retry:function(){x(-1*a)}},x(a))}}else j(e)}}));var w=n.Pop,y=p(),g=y[0],b=y[1],m=l(),P=l();function O(e){return"string"==typeof e?e:h(e)}function k(e,t){return void 0===t&&(t=null),u(a({pathname:b.pathname,hash:"",search:""},"string"==typeof e?d(e):e,{state:t,key:f()}))}function A(e,t){return[{usr:e.state,key:e.key,idx:t},O(e)]}function S(e,t,n){return!P.length||(P.call({action:e,location:t,retry:n}),!1)}function j(e){w=e;var t=p();g=t[0],b=t[1],m.call({action:w,location:b})}function x(e){o.go(e)}null==g&&(g=0,o.replaceState(a({},o.state,{idx:g}),""));var E={get action(){return w},get location(){return b},createHref:O,push:function e(t,a){var u=n.Push,i=k(t,a);if(S(u,i,(function(){e(t,a)}))){var c=A(i,g+1),s=c[0],l=c[1];try{o.pushState(s,"",l)}catch(e){r.location.assign(l)}j(u)}},replace:function e(t,r){var a=n.Replace,u=k(t,r);if(S(a,u,(function(){e(t,r)}))){var i=A(u,g),c=i[0],s=i[1];o.replaceState(c,"",s),j(a)}},go:x,back:function(){x(-1)},forward:function(){x(1)},listen:function(e){return m.push(e)},block:function(e){var t=P.push(e);return 1===P.length&&r.addEventListener(i,s),function(){t(),P.length||r.removeEventListener(i,s)}}};return E}(),w=v.push,y=v.replace;v.push=function(e,t){const n=(0,p.getQueryArgs)(window.location.href),r=(0,p.removeQueryArgs)(window.location.href,...Object.keys(n)),o=(0,p.addQueryArgs)(r,e);return w.call(v,o,t)},v.replace=function(e,t){const n=(0,p.getQueryArgs)(window.location.href),r=(0,p.removeQueryArgs)(window.location.href,...Object.keys(n)),o=(0,p.addQueryArgs)(r,e);return y.call(v,o,t)};var g=v;const b=(0,o.createContext)(),m=(0,o.createContext)();function P(e){const t=new URLSearchParams(e.search);return{...e,params:Object.fromEntries(t.entries())}}var O=window.wp.privateApis;const{lock:k,unlock:A}=(0,O.__dangerousOptInToUnstableAPIsOnlyForCoreModules)("I know using unstable features means my theme or plugin will inevitably break in the next version of WordPress.","@wordpress/router"),S={};k(S,{useHistory:function(){return(0,o.useContext)(m)},useLocation:function(){return(0,o.useContext)(b)},RouterProvider:function({children:e}){const[t,n]=(0,o.useState)((()=>P(g.location)));return(0,o.useEffect)((()=>g.listen((({location:e})=>{n(P(e))}))),[]),(0,r.createElement)(m.Provider,{value:g},(0,r.createElement)(b.Provider,{value:t},e))}}),(window.wp=window.wp||{}).router=t}();