UNPKG

@10up/block-components

Version:

10up Components built for the WordPress Block Editor.

2 lines 6.68 kB
!function(){var t={5041:function(t,e,n){"use strict";n.d(e,{Image:function(){return a}});var r=n(7966),o=n(2627),i=n(2050),s=n(8450),c=n(6186);function u(){return u=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},u.apply(null,arguments)}const a=({id:t,size:e="full",onSelect:n,focalPoint:a={x:.5,y:.5},onChangeFocalPoint:l,labels:f={},canEditImage:d=!0,allowedTypes:p=["image"],...m})=>{const y=!!t,{media:g,isResolvingMedia:v}=(0,c.useMedia)(t),S="function"===typeof l;if(!y&&!d)return(0,r.createElement)(i.Placeholder,{className:"block-editor-media-placeholder",withIllustration:!0});if(!y&&d)return(0,r.createElement)(o.MediaPlaceholder,{labels:f,onSelect:n,accept:"image",multiple:!1,allowedTypes:p});if(v)return(0,r.createElement)(i.Spinner,null);const b=g?.media_details?.sizes?.[e]?.source_url??g?.source_url,E=g?.alt_text;if(S){const t={objectFit:"cover",objectPosition:`${100*a.x}% ${100*a.y}%`};m.style={...m.style,...t}}return(0,r.createElement)(r.Fragment,null,S&&(0,r.createElement)(o.InspectorControls,null,(0,r.createElement)(i.PanelBody,{title:(0,s.__)("Image Settings")},(0,r.createElement)(i.FocalPointPicker,{label:(0,s.__)("Focal Point Picker"),url:b,value:a,onChange:l}))),(0,r.createElement)("img",u({src:b,alt:E},m)))}},161:function(t,e,n){"use strict";n.d(e,{Zm:function(){return s}});var r=n(7966);const o={postId:void 0,postType:void 0,isEditable:void 0},i=(0,r.createContext)(o),s=()=>(0,r.useContext)(i)},283:function(t,e,n){"use strict";n.d(e,{YK:function(){return r.usePost}});n(3505),n(1210),n(1740),n(4512),n(6186),n(2516);var r=n(2312);n(4275),n(2131),n(703),n(8857),n(6856),n(687),n(1461),n(989),n(8021),n(8474),n(3445),n(2737),n(4449),n(3227)},2131:function(t,e,n){"use strict";n(5214),n(7816)},2516:function(t,e,n){"use strict";n(5214),n(2627)},4512:function(t,e,n){"use strict";n(7966);var r=require("@leeoniya/ufuzzy");new(n.n(r)())},4449:function(t,e,n){"use strict";n(2627),n(5214)},3505:function(t,e,n){"use strict";n(5214),n(2627)},1740:function(t,e,n){"use strict";n(5214),n(7966),n(8475)},687:function(t,e,n){"use strict";n(5214),n(7816)},2737:function(t,e,n){"use strict";n(7816),n(2312)},4275:function(t,e,n){"use strict";n(5214),n(7816)},6186:function(t,e,n){"use strict";n.d(e,{useMedia:function(){return i}});var r=n(5214),o=n(7816);function i(t){return(0,r.useSelect)(e=>{const{getEntityRecord:n,isResolving:r,hasFinishedResolution:i}=e(o.store),s=["postType","attachment",t,{context:"view"}];return{media:n(...s),isResolvingMedia:r("getEntityRecord",s),hasResolvedMedia:i("getEntityRecord",s)}},[t])}},763:function(t,e,n){"use strict";n(6314)},989:function(t,e,n){"use strict";n(7966),n(2050),n(763)},8474:function(t,e,n){"use strict";n(7816),n(2312)},2312:function(t,e,n){"use strict";n.d(e,{usePost:function(){return s}});var r=n(5214),o=n(4951),i=n(161);function s(){const{postId:t,postType:e,isEditable:n}=(0,i.Zm)(),{globalPostId:s,globalPostType:c}=(0,r.useSelect)(t=>({globalPostId:t(o.store).getCurrentPostId(),globalPostType:t(o.store).getCurrentPostType()}),[]);return{postId:t||s,postType:e||c,isEditable:!(!!t&&!!e)||n}}},1461:function(t,e,n){"use strict";n(5214),n(8450),n(7816),n(2312),n(687),n(4275)},3227:function(t,e,n){"use strict";n(5214),n(2627)},1210:function(t,e,n){"use strict";n(3805),n(7816),n(5214)},8021:function(t,e,n){"use strict";n(7966)},703:function(t,e,n){"use strict";n(4951),n(5214),n(7816)},6856:function(t,e,n){"use strict";n(5214),n(7816)},8857:function(t,e,n){"use strict";n(2312),n(4275),n(2131),n(703),n(6856)},3445:function(t,e,n){"use strict";n(5214),n(7816)},7785:function(t,e,n){"use strict";var r={};n.r(r),n.d(r,{getIcon:function(){return a},getIconSet:function(){return c},getIconSets:function(){return s},getIcons:function(){return u}});var o={};n.r(o),n.d(o,{registerIconSet:function(){return l},removeIconSet:function(){return f}});var i=n(5214);function s(t){const{iconSets:e}=t;return Object.values(e)}function c(t,e){const{iconSets:n}=t;return n[e]??[]}function u(t,e){const{iconSets:n}=t;return n?.hasOwnProperty(e)?n[e]?.icons??[]:[]}function a(t,e,n){const{iconSets:r}=t;return r?.hasOwnProperty(e)?r[e]?.icons?.find(t=>t.name===n)??[]:void 0}function l(t){return{type:"REGISTER_ICON_SET",iconSet:t}}function f(t){return{type:"REMOVE_ICON_SET",name:t}}const d="tenup/icons",p=(0,i.createReduxStore)(d,{reducer:function(t={iconSets:{}},e){switch(e.type){case"REGISTER_ICON_SET":return{...t,iconSets:{...t.iconSets,[e.iconSet.name]:e.iconSet}};case"REMOVE_ICON_SET":if(t.iconSets.hasOwnProperty(e.name)){const n={...t};return delete n.iconSets[e.name],n}return t;default:return t}},selectors:r,actions:o});!!(0,i.select)(d)||(0,i.register)(p)},8475:function(t,e,n){"use strict";n(7785)},3805:function(t){t.exports=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}},2627:function(t){"use strict";t.exports=require("@wordpress/block-editor")},2050:function(t){"use strict";t.exports=require("@wordpress/components")},6314:function(t){"use strict";t.exports=require("@wordpress/compose")},7816:function(t){"use strict";t.exports=require("@wordpress/core-data")},5214:function(t){"use strict";t.exports=require("@wordpress/data")},4951:function(t){"use strict";t.exports=require("@wordpress/editor")},7966:function(t){"use strict";t.exports=require("@wordpress/element")},8450:function(t){"use strict";t.exports=require("@wordpress/i18n")}},e={};function n(r){var o=e[r];if(void 0!==o)return o.exports;var i=e[r]={exports:{}};return t[r](i,i.exports,n),i.exports}n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,{a:e}),e},n.d=function(t,e){for(var r in e)n.o(e,r)&&!n.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.r=function(t){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var r={};!function(){"use strict";n.r(r),n.d(r,{PostFeaturedImage:function(){return c}});var t=n(7966),e=n(7816),o=n(283),i=n(5041);function s(){return s=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},s.apply(null,arguments)}const c=n=>{const{postId:r,postType:c,isEditable:u}=(0,o.YK)(),[a,l]=(0,e.useEntityProp)("postType",c,"featured_media",r);return(0,t.createElement)(i.Image,s({id:a,canEditImage:u,onSelect:t=>{l(t.id)}},n))}}(),module.exports=r}(); //# sourceMappingURL=index.js.map