WordPress/wp-includes/js/dist/annotations.min.js
youknowriad 6137ee183b Block Editor: Upgrade @wordpress packages to the latest version (4.7).
Updated packages:

 - @wordpress/annotations@1.0.4
 - @wordpress/api-fetch@2.2.6
 - @wordpress/block-library@2.2.10
 - @wordpress/block-serialization-default-parser@2.0.2
 - @wordpress/block-serialization-spec-parser@2.0.2
 - @wordpress/blocks@6.0.4
 - @wordpress/components@7.0.4
 - @wordpress/core-data@2.0.15
 - @wordpress/data@4.1.0
 - @wordpress/date@3.0.1
 - @wordpress/edit-post@3.1.5
 - @wordpress/editor@9.0.5
 - @wordpress/eslint-plugin@1.0.0
 - @wordpress/format-library@1.2.8
 - @wordpress/html-entities@2.0.4
 - @wordpress/list-reusable-blocks@1.1.17
 - @wordpress/notices@1.1.1
 - @wordpress/nux@3.0.5
 - @wordpress/rich-text@3.0.3
 - @wordpress/url@2.3.2
 - @wordpress/viewport@2.0.13

This also includes the updates the Core blocks.
The script loader is updated to match the Gutenberg repository too.

Props atimmer, gziolo, joen.
Fixes #45442, #45637.

Built from https://develop.svn.wordpress.org/branches/5.0@44183


git-svn-id: http://core.svn.wordpress.org/branches/5.0@44013 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-12-15 10:59:46 +00:00

1 line
10 KiB
JavaScript

