mirror of
https://github.com/WordPress/WordPress.git
synced 2024-11-04 18:01:42 +01:00
2ec4c366e6
Update webpack version to latest version https://www.npmjs.com/package/webpack. This aligns closer with how the Gutenberg plugin handles WordPress packages. Related update in Gutenberg from August 2021: https://github.com/WordPress/gutenberg/pull/33818. Props walbo, desrosj, mukesh27. Fixes #51750. Built from https://develop.svn.wordpress.org/trunk@53135 git-svn-id: http://core.svn.wordpress.org/trunk@52724 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2 lines
7.1 KiB
JavaScript
2 lines
7.1 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,{store:function(){return W}});var n={};e.r(n),e.d(n,{__experimentalGetAllAnnotationsForBlock:function(){return O},__experimentalGetAnnotations:function(){return R},__experimentalGetAnnotationsForBlock:function(){return b},__experimentalGetAnnotationsForRichText:function(){return I}});var r={};e.r(r),e.d(r,{__experimentalAddAnnotation:function(){return G},__experimentalRemoveAnnotation:function(){return M},__experimentalRemoveAnnotationsBySource:function(){return j},__experimentalUpdateAnnotationRange:function(){return B}});var o=window.wp.richText,a=window.wp.i18n;const i="core/annotations",l="core/annotation",u="annotation-text-";const s={name:l,title:(0,a.__)("Annotation"),tagName:"mark",className:"annotation-text",attributes:{className:"class",id:"id"},edit:()=>null,__experimentalGetPropsForEditableTreePreparation(e,t){let{richTextIdentifier:n,blockClientId:r}=t;return{annotations:e(i).__experimentalGetAnnotationsForRichText(r,n)}},__experimentalCreatePrepareEditableTree(e){let{annotations:t}=e;return(e,n)=>{if(0===t.length)return e;let r={formats:e,text:n};return r=function(e){return(arguments.length>1&&void 0!==arguments[1]?arguments[1]:[]).forEach((t=>{let{start:n,end:r}=t;n>e.text.length&&(n=e.text.length),r>e.text.length&&(r=e.text.length);const a=u+t.source,i=u+t.id;e=(0,o.applyFormat)(e,{type:l,attributes:{className:a,id:i}},n,r)})),e}(r,t),r.formats}},__experimentalGetPropsForEditableTreeChangeHandler:e=>({removeAnnotation:e(i).__experimentalRemoveAnnotation,updateAnnotationRange:e(i).__experimentalUpdateAnnotationRange}),__experimentalCreateOnChangeEditableValue:e=>t=>{const n=function(e){const t={};return e.forEach(((e,n)=>{(e=(e=e||[]).filter((e=>e.type===l))).forEach((e=>{let{id:r}=e.attributes;r=r.replace(u,""),t.hasOwnProperty(r)||(t[r]={start:n}),t[r].end=n+1}))})),t}(t),{removeAnnotation:r,updateAnnotationRange:o,annotations:a}=e;!function(e,t,n){let{removeAnnotation:r,updateAnnotationRange:o}=n;e.forEach((e=>{const n=t[e.id];if(!n)return void r(e.id);const{start:a,end:i}=e;a===n.start&&i===n.end||o(e.id,n.start,n.end)}))}(a,n,{removeAnnotation:r,updateAnnotationRange:o})}},{name:c,...d}=s;(0,o.registerFormatType)(c,d);var p=window.wp.hooks,f=window.wp.data;(0,p.addFilter)("editor.BlockListBlock","core/annotations",(e=>(0,f.withSelect)(((e,t)=>{let{clientId:n,className:r}=t;return{className:e(i).__experimentalGetAnnotationsForBlock(n).map((e=>"is-annotated-by-"+e.source)).concat(r).filter(Boolean).join(" ")}}))(e)));var v=window.lodash;function m(e,t){const n=e.filter(t);return e.length===n.length?e:n}function g(e){return(0,v.isNumber)(e.start)&&(0,v.isNumber)(e.end)&&e.start<=e.end}var h,_,A=function(){var e;let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;switch(n.type){case"ANNOTATION_ADD":const r=n.blockClientId,o={id:n.id,blockClientId:r,richTextIdentifier:n.richTextIdentifier,source:n.source,selector:n.selector,range:n.range};if("range"===o.selector&&!g(o.range))return t;const a=null!==(e=null==t?void 0:t[r])&&void 0!==e?e:[];return{...t,[r]:[...a,o]};case"ANNOTATION_REMOVE":return(0,v.mapValues)(t,(e=>m(e,(e=>e.id!==n.annotationId))));case"ANNOTATION_UPDATE_RANGE":return(0,v.mapValues)(t,(e=>{let t=!1;const r=e.map((e=>e.id===n.annotationId?(t=!0,{...e,range:{start:n.start,end:n.end}}):e));return t?r:e}));case"ANNOTATION_REMOVE_SOURCE":return(0,v.mapValues)(t,(e=>m(e,(e=>e.source!==n.source))))}return t};function y(e){return[e]}function x(){var e={clear:function(){e.head=null}};return e}function N(e,t,n){var r;if(e.length!==t.length)return!1;for(r=n;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}function T(e,t){var n,r;function o(){n=_?new WeakMap:x()}function a(){var n,o,a,i,l,u=arguments.length;for(i=new Array(u),a=0;a<u;a++)i[a]=arguments[a];for(l=t.apply(null,i),(n=r(l)).isUniqueByDependants||(n.lastDependants&&!N(l,n.lastDependants,0)&&n.clear(),n.lastDependants=l),o=n.head;o;){if(N(o.args,i,1))return o!==n.head&&(o.prev.next=o.next,o.next&&(o.next.prev=o.prev),o.next=n.head,o.prev=null,n.head.prev=o,n.head=o),o.val;o=o.next}return o={val:e.apply(null,i)},i[0]=null,o.args=i,n.head&&(n.head.prev=o,o.next=n.head),n.head=o,o.val}return t||(t=y),r=_?function(e){var t,r,o,a,i,l=n,u=!0;for(t=0;t<e.length;t++){if(r=e[t],!(i=r)||"object"!=typeof i){u=!1;break}l.has(r)?l=l.get(r):(o=new WeakMap,l.set(r,o),l=o)}return l.has(h)||((a=x()).isUniqueByDependants=u,l.set(h,a)),l.get(h)}:function(){return n},a.getDependants=t,a.clear=o,o(),a}h={},_="undefined"!=typeof WeakMap;const w=[],b=T(((e,t)=>{var n;return(null!==(n=null==e?void 0:e[t])&&void 0!==n?n:[]).filter((e=>"block"===e.selector))}),((e,t)=>{var n;return[null!==(n=null==e?void 0:e[t])&&void 0!==n?n:w]}));function O(e,t){var n;return null!==(n=null==e?void 0:e[t])&&void 0!==n?n:w}const I=T(((e,t,n)=>{var r;return(null!==(r=null==e?void 0:e[t])&&void 0!==r?r:[]).filter((e=>"range"===e.selector&&n===e.richTextIdentifier)).map((e=>{const{range:t,...n}=e;return{...t,...n}}))}),((e,t)=>{var n;return[null!==(n=null==e?void 0:e[t])&&void 0!==n?n:w]}));function R(e){return(0,v.flatMap)(e,(e=>e))}var E,k=new Uint8Array(16);function C(){if(!E&&!(E="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return E(k)}var D=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;for(var S=function(e){return"string"==typeof e&&D.test(e)},V=[],P=0;P<256;++P)V.push((P+256).toString(16).substr(1));var U=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(V[e[t+0]]+V[e[t+1]]+V[e[t+2]]+V[e[t+3]]+"-"+V[e[t+4]]+V[e[t+5]]+"-"+V[e[t+6]]+V[e[t+7]]+"-"+V[e[t+8]]+V[e[t+9]]+"-"+V[e[t+10]]+V[e[t+11]]+V[e[t+12]]+V[e[t+13]]+V[e[t+14]]+V[e[t+15]]).toLowerCase();if(!S(n))throw TypeError("Stringified UUID is invalid");return n};var F=function(e,t,n){var r=(e=e||{}).random||(e.rng||C)();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,t){n=n||0;for(var o=0;o<16;++o)t[n+o]=r[o];return t}return U(r)};function G(e){let{blockClientId:t,richTextIdentifier:n=null,range:r=null,selector:o="range",source:a="default",id:i=F()}=e;const l={type:"ANNOTATION_ADD",id:i,blockClientId:t,richTextIdentifier:n,source:a,selector:o};return"range"===o&&(l.range=r),l}function M(e){return{type:"ANNOTATION_REMOVE",annotationId:e}}function B(e,t,n){return{type:"ANNOTATION_UPDATE_RANGE",annotationId:e,start:t,end:n}}function j(e){return{type:"ANNOTATION_REMOVE_SOURCE",source:e}}const W=(0,f.createReduxStore)(i,{reducer:A,selectors:n,actions:r});(0,f.register)(W),(window.wp=window.wp||{}).annotations=t}(); |