this.wp=this.wp||{},this.wp.annotations=function(n){var t={};function e(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return n[r].call(o.exports,o,o.exports,e),o.l=!0,o.exports}return e.m=n,e.c=t,e.d=function(n,t,r){e.o(n,t)||Object.defineProperty(n,t,{enumerable:!0,get:r})},e.r=function(n){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"__esModule",{value:!0})},e.t=function(n,t){if(1&t&&(n=e(n)),8&t)return n;if(4&t&&"object"==typeof n&&n&&n.__esModule)return n;var r=Object.create(null);if(e.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:n}),2&t&&"string"!=typeof n)for(var o in n)e.d(r,o,function(t){return n[t]}.bind(null,o));return r},e.n=function(n){var t=n&&n.__esModule?function(){return n.default}:function(){return n};return e.d(t,"a",t),t},e.o=function(n,t){return Object.prototype.hasOwnProperty.call(n,t)},e.p="",e(e.s=314)}({1:function(n,t){!function(){n.exports=this.wp.i18n}()},15:function(n,t,e){"use strict";function r(n,t,e){return t in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}e.d(t,"a",function(){return r})},19:function(n,t,e){"use strict";var r=e(33);function o(n){return function(n){if(Array.isArray(n)){for(var t=0,e=new Array(n.length);t<n.length;t++)e[t]=n[t];return e}}(n)||Object(r.a)(n)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}e.d(t,"a",function(){return o})},2:function(n,t){!function(){n.exports=this.lodash}()},20:function(n,t){!function(){n.exports=this.wp.richText}()},21:function(n,t,e){"use strict";function r(n,t){if(null==n)return{};var e,r,o=function(n,t){if(null==n)return{};var e,r,o={},a=Object.keys(n);for(r=0;r<a.length;r++)e=a[r],t.indexOf(e)>=0||(o[e]=n[e]);return o}(n,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(n);for(r=0;r<a.length;r++)e=a[r],t.indexOf(e)>=0||Object.prototype.propertyIsEnumerable.call(n,e)&&(o[e]=n[e])}return o}e.d(t,"a",function(){return r})},23:function(n,t){!function(){n.exports=this.wp.hooks}()},31:function(n,t,e){"use strict";var r,o;function a(n){return[n]}function i(n){return!!n&&"object"==typeof n}function u(){var n={clear:function(){n.head=null}};return n}function c(n,t,e){var r;if(n.length!==t.length)return!1;for(r=e;r<n.length;r++)if(n[r]!==t[r])return!1;return!0}r={},o="undefined"!=typeof WeakMap,t.a=function(n,t){var e,f;function l(){e=o?new WeakMap:u()}function s(){var e,r,o,a,i,u=arguments.length;for(a=new Array(u),o=0;o<u;o++)a[o]=arguments[o];for(i=t.apply(null,a),(e=f(i)).isUniqueByDependants||(e.lastDependants&&!c(i,e.lastDependants,0)&&e.clear(),e.lastDependants=i),r=e.head;r;){if(c(r.args,a,1))return r!==e.head&&(r.prev.next=r.next,r.next&&(r.next.prev=r.prev),r.next=e.head,r.prev=null,e.head.prev=r,e.head=r),r.val;r=r.next}return r={val:n.apply(null,a)},a[0]=null,r.args=a,e.head&&(e.head.prev=r,r.next=e.head),e.head=r,r.val}return t||(t=a),f=o?function(n){var t,o,a,c,f=e,l=!0;for(t=0;t<n.length;t++){if(!i(o=n[t])){l=!1;break}f.has(o)?f=f.get(o):(a=new WeakMap,f.set(o,a),f=a)}return f.has(r)||((c=u()).isUniqueByDependants=l,f.set(r,c)),f.get(r)}:function(){return e},s.getDependants=t,s.clear=l,l(),s}},314:function(n,t,e){"use strict";e.r(t);var r={};e.r(r),e.d(r,"__experimentalGetAnnotationsForBlock",function(){return b}),e.d(r,"__experimentalGetAllAnnotationsForBlock",function(){return g}),e.d(r,"__experimentalGetAnnotationsForRichText",function(){return O}),e.d(r,"__experimentalGetAnnotations",function(){return m});var o={};e.r(o),e.d(o,"__experimentalAddAnnotation",function(){return x}),e.d(o,"__experimentalRemoveAnnotation",function(){return A}),e.d(o,"__experimentalUpdateAnnotationRange",function(){return _}),e.d(o,"__experimentalRemoveAnnotationsBySource",function(){return j});var a=e(5),i=e(15),u=e(19),c=e(8),f=e(2);function l(n,t){var e=n.filter(t);return n.length===e.length?n:e}var s=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"ANNOTATION_ADD":var e=t.blockClientId,r={id:t.id,blockClientId:e,richTextIdentifier:t.richTextIdentifier,source:t.source,selector:t.selector,range:t.range};if("range"===r.selector&&!function(n){return Object(f.isNumber)(n.start)&&Object(f.isNumber)(n.end)&&n.start<=n.end}(r.range))return n;var o=Object(f.get)(n,e,[]);return Object(c.a)({},n,Object(i.a)({},e,Object(u.a)(o).concat([r])));case"ANNOTATION_REMOVE":return Object(f.mapValues)(n,function(n){return l(n,function(n){return n.id!==t.annotationId})});case"ANNOTATION_UPDATE_RANGE":return Object(f.mapValues)(n,function(n){var e=!1,r=n.map(function(n){return n.id===t.annotationId?(e=!0,Object(c.a)({},n,{range:{start:t.start,end:t.end}})):n});return e?r:n});case"ANNOTATION_REMOVE_SOURCE":return Object(f.mapValues)(n,function(n){return l(n,function(n){return n.source!==t.source})})}return n},p=e(21),d=e(31),v=[],b=Object(d.a)(function(n,t){return Object(f.get)(n,t,[]).filter(function(n){return"block"===n.selector})},function(n,t){return[Object(f.get)(n,t,v)]}),g=function(n,t){return Object(f.get)(n,t,v)},O=Object(d.a)(function(n,t,e){return Object(f.get)(n,t,[]).filter(function(n){return"range"===n.selector&&e===n.richTextIdentifier}).map(function(n){var t=n.range,e=Object(p.a)(n,["range"]);return Object(c.a)({},t,e)})},function(n,t){return[Object(f.get)(n,t,v)]});function m(n){return Object(f.flatMap)(n,function(n){return n})}var y=e(57),h=e.n(y);function x(n){var t=n.blockClientId,e=n.richTextIdentifier,r=void 0===e?null:e,o=n.range,a=void 0===o?null:o,i=n.selector,u=void 0===i?"range":i,c=n.source,f=void 0===c?"default":c,l=n.id,s={type:"ANNOTATION_ADD",id:void 0===l?h()():l,blockClientId:t,richTextIdentifier:r,source:f,selector:u};return"range"===u&&(s.range=a),s}function A(n){return{type:"ANNOTATION_REMOVE",annotationId:n}}function _(n,t,e){return{type:"ANNOTATION_UPDATE_RANGE",annotationId:n,start:t,end:e}}function j(n){return{type:"ANNOTATION_REMOVE_SOURCE",source:n}}Object(a.registerStore)("core/annotations",{reducer:s,selectors:r,actions:o});var T=e(20),N=e(41),w=e.n(N),I=e(1),E="core/annotation",R="annotation-text-";var k=w()(function(n){var t=n.annotations;return function(n,e){if(0===t.length)return n;var r={formats:n,text:e};return(r=function(n){return(arguments.length>1&&void 0!==arguments[1]?arguments[1]:[]).forEach(function(t){var e=t.start,r=t.end;e>n.text.length&&(e=n.text.length),r>n.text.length&&(r=n.text.length);var o=R+t.source,a=R+t.id;n=Object(T.applyFormat)(n,{type:E,attributes:{className:o,id:a}},e,r)}),n}(r,t)).formats}}),S=w()(function(n){return{annotations:n}}),P={name:E,title:Object(I.__)("Annotation"),tagName:"mark",className:"annotation-text",attributes:{className:"class",id:"id"},edit:function(){return null},__experimentalGetPropsForEditableTreePreparation:function(n,t){var e=t.richTextIdentifier,r=t.blockClientId;return S(n("core/annotations").__experimentalGetAnnotationsForRichText(r,e))},__experimentalCreatePrepareEditableTree:k,__experimentalGetPropsForEditableTreeChangeHandler:function(n){return{removeAnnotation:n("core/annotations").__experimentalRemoveAnnotation,updateAnnotationRange:n("core/annotations").__experimentalUpdateAnnotationRange}},__experimentalCreateOnChangeEditableValue:function(n){return function(t){var e=function(n){var t={};return n.forEach(function(n,e){(n=(n=n||[]).filter(function(n){return n.type===E})).forEach(function(n){var r=n.attributes.id;r=r.replace(R,""),t.hasOwnProperty(r)||(t[r]={start:e}),t[r].end=e+1})}),t}(t),r=n.removeAnnotation,o=n.updateAnnotationRange;!function(n,t,e){var r=e.removeAnnotation,o=e.updateAnnotationRange;n.forEach(function(n){var e=t[n.id];if(e){var a=n.start,i=n.end;a===e.start&&i===e.end||o(n.id,e.start,e.end)}else r(n.id)})}(n.annotations,e,{removeAnnotation:r,updateAnnotationRange:o})}}},C=P.name,D=Object(p.a)(P,["name"]);Object(T.registerFormatType)(C,D);var M=e(23);Object(M.addFilter)("editor.BlockListBlock","core/annotations",function(n){return Object(a.withSelect)(function(n,t){var e=t.clientId;return{className:n("core/annotations").__experimentalGetAnnotationsForBlock(e).map(function(n){return"is-annotated-by-"+n.source}).join(" ")}})(n)})},33:function(n,t,e){"use strict";function r(n){if(Symbol.iterator in Object(n)||"[object Arguments]"===Object.prototype.toString.call(n))return Array.from(n)}e.d(t,"a",function(){return r})},41:function(n,t,e){n.exports=function(n,t){var e,r,o,a=0;function i(){var t,i,u=r,c=arguments.length;n:for(;u;){if(u.args.length===arguments.length){for(i=0;i<c;i++)if(u.args[i]!==arguments[i]){u=u.next;continue n}return u!==r&&(u===o&&(o=u.prev),u.prev.next=u.next,u.next&&(u.next.prev=u.prev),u.next=r,u.prev=null,r.prev=u,r=u),u.val}u=u.next}for(t=new Array(c),i=0;i<c;i++)t[i]=arguments[i];return u={args:t,val:n.apply(null,t)},r?(r.prev=u,u.next=r):o=u,a===e?(o=o.prev).next=null:a++,r=u,u.val}return t&&t.maxSize&&(e=t.maxSize),i.clear=function(){r=null,o=null,a=0},i}},5:function(n,t){!function(){n.exports=this.wp.data}()},57:function(n,t,e){var r=e(77),o=e(78);n.exports=function(n,t,e){var a=t&&e||0;"string"==typeof n&&(t="binary"===n?new Array(16):null,n=null);var i=(n=n||{}).random||(n.rng||r)();if(i[6]=15&i[6]|64,i[8]=63&i[8]|128,t)for(var u=0;u<16;++u)t[a+u]=i[u];return t||o(i)}},77:function(n,t){var e="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto);if(e){var r=new Uint8Array(16);n.exports=function(){return e(r),r}}else{var o=new Array(16);n.exports=function(){for(var n,t=0;t<16;t++)0==(3&t)&&(n=4294967296*Math.random()),o[t]=n>>>((3&t)<<3)&255;return o}}},78:function(n,t){for(var e=[],r=0;r<256;++r)e[r]=(r+256).toString(16).substr(1);n.exports=function(n,t){var r=t||0,o=e;return[o[n[r++]],o[n[r++]],o[n[r++]],o[n[r++]],"-",o[n[r++]],o[n[r++]],"-",o[n[r++]],o[n[r++]],"-",o[n[r++]],o[n[r++]],"-",o[n[r++]],o[n[r++]],o[n[r++]],o[n[r++]],o[n[r++]],o[n[r++]]].join("")}},8:function(n,t,e){"use strict";e.d(t,"a",function(){return o});var r=e(15);function o(n){for(var t=1;t<arguments.length;t++){var e=null!=arguments[t]?arguments[t]:{},o=Object.keys(e);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(e).filter(function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),o.forEach(function(t){Object(r.a)(n,t,e[t])})}return n}}});