From 11cc49d2ff7a74b685fab3c12fe5a405d808d6bf Mon Sep 17 00:00:00 2001 From: Douglas Johnson Date: Fri, 22 Sep 2023 14:48:16 -0400 Subject: [PATCH] Add icons for each block --- build/blocks/block-coauthor-avatar/block.json | 1 - build/blocks/block-coauthor-avatar/index.asset.php | 2 +- build/blocks/block-coauthor-avatar/index.js | 2 +- build/blocks/block-coauthor-description/block.json | 1 - build/blocks/block-coauthor-description/index.asset.php | 2 +- build/blocks/block-coauthor-description/index.js | 2 +- build/blocks/block-coauthor-featured-image/block.json | 1 - build/blocks/block-coauthor-featured-image/index.asset.php | 2 +- build/blocks/block-coauthor-featured-image/index.js | 2 +- build/blocks/block-coauthor-name/block.json | 1 - build/blocks/block-coauthor-name/index.asset.php | 2 +- build/blocks/block-coauthor-name/index.js | 2 +- build/blocks/block-coauthors/block.json | 1 - build/blocks/block-coauthors/index.asset.php | 2 +- build/blocks/block-coauthors/index.js | 2 +- src/blocks/block-coauthor-avatar/block.json | 1 - src/blocks/block-coauthor-avatar/index.js | 4 +++- src/blocks/block-coauthor-description/block.json | 1 - src/blocks/block-coauthor-description/index.js | 5 +++-- src/blocks/block-coauthor-featured-image/block.json | 1 - src/blocks/block-coauthor-featured-image/index.js | 4 +++- src/blocks/block-coauthor-name/block.json | 1 - src/blocks/block-coauthor-name/index.js | 4 +++- src/blocks/block-coauthors/block.json | 1 - src/blocks/block-coauthors/index.js | 3 +++ 25 files changed, 25 insertions(+), 25 deletions(-) diff --git a/build/blocks/block-coauthor-avatar/block.json b/build/blocks/block-coauthor-avatar/block.json index b7933a63..3a9a204f 100644 --- a/build/blocks/block-coauthor-avatar/block.json +++ b/build/blocks/block-coauthor-avatar/block.json @@ -5,7 +5,6 @@ "version": "1.0.0", "title": "Co-Author Avatar", "category": "widgets", - "icon": "smiley", "description": "Display a co-author's avatar", "supports": { "align": [ diff --git a/build/blocks/block-coauthor-avatar/index.asset.php b/build/blocks/block-coauthor-avatar/index.asset.php index 6a647206..e4fcdd7e 100644 --- a/build/blocks/block-coauthor-avatar/index.asset.php +++ b/build/blocks/block-coauthor-avatar/index.asset.php @@ -1 +1 @@ - array('wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-element', 'wp-i18n'), 'version' => 'cd0a28f7e1757a1d76b5'); + array('wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-element', 'wp-i18n', 'wp-primitives'), 'version' => '51e75e8924d159603b0f'); diff --git a/build/blocks/block-coauthor-avatar/index.js b/build/blocks/block-coauthor-avatar/index.js index e2407432..78c2f169 100644 --- a/build/blocks/block-coauthor-avatar/index.js +++ b/build/blocks/block-coauthor-avatar/index.js @@ -1 +1 @@ -!function(){"use strict";var e,t={857:function(){var e=window.wp.blocks,t=window.wp.element,l=window.wp.i18n,o=window.wp.blockEditor,a=window.wp.components,n=window.wp.data;function r(e){let{dimensions:o,style:a,className:n}=e;const r=(0,t.useMemo)((()=>function(e){let{width:t,height:l}=e;return`data:image/svg+xml;charset=UTF-8,${encodeURIComponent(`\n\t\t\t\n\t\t\t\n\t\t`.replace(/[\t\n\r]/gim,"").replace(/\s\s+/g," ")).replace(/\(/g,"%28").replace(/\)/g,"%29")}`}(o)),[o]);return(0,t.createElement)("img",{alt:(0,l.__)("Placeholder image"),className:n,src:r,style:a,width:o.width,height:o.height})}var i=JSON.parse('{"u2":"cap/coauthor-avatar"}');(0,e.registerBlockType)(i.u2,{edit:function(e){var i;let{context:s,attributes:u,setAttributes:c}=e;const{isLink:h,rel:p,size:v,verticalAlign:d}=u,g=(0,n.useSelect)((e=>e("cap/blocks").getAuthorPlaceholder()),[]),m=s["cap/author"]||g,{avatar_urls:_}=m;if(!_||0===_.length)return null;const b=Object.keys(_).map((e=>({value:e,label:`${e} x ${e}`}))),f=(0,o.__experimentalUseBorderProps)(u),w=null!==(i=_[v])&&void 0!==i?i:"";return(0,t.createElement)(t.Fragment,null,(0,t.createElement)("figure",(0,o.useBlockProps)(),""===w?(0,t.createElement)(r,{className:f.className,dimensions:{width:v,height:v},style:{height:v,width:v,minWidth:"auto",minHeight:"auto",padding:0,verticalAlign:d,...f.style}}):(0,t.createElement)("img",{style:{...f.style,verticalAlign:d},width:v,height:v,src:`${_[v]}`})),(0,t.createElement)(o.InspectorControls,null,(0,t.createElement)(a.PanelBody,{title:(0,l.__)("Avatar Settings","co-authors-plus")},(0,t.createElement)(a.SelectControl,{label:(0,l.__)("Avatar size","co-authors-plus"),value:v,options:b,onChange:e=>{c({size:Number(e)})}}),(0,t.createElement)(a.ToggleControl,{label:(0,l.__)("Make avatar a link to author archive.","co-authors-plus"),onChange:()=>c({isLink:!h}),checked:h}),h&&(0,t.createElement)(a.TextControl,{__nextHasNoMarginBottom:!0,label:(0,l.__)("Link rel","co-authors-plus"),value:p,onChange:e=>c({rel:e})})),(0,t.createElement)(a.PanelBody,{initialOpen:!1,title:(0,l.__)("Co-authors Layout","co-authors-plus")},(0,t.createElement)(a.SelectControl,{label:(0,l.__)("Vertical align","co-authors-plus"),value:d,options:[{value:"",label:(0,l.__)("Default","co-authors-plus")},{value:"baseline",label:(0,l.__)("Baseline","co-authors-plus")},{value:"bottom",label:(0,l.__)("Bottom","co-authors-plus")},{value:"middle",label:(0,l.__)("Middle","co-authors-plus")},{value:"sub",label:(0,l.__)("Sub","co-authors-plus")},{value:"super",label:(0,l.__)("Super","co-authors-plus")},{value:"text-bottom",label:(0,l.__)("Text Bottom","co-authors-plus")},{value:"text-top",label:(0,l.__)("Text Top","co-authors-plus")},{value:"top",label:(0,l.__)("Top","co-authors-plus")}],onChange:e=>{c({verticalAlign:""===e?void 0:e})},help:(0,l.__)("Vertical alignment defaults to bottom in the block layout and middle in the inline layout.","co-authors-plus")}))))}})}},l={};function o(e){var a=l[e];if(void 0!==a)return a.exports;var n=l[e]={exports:{}};return t[e](n,n.exports,o),n.exports}o.m=t,e=[],o.O=function(t,l,a,n){if(!l){var r=1/0;for(c=0;c=n)&&Object.keys(o.O).every((function(e){return o.O[e](l[s])}))?l.splice(s--,1):(i=!1,n0&&e[c-1][2]>n;c--)e[c]=e[c-1];e[c]=[l,a,n]},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},function(){var e={893:0,30:0};o.O.j=function(t){return 0===e[t]};var t=function(t,l){var a,n,r=l[0],i=l[1],s=l[2],u=0;if(r.some((function(t){return 0!==e[t]}))){for(a in i)o.o(i,a)&&(o.m[a]=i[a]);if(s)var c=s(o)}for(t&&t(l);ufunction(e){let{width:t,height:l}=e;return`data:image/svg+xml;charset=UTF-8,${encodeURIComponent(`\n\t\t\t\n\t\t\t\n\t\t`.replace(/[\t\n\r]/gim,"").replace(/\s\s+/g," ")).replace(/\(/g,"%28").replace(/\)/g,"%29")}`}(l)),[l]);return(0,t.createElement)("img",{alt:(0,a.__)("Placeholder image"),className:n,src:r,style:o,width:l.width,height:l.height})}var u=JSON.parse('{"u2":"cap/coauthor-avatar"}');(0,e.registerBlockType)(u.u2,{edit:function(e){var l;let{context:o,attributes:u,setAttributes:c}=e;const{isLink:h,rel:p,size:v,verticalAlign:d}=u,m=(0,i.useSelect)((e=>e("cap/blocks").getAuthorPlaceholder()),[]),g=o["cap/author"]||m,{avatar_urls:_}=g;if(!_||0===_.length)return null;const w=Object.keys(_).map((e=>({value:e,label:`${e} x ${e}`}))),b=(0,n.__experimentalUseBorderProps)(u),f=null!==(l=_[v])&&void 0!==l?l:"";return(0,t.createElement)(t.Fragment,null,(0,t.createElement)("figure",(0,n.useBlockProps)(),""===f?(0,t.createElement)(s,{className:b.className,dimensions:{width:v,height:v},style:{height:v,width:v,minWidth:"auto",minHeight:"auto",padding:0,verticalAlign:d,...b.style}}):(0,t.createElement)("img",{style:{...b.style,verticalAlign:d},width:v,height:v,src:`${_[v]}`})),(0,t.createElement)(n.InspectorControls,null,(0,t.createElement)(r.PanelBody,{title:(0,a.__)("Avatar Settings","co-authors-plus")},(0,t.createElement)(r.SelectControl,{label:(0,a.__)("Avatar size","co-authors-plus"),value:v,options:w,onChange:e=>{c({size:Number(e)})}}),(0,t.createElement)(r.ToggleControl,{label:(0,a.__)("Make avatar a link to author archive.","co-authors-plus"),onChange:()=>c({isLink:!h}),checked:h}),h&&(0,t.createElement)(r.TextControl,{__nextHasNoMarginBottom:!0,label:(0,a.__)("Link rel","co-authors-plus"),value:p,onChange:e=>c({rel:e})})),(0,t.createElement)(r.PanelBody,{initialOpen:!1,title:(0,a.__)("Co-authors Layout","co-authors-plus")},(0,t.createElement)(r.SelectControl,{label:(0,a.__)("Vertical align","co-authors-plus"),value:d,options:[{value:"",label:(0,a.__)("Default","co-authors-plus")},{value:"baseline",label:(0,a.__)("Baseline","co-authors-plus")},{value:"bottom",label:(0,a.__)("Bottom","co-authors-plus")},{value:"middle",label:(0,a.__)("Middle","co-authors-plus")},{value:"sub",label:(0,a.__)("Sub","co-authors-plus")},{value:"super",label:(0,a.__)("Super","co-authors-plus")},{value:"text-bottom",label:(0,a.__)("Text Bottom","co-authors-plus")},{value:"text-top",label:(0,a.__)("Text Top","co-authors-plus")},{value:"top",label:(0,a.__)("Top","co-authors-plus")}],onChange:e=>{c({verticalAlign:""===e?void 0:e})},help:(0,a.__)("Vertical alignment defaults to bottom in the block layout and middle in the inline layout.","co-authors-plus")}))))},icon:o})}},l={};function o(e){var a=l[e];if(void 0!==a)return a.exports;var n=l[e]={exports:{}};return t[e](n,n.exports,o),n.exports}o.m=t,e=[],o.O=function(t,l,a,n){if(!l){var r=1/0;for(c=0;c=n)&&Object.keys(o.O).every((function(e){return o.O[e](l[s])}))?l.splice(s--,1):(i=!1,n0&&e[c-1][2]>n;c--)e[c]=e[c-1];e[c]=[l,a,n]},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},function(){var e={893:0,30:0};o.O.j=function(t){return 0===e[t]};var t=function(t,l){var a,n,r=l[0],i=l[1],s=l[2],u=0;if(r.some((function(t){return 0!==e[t]}))){for(a in i)o.o(i,a)&&(o.m[a]=i[a]);if(s)var c=s(o)}for(t&&t(l);u array('wp-block-editor', 'wp-blocks', 'wp-data', 'wp-element', 'wp-i18n'), 'version' => '53022b1fc8be9e6fe3b8'); + array('wp-block-editor', 'wp-blocks', 'wp-data', 'wp-element', 'wp-i18n', 'wp-primitives'), 'version' => '7ab35d3b1fa8612137e8'); diff --git a/build/blocks/block-coauthor-description/index.js b/build/blocks/block-coauthor-description/index.js index fa72dc8f..de286e49 100644 --- a/build/blocks/block-coauthor-description/index.js +++ b/build/blocks/block-coauthor-description/index.js @@ -1 +1 @@ -!function(){var t={184:function(t,e){var n;!function(){"use strict";var r={}.hasOwnProperty;function o(){for(var t=[],e=0;et("cap/blocks").getAuthorPlaceholder()),[]),p=n["cap/author"]||s,{description:f}=p;return(0,r.createElement)(r.Fragment,null,(0,r.createElement)(o.BlockControls,null,(0,r.createElement)(o.AlignmentControl,{value:c,onChange:t=>{l({textAlign:t})}})),(0,r.createElement)("div",e({},(0,o.useBlockProps)({className:u()({[`has-text-align-${c}`]:c,"is-layout-flow":!0})}),{dangerouslySetInnerHTML:{__html:f.rendered}})))}})}()}(); \ No newline at end of file +!function(){var t={184:function(t,e){var n;!function(){"use strict";var r={}.hasOwnProperty;function o(){for(var t=[],e=0;et("cap/blocks").getAuthorPlaceholder()),[]),p=n["cap/author"]||s,{description:f}=p;return(0,e.createElement)(e.Fragment,null,(0,e.createElement)(a.BlockControls,null,(0,e.createElement)(a.AlignmentControl,{value:c,onChange:t=>{o({textAlign:t})}})),(0,e.createElement)("div",i({},(0,a.useBlockProps)({className:u()({[`has-text-align-${c}`]:c,"is-layout-flow":!0})}),{dangerouslySetInnerHTML:{__html:f.rendered}})))},icon:o})}()}(); \ No newline at end of file diff --git a/build/blocks/block-coauthor-featured-image/block.json b/build/blocks/block-coauthor-featured-image/block.json index 0d17a6a8..73efed6c 100644 --- a/build/blocks/block-coauthor-featured-image/block.json +++ b/build/blocks/block-coauthor-featured-image/block.json @@ -5,7 +5,6 @@ "version": "1.0.0", "title": "Co-Author Featured Image", "category": "widgets", - "icon": "smiley", "description": "Featured Image from a Guest Author profile.", "supports": { "align": [ diff --git a/build/blocks/block-coauthor-featured-image/index.asset.php b/build/blocks/block-coauthor-featured-image/index.asset.php index 48a3e8a5..b626675e 100644 --- a/build/blocks/block-coauthor-featured-image/index.asset.php +++ b/build/blocks/block-coauthor-featured-image/index.asset.php @@ -1 +1 @@ - array('wp-block-editor', 'wp-blocks', 'wp-components', 'wp-core-data', 'wp-data', 'wp-element', 'wp-i18n'), 'version' => 'a6e968eb133431c21528'); + array('wp-block-editor', 'wp-blocks', 'wp-components', 'wp-core-data', 'wp-data', 'wp-element', 'wp-i18n', 'wp-primitives'), 'version' => 'd5400753091b01ccc087'); diff --git a/build/blocks/block-coauthor-featured-image/index.js b/build/blocks/block-coauthor-featured-image/index.js index 8523dfc9..04e6720d 100644 --- a/build/blocks/block-coauthor-featured-image/index.js +++ b/build/blocks/block-coauthor-featured-image/index.js @@ -1 +1 @@ -!function(){"use strict";var e,t={301:function(){var e=window.wp.blocks,t=window.wp.element,l=window.wp.i18n,a=window.wp.blockEditor,o=window.wp.components,i=window.wp.data,n=window.wp.coreData;const r=(0,t.createElement)(t.Fragment,null,(0,t.createElement)(o.__experimentalToggleGroupControlOption,{value:"cover",label:(0,l._x)("Cover","Scale option for Image dimension control")}),(0,t.createElement)(o.__experimentalToggleGroupControlOption,{value:"contain",label:(0,l._x)("Contain","Scale option for Image dimension control")}),(0,t.createElement)(o.__experimentalToggleGroupControlOption,{value:"fill",label:(0,l._x)("Fill","Scale option for Image dimension control")})),s="cover",u={cover:(0,l.__)("Image is scaled and cropped to fill the entire space without being distorted."),contain:(0,l.__)("Image is scaled to fill the space without clipping nor distorting."),fill:(0,l.__)("Image will be stretched and distorted to completely fill the space.")};var c=e=>{let{clientId:i,attributes:{aspectRatio:n,width:c,height:h,scale:p,sizeSlug:d},setAttributes:g,imageSizeOptions:_=[]}=e;const m=(0,o.__experimentalUseCustomUnits)({availableUnits:(0,a.useSetting)("spacing.units")||["px","%","vw","em","rem"]}),v=(e,t)=>{const l=parseFloat(t);isNaN(l)&&t||g({[e]:l<0?"0":t})},w=(0,l._x)("Scale","Image scaling options"),b=h||n&&"auto"!==n;return(0,t.createElement)(a.InspectorControls,{group:"dimensions"},(0,t.createElement)(o.__experimentalToolsPanelItem,{hasValue:()=>!!n,label:(0,l.__)("Aspect ratio"),onDeselect:()=>g({aspectRatio:void 0}),resetAllFilter:()=>({aspectRatio:void 0}),isShownByDefault:!0,panelId:i},(0,t.createElement)(o.SelectControl,{__nextHasNoMarginBottom:!0,label:(0,l.__)("Aspect ratio"),value:n,options:[{label:(0,l.__)("Original"),value:"auto"},{label:(0,l.__)("Square"),value:"1"},{label:(0,l.__)("16:9"),value:"16/9"},{label:(0,l.__)("4:3"),value:"4/3"},{label:(0,l.__)("3:2"),value:"3/2"},{label:(0,l.__)("9:16"),value:"9/16"},{label:(0,l.__)("3:4"),value:"3/4"},{label:(0,l.__)("2:3"),value:"2/3"}],onChange:e=>g({aspectRatio:e})})),(0,t.createElement)(o.__experimentalToolsPanelItem,{className:"single-column",hasValue:()=>!!h,label:(0,l.__)("Height"),onDeselect:()=>g({height:void 0}),resetAllFilter:()=>({height:void 0}),isShownByDefault:!0,panelId:i},(0,t.createElement)(o.__experimentalUnitControl,{label:(0,l.__)("Height"),labelPosition:"top",value:h||"",min:0,onChange:e=>v("height",e),units:m})),(0,t.createElement)(o.__experimentalToolsPanelItem,{className:"single-column",hasValue:()=>!!c,label:(0,l.__)("Width"),onDeselect:()=>g({width:void 0}),resetAllFilter:()=>({width:void 0}),isShownByDefault:!0,panelId:i},(0,t.createElement)(o.__experimentalUnitControl,{label:(0,l.__)("Width"),labelPosition:"top",value:c||"",min:0,onChange:e=>v("width",e),units:m})),b&&(0,t.createElement)(o.__experimentalToolsPanelItem,{hasValue:()=>!!p&&p!==s,label:w,onDeselect:()=>g({scale:s}),resetAllFilter:()=>({scale:s}),isShownByDefault:!0,panelId:i},(0,t.createElement)(o.__experimentalToggleGroupControl,{__nextHasNoMarginBottom:!0,label:w,value:p,help:u[p],onChange:e=>g({scale:e}),isBlock:!0},r)),!!_.length&&(0,t.createElement)(o.__experimentalToolsPanelItem,{hasValue:()=>!!d,label:(0,l.__)("Resolution"),onDeselect:()=>g({sizeSlug:void 0}),resetAllFilter:()=>({sizeSlug:void 0}),isShownByDefault:!1,panelId:i},(0,t.createElement)(o.SelectControl,{__nextHasNoMarginBottom:!0,label:(0,l.__)("Resolution"),value:d||"full",options:_,onChange:e=>g({sizeSlug:e}),help:(0,l.__)("Select the size of the source image.")})))};function h(e){let{dimensions:a,style:o,className:i}=e;const n=(0,t.useMemo)((()=>function(e){let{width:t,height:l}=e;return`data:image/svg+xml;charset=UTF-8,${encodeURIComponent(`\n\t\t\t\n\t\t\t\n\t\t`.replace(/[\t\n\r]/gim,"").replace(/\s\s+/g," ")).replace(/\(/g,"%28").replace(/\)/g,"%29")}`}(a)),[a]);return(0,t.createElement)("img",{alt:(0,l.__)("Placeholder image"),className:i,src:n,style:o,width:a.width,height:a.height})}function p(e,t){var l,a;return null==e||null===(l=e.media_details)||void 0===l||null===(a=l.sizes[t])||void 0===a?void 0:a.source_url}var d=JSON.parse('{"u2":"cap/coauthor-featured-image"}');(0,e.registerBlockType)(d.u2,{edit:function(e){let{attributes:r,setAttributes:s,context:u,clientId:d}=e;const{aspectRatio:g,height:_,isLink:m,rel:v,scale:w,sizeSlug:b,verticalAlign:f,width:x}=r,S=(0,i.useSelect)((e=>e("cap/blocks").getAuthorPlaceholder()),[]),E=u["cap/author"]||S,C=(0,i.useSelect)((e=>0!==E.featured_media&&e(n.store).getMedia(E.featured_media,{context:"view"})),[E.featured_media]),{imageSizes:y,imageDimensions:k}=(0,i.useSelect)((e=>e(a.store).getSettings()),[]),I=y.map((e=>{let{name:t,slug:l}=e;return{value:l,label:t}})),O=function(e,t,l){if(e&&"full"===l)return l;const a=function(e,t){if(!e)return Object.keys(t);const l=Object.keys(e.media_details.sizes),a=Object.keys(t);return Array.from(new Set([...l.filter((e=>a.includes(e)))]))}(e,t);return l&&a.includes(l)?l:a[Math.max(0,a.length-1)]}(C,k,b),B=function(e,t,l){if(!e)return{};const a=e.media_details.sizes[l];if("full"===l)return{width:a.width,height:a.height};const o=t[l];if(!0===o.crop||o.width===o.height)return{width:o.width,height:o.height};const i=a.width/a.height;return o.width>o.height?{width:o.width,height:o.width/i}:{width:o.height*i,height:o.height}}(C,k,O),A=C?{}:function(e,t){const l=e[t];return!0===l.crop||l.width===l.height?{width:l.width,height:l.height}:l.width>l.height?{width:l.width,height:l.width}:{width:l.height,height:l.height}}(k,O),T=(0,a.__experimentalUseBorderProps)(r),N=0!==E.id&&!1===C;return(0,t.createElement)(t.Fragment,null,(0,t.createElement)(c,{clientId:d,attributes:r,setAttributes:s,imageSizeOptions:I}),N?null:(0,t.createElement)("figure",(0,a.useBlockProps)(),C?(0,t.createElement)("img",{alt:(0,l.__)("Author featured image","co-authors-plus"),className:T.className,src:p(C,O),style:{width:!x&&_?"auto":x,height:!_&&x?"auto":_,aspectRatio:g,objectFit:w,verticalAlign:f,...T.style},width:B.width,height:B.height}):(0,t.createElement)(h,{className:T.className,dimensions:A,style:{width:!x&&_?"auto":x,height:!_&&x?"auto":_,aspectRatio:g,objectFit:w,verticalAlign:f,...T.style}})),(0,t.createElement)(a.InspectorControls,null,(0,t.createElement)(o.PanelBody,{title:(0,l.__)("Featured Image Settings","co-authors-plus")},(0,t.createElement)(o.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,l.__)("Make featured image a link to author archive.","co-authors-plus"),onChange:()=>s({isLink:!m}),checked:m}),m&&(0,t.createElement)(o.TextControl,{__nextHasNoMarginBottom:!0,label:(0,l.__)("Link rel","co-authors-plus"),value:v,onChange:e=>s({rel:e})})),(0,t.createElement)(o.PanelBody,{initialOpen:!1,title:(0,l.__)("Co-authors Layout","co-authors-plus")},(0,t.createElement)(o.SelectControl,{label:(0,l.__)("Vertical align","co-authors-plus"),value:f,options:[{value:"",label:(0,l.__)("Default","co-authors-plus")},{value:"baseline",label:(0,l.__)("Baseline","co-authors-plus")},{value:"bottom",label:(0,l.__)("Bottom","co-authors-plus")},{value:"middle",label:(0,l.__)("Middle","co-authors-plus")},{value:"sub",label:(0,l.__)("Sub","co-authors-plus")},{value:"super",label:(0,l.__)("Super","co-authors-plus")},{value:"text-bottom",label:(0,l.__)("Text Bottom","co-authors-plus")},{value:"text-top",label:(0,l.__)("Text Top","co-authors-plus")},{value:"top",label:(0,l.__)("Top","co-authors-plus")}],onChange:e=>{s({verticalAlign:""===e?void 0:e})},help:(0,l.__)("Vertical alignment defaults to bottom in the block layout and middle in the inline layout.","co-authors-plus")}))))}})}},l={};function a(e){var o=l[e];if(void 0!==o)return o.exports;var i=l[e]={exports:{}};return t[e](i,i.exports,a),i.exports}a.m=t,e=[],a.O=function(t,l,o,i){if(!l){var n=1/0;for(c=0;c=i)&&Object.keys(a.O).every((function(e){return a.O[e](l[s])}))?l.splice(s--,1):(r=!1,i0&&e[c-1][2]>i;c--)e[c]=e[c-1];e[c]=[l,o,i]},a.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},function(){var e={335:0,597:0};a.O.j=function(t){return 0===e[t]};var t=function(t,l){var o,i,n=l[0],r=l[1],s=l[2],u=0;if(n.some((function(t){return 0!==e[t]}))){for(o in r)a.o(r,o)&&(a.m[o]=r[o]);if(s)var c=s(a)}for(t&&t(l);u{let{clientId:l,attributes:{aspectRatio:a,width:r,height:s,scale:p,sizeSlug:m},setAttributes:d,imageSizeOptions:g=[]}=e;const _=(0,n.__experimentalUseCustomUnits)({availableUnits:(0,i.useSetting)("spacing.units")||["px","%","vw","em","rem"]}),v=(e,t)=>{const l=parseFloat(t);isNaN(l)&&t||d({[e]:l<0?"0":t})},w=(0,o._x)("Scale","Image scaling options"),b=s||a&&"auto"!==a;return(0,t.createElement)(i.InspectorControls,{group:"dimensions"},(0,t.createElement)(n.__experimentalToolsPanelItem,{hasValue:()=>!!a,label:(0,o.__)("Aspect ratio"),onDeselect:()=>d({aspectRatio:void 0}),resetAllFilter:()=>({aspectRatio:void 0}),isShownByDefault:!0,panelId:l},(0,t.createElement)(n.SelectControl,{__nextHasNoMarginBottom:!0,label:(0,o.__)("Aspect ratio"),value:a,options:[{label:(0,o.__)("Original"),value:"auto"},{label:(0,o.__)("Square"),value:"1"},{label:(0,o.__)("16:9"),value:"16/9"},{label:(0,o.__)("4:3"),value:"4/3"},{label:(0,o.__)("3:2"),value:"3/2"},{label:(0,o.__)("9:16"),value:"9/16"},{label:(0,o.__)("3:4"),value:"3/4"},{label:(0,o.__)("2:3"),value:"2/3"}],onChange:e=>d({aspectRatio:e})})),(0,t.createElement)(n.__experimentalToolsPanelItem,{className:"single-column",hasValue:()=>!!s,label:(0,o.__)("Height"),onDeselect:()=>d({height:void 0}),resetAllFilter:()=>({height:void 0}),isShownByDefault:!0,panelId:l},(0,t.createElement)(n.__experimentalUnitControl,{label:(0,o.__)("Height"),labelPosition:"top",value:s||"",min:0,onChange:e=>v("height",e),units:_})),(0,t.createElement)(n.__experimentalToolsPanelItem,{className:"single-column",hasValue:()=>!!r,label:(0,o.__)("Width"),onDeselect:()=>d({width:void 0}),resetAllFilter:()=>({width:void 0}),isShownByDefault:!0,panelId:l},(0,t.createElement)(n.__experimentalUnitControl,{label:(0,o.__)("Width"),labelPosition:"top",value:r||"",min:0,onChange:e=>v("width",e),units:_})),b&&(0,t.createElement)(n.__experimentalToolsPanelItem,{hasValue:()=>!!p&&p!==u,label:w,onDeselect:()=>d({scale:u}),resetAllFilter:()=>({scale:u}),isShownByDefault:!0,panelId:l},(0,t.createElement)(n.__experimentalToggleGroupControl,{__nextHasNoMarginBottom:!0,label:w,value:p,help:h[p],onChange:e=>d({scale:e}),isBlock:!0},c)),!!g.length&&(0,t.createElement)(n.__experimentalToolsPanelItem,{hasValue:()=>!!m,label:(0,o.__)("Resolution"),onDeselect:()=>d({sizeSlug:void 0}),resetAllFilter:()=>({sizeSlug:void 0}),isShownByDefault:!1,panelId:l},(0,t.createElement)(n.SelectControl,{__nextHasNoMarginBottom:!0,label:(0,o.__)("Resolution"),value:m||"full",options:g,onChange:e=>d({sizeSlug:e}),help:(0,o.__)("Select the size of the source image.")})))};function m(e){let{dimensions:l,style:a,className:i}=e;const n=(0,t.useMemo)((()=>function(e){let{width:t,height:l}=e;return`data:image/svg+xml;charset=UTF-8,${encodeURIComponent(`\n\t\t\t\n\t\t\t\n\t\t`.replace(/[\t\n\r]/gim,"").replace(/\s\s+/g," ")).replace(/\(/g,"%28").replace(/\)/g,"%29")}`}(l)),[l]);return(0,t.createElement)("img",{alt:(0,o.__)("Placeholder image"),className:i,src:n,style:a,width:l.width,height:l.height})}function d(e,t){var l,a;return null==e||null===(l=e.media_details)||void 0===l||null===(a=l.sizes[t])||void 0===a?void 0:a.source_url}var g=JSON.parse('{"u2":"cap/coauthor-featured-image"}');(0,e.registerBlockType)(g.u2,{edit:function(e){let{attributes:l,setAttributes:a,context:c,clientId:u}=e;const{aspectRatio:h,height:g,isLink:_,rel:v,scale:w,sizeSlug:b,verticalAlign:f,width:x}=l,S=(0,r.useSelect)((e=>e("cap/blocks").getAuthorPlaceholder()),[]),E=c["cap/author"]||S,C=(0,r.useSelect)((e=>0!==E.featured_media&&e(s.store).getMedia(E.featured_media,{context:"view"})),[E.featured_media]),{imageSizes:y,imageDimensions:k}=(0,r.useSelect)((e=>e(i.store).getSettings()),[]),I=y.map((e=>{let{name:t,slug:l}=e;return{value:l,label:t}})),B=function(e,t,l){if(e&&"full"===l)return l;const a=function(e,t){if(!e)return Object.keys(t);const l=Object.keys(e.media_details.sizes),a=Object.keys(t);return Array.from(new Set([...l.filter((e=>a.includes(e)))]))}(e,t);return l&&a.includes(l)?l:a[Math.max(0,a.length-1)]}(C,k,b),O=function(e,t,l){if(!e)return{};const a=e.media_details.sizes[l];if("full"===l)return{width:a.width,height:a.height};const o=t[l];if(!0===o.crop||o.width===o.height)return{width:o.width,height:o.height};const i=a.width/a.height;return o.width>o.height?{width:o.width,height:o.width/i}:{width:o.height*i,height:o.height}}(C,k,B),A=C?{}:function(e,t){const l=e[t];return!0===l.crop||l.width===l.height?{width:l.width,height:l.height}:l.width>l.height?{width:l.width,height:l.width}:{width:l.height,height:l.height}}(k,B),T=(0,i.__experimentalUseBorderProps)(l),N=0!==E.id&&!1===C;return(0,t.createElement)(t.Fragment,null,(0,t.createElement)(p,{clientId:u,attributes:l,setAttributes:a,imageSizeOptions:I}),N?null:(0,t.createElement)("figure",(0,i.useBlockProps)(),C?(0,t.createElement)("img",{alt:(0,o.__)("Author featured image","co-authors-plus"),className:T.className,src:d(C,B),style:{width:!x&&g?"auto":x,height:!g&&x?"auto":g,aspectRatio:h,objectFit:w,verticalAlign:f,...T.style},width:O.width,height:O.height}):(0,t.createElement)(m,{className:T.className,dimensions:A,style:{width:!x&&g?"auto":x,height:!g&&x?"auto":g,aspectRatio:h,objectFit:w,verticalAlign:f,...T.style}})),(0,t.createElement)(i.InspectorControls,null,(0,t.createElement)(n.PanelBody,{title:(0,o.__)("Featured Image Settings","co-authors-plus")},(0,t.createElement)(n.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,o.__)("Make featured image a link to author archive.","co-authors-plus"),onChange:()=>a({isLink:!_}),checked:_}),_&&(0,t.createElement)(n.TextControl,{__nextHasNoMarginBottom:!0,label:(0,o.__)("Link rel","co-authors-plus"),value:v,onChange:e=>a({rel:e})})),(0,t.createElement)(n.PanelBody,{initialOpen:!1,title:(0,o.__)("Co-authors Layout","co-authors-plus")},(0,t.createElement)(n.SelectControl,{label:(0,o.__)("Vertical align","co-authors-plus"),value:f,options:[{value:"",label:(0,o.__)("Default","co-authors-plus")},{value:"baseline",label:(0,o.__)("Baseline","co-authors-plus")},{value:"bottom",label:(0,o.__)("Bottom","co-authors-plus")},{value:"middle",label:(0,o.__)("Middle","co-authors-plus")},{value:"sub",label:(0,o.__)("Sub","co-authors-plus")},{value:"super",label:(0,o.__)("Super","co-authors-plus")},{value:"text-bottom",label:(0,o.__)("Text Bottom","co-authors-plus")},{value:"text-top",label:(0,o.__)("Text Top","co-authors-plus")},{value:"top",label:(0,o.__)("Top","co-authors-plus")}],onChange:e=>{a({verticalAlign:""===e?void 0:e})},help:(0,o.__)("Vertical alignment defaults to bottom in the block layout and middle in the inline layout.","co-authors-plus")}))))},icon:a})}},l={};function a(e){var o=l[e];if(void 0!==o)return o.exports;var i=l[e]={exports:{}};return t[e](i,i.exports,a),i.exports}a.m=t,e=[],a.O=function(t,l,o,i){if(!l){var n=1/0;for(u=0;u=i)&&Object.keys(a.O).every((function(e){return a.O[e](l[s])}))?l.splice(s--,1):(r=!1,i0&&e[u-1][2]>i;u--)e[u]=e[u-1];e[u]=[l,o,i]},a.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},function(){var e={335:0,597:0};a.O.j=function(t){return 0===e[t]};var t=function(t,l){var o,i,n=l[0],r=l[1],s=l[2],c=0;if(n.some((function(t){return 0!==e[t]}))){for(o in r)a.o(r,o)&&(a.m[o]=r[o]);if(s)var u=s(a)}for(t&&t(l);c array('wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-element', 'wp-i18n'), 'version' => '530471a71157d61748d3'); + array('wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-element', 'wp-i18n', 'wp-primitives'), 'version' => '7ea4fb2a6653b8b06014'); diff --git a/build/blocks/block-coauthor-name/index.js b/build/blocks/block-coauthor-name/index.js index d7053441..ce2b24c7 100644 --- a/build/blocks/block-coauthor-name/index.js +++ b/build/blocks/block-coauthor-name/index.js @@ -1 +1 @@ -!function(){var e={184:function(e,t){var n;!function(){"use strict";var o={}.hasOwnProperty;function l(){for(var e=[],t=0;te("cap/blocks").getAuthorPlaceholder()),[]),m=n["cap/author"]||g,{link:v,display_name:d}=m,b=h;return(0,t.createElement)(t.Fragment,null,(0,t.createElement)(o.BlockControls,null,(0,t.createElement)(o.AlignmentControl,{value:f,onChange:e=>{c({textAlign:e})}})),(0,t.createElement)(b,(0,o.useBlockProps)({className:i()({[`has-text-align-${f}`]:f})}),s?(0,t.createElement)("a",{href:v,rel:p,onClick:e=>e.preventDefault()},d):d),(0,t.createElement)(o.InspectorControls,null,(0,t.createElement)(l.PanelBody,{title:(0,r.__)("Settings","co-authors-plus")},(0,t.createElement)(l.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,r.__)("Make co-author name a link","co-authors-plus"),onChange:()=>c({isLink:!s}),checked:s}),s&&(0,t.createElement)(t.Fragment,null,(0,t.createElement)(l.TextControl,{__nextHasNoMarginBottom:!0,label:(0,r.__)("Link rel","co-authors-plus"),value:p,onChange:e=>c({rel:e})})))),(0,t.createElement)(o.InspectorControls,{group:"advanced"},(0,t.createElement)(l.SelectControl,{__nextHasNoMarginBottom:!0,label:(0,r.__)("HTML element","co-authors-plus"),options:[{label:(0,r.__)("Default (

)"),value:"p"},{label:"",value:"span"},{label:"

",value:"h1"},{label:"

",value:"h2"},{label:"

",value:"h3"},{label:"

",value:"h4"},{label:"

",value:"h5"},{label:"
",value:"h6"}],value:h,onChange:e=>c({tagName:e})})))}})}()}(); \ No newline at end of file +!function(){var e={184:function(e,t){var n;!function(){"use strict";var l={}.hasOwnProperty;function o(){for(var e=[],t=0;te("cap/blocks").getAuthorPlaceholder()),[]),g=n["cap/author"]||m,{link:d,display_name:f}=g,w=h;return(0,t.createElement)(t.Fragment,null,(0,t.createElement)(r.BlockControls,null,(0,t.createElement)(r.AlignmentControl,{value:v,onChange:e=>{o({textAlign:e})}})),(0,t.createElement)(w,(0,r.useBlockProps)({className:s()({[`has-text-align-${v}`]:v})}),c?(0,t.createElement)("a",{href:d,rel:p,onClick:e=>e.preventDefault()},f):f),(0,t.createElement)(r.InspectorControls,null,(0,t.createElement)(a.PanelBody,{title:(0,i.__)("Settings","co-authors-plus")},(0,t.createElement)(a.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,i.__)("Make co-author name a link","co-authors-plus"),onChange:()=>o({isLink:!c}),checked:c}),c&&(0,t.createElement)(t.Fragment,null,(0,t.createElement)(a.TextControl,{__nextHasNoMarginBottom:!0,label:(0,i.__)("Link rel","co-authors-plus"),value:p,onChange:e=>o({rel:e})})))),(0,t.createElement)(r.InspectorControls,{group:"advanced"},(0,t.createElement)(a.SelectControl,{__nextHasNoMarginBottom:!0,label:(0,i.__)("HTML element","co-authors-plus"),options:[{label:(0,i.__)("Default (

)"),value:"p"},{label:"",value:"span"},{label:"

",value:"h1"},{label:"

",value:"h2"},{label:"

",value:"h3"},{label:"

",value:"h4"},{label:"

",value:"h5"},{label:"
",value:"h6"}],value:h,onChange:e=>o({tagName:e})})))},icon:o})}()}(); \ No newline at end of file diff --git a/build/blocks/block-coauthors/block.json b/build/blocks/block-coauthors/block.json index ea25755b..61e6fe48 100644 --- a/build/blocks/block-coauthors/block.json +++ b/build/blocks/block-coauthors/block.json @@ -5,7 +5,6 @@ "version": "1.0.0", "title": "Co-Authors", "category": "widgets", - "icon": "smiley", "description": "Display the co-authors for a post.", "supports": { "html": false, diff --git a/build/blocks/block-coauthors/index.asset.php b/build/blocks/block-coauthors/index.asset.php index 9e7f2cf3..df8d749a 100644 --- a/build/blocks/block-coauthors/index.asset.php +++ b/build/blocks/block-coauthors/index.asset.php @@ -1 +1 @@ - array('wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-element', 'wp-i18n', 'wp-primitives'), 'version' => 'ce764864a737c3f17b0f'); + array('wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-element', 'wp-i18n', 'wp-primitives'), 'version' => 'e46f69cfdde7d5f80416'); diff --git a/build/blocks/block-coauthors/index.js b/build/blocks/block-coauthors/index.js index 804ddbe9..e1bc771e 100644 --- a/build/blocks/block-coauthors/index.js +++ b/build/blocks/block-coauthors/index.js @@ -1 +1 @@ -!function(){var e,t={441:function(e,t,o){"use strict";var n=window.wp.blocks,r=window.wp.element,a=window.wp.blockEditor,l=window.wp.components,c=window.wp.apiFetch,i=o.n(c),s=window.wp.data,u=window.wp.i18n,p=window.wp.primitives,h=(0,r.createElement)(p.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,r.createElement)(p.Path,{d:"M4 4v1.5h16V4H4zm8 8.5h8V11h-8v1.5zM4 20h16v-1.5H4V20zm4-8c0-1.1-.9-2-2-2s-2 .9-2 2 .9 2 2 2 2-.9 2-2z"})),v=(0,r.createElement)(p.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,r.createElement)(p.Path,{d:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-7.8 16.5H5c-.3 0-.5-.2-.5-.5v-6.2h6.8v6.7zm0-8.3H4.5V5c0-.3.2-.5.5-.5h6.2v6.7zm8.3 7.8c0 .3-.2.5-.5.5h-6.2v-6.8h6.8V19zm0-7.8h-6.8V4.5H19c.3 0 .5.2.5.5v6.2z",fillRule:"evenodd",clipRule:"evenodd"})),f=o(184),d=o.n(f);function m(){return m=Object.assign?Object.assign.bind():function(e){for(var t=1;t{l(o)},s={display:n?"none":void 0};return(0,r.createElement)("div",m({},c,{tabIndex:0,role:"button",onClick:i,onKeyUp:i,style:s}))}));function w(){return(0,r.createElement)("div",(0,a.useInnerBlocksProps)({className:"wp-block-cap-coauthor"},{template:[["cap/coauthor-name"]]}))}const g=["core/bold","core/italic","core/text-color"];var y=JSON.parse('{"u2":"cap/coauthors"}');(0,n.registerBlockType)(y.u2,{edit:function(e){var t,o;let{attributes:n,setAttributes:c,clientId:p,context:f,isSelected:m}=e;const{prefix:y,separator:x,lastSeparator:k,suffix:_,layout:E,textAlign:C}=n,{postId:S}=f,O=(0,s.useSelect)((e=>e("cap/blocks").getAuthorPlaceholder()),[]),[B,P]=(0,r.useState)([O]),[A,I]=(0,r.useState)(),N=(0,s.useDispatch)("core/notices");function V(e){"AbortError"!==e.name&&N.createErrorNotice(e.message,{isDismissible:!0})}(0,r.useEffect)((()=>{if(!S)return;const e=new AbortController;return i()({path:`/coauthors-blocks/v1/coauthors/${S}/`,signal:e.signal}).then(P).catch(V),()=>{e.abort()}}),[S]);const j=(0,s.useSelect)((e=>e(a.store).getBlocks(p))),z=e=>{c({layout:{...E,...e}})},G=[{icon:h,title:(0,u.__)("Inline","co-authors-plus"),onClick:()=>z({type:"inline"}),isActive:"inline"===E.type},{icon:v,title:(0,u.__)("Block","co-authors-plus"),onClick:()=>z({type:"block"}),isActive:"block"===E.type}];return(0,r.createElement)(r.Fragment,null,(0,r.createElement)(a.BlockControls,null,(0,r.createElement)(l.ToolbarGroup,{controls:G}),(0,r.createElement)(a.AlignmentControl,{value:C,onChange:e=>{c({textAlign:e})}})),(0,r.createElement)("div",(0,a.useBlockProps)({className:d()({[`is-layout-cap-${E.type}`]:E.type,[`has-text-align-${C}`]:C}),style:{gap:(0,a.__experimentalGetGapCSSValue)(null==n||null===(t=n.style)||void 0===t||null===(o=t.spacing)||void 0===o?void 0:o.blockGap)}}),B&&"inline"===E.type&&(m||y)&&(0,r.createElement)(a.RichText,{allowedFormats:g,className:"wp-block-cap-coauthors__prefix",multiline:!1,"aria-label":(0,u.__)("Prefix","co-authors-plus"),placeholder:(0,u.__)("Prefix","co-authors-plus")+" ",value:y,onChange:e=>c({prefix:e}),tagName:"span"}),B&&B.map((e=>{var t;const o=e.id===(A||(null===(t=B[0])||void 0===t?void 0:t.id));return(0,r.createElement)(a.BlockContextProvider,{key:e.id,value:{"cap/author":e}},o?(0,r.createElement)(w,null):null,(0,r.createElement)(b,{blocks:j,blockContextId:e.id,setActiveBlockContextId:I,isHidden:o}))})).reduce(((e,t,o,n)=>(0,r.createElement)(r.Fragment,null,e,"inline"===E.type&&(0,r.createElement)("span",{className:"wp-block-cap-coauthors__separator"},k&&o===n.length-1?`${k}`:`${x}`),t))),B&&"inline"===E.type&&(m||_)&&(0,r.createElement)(a.RichText,{allowedFormats:g,className:"wp-block-cap-coauthors__suffix",multiline:!1,"aria-label":(0,u.__)("Suffix"),placeholder:(0,u.__)("Suffix")+" ",value:_,onChange:e=>c({suffix:e}),tagName:"span"})),(0,r.createElement)(a.InspectorControls,null,"inline"===E.type&&(0,r.createElement)(l.PanelBody,{title:(0,u.__)("Co-authors Layout","co-authors-plus")},(0,r.createElement)(l.TextControl,{autoComplete:"off",label:(0,u.__)("Separator","co-authors-plus"),value:x||"",onChange:e=>{c({separator:e})},help:(0,u.__)("Enter character(s) used to separate authors.","co-authors-plus")}),(0,r.createElement)(l.TextControl,{autoComplete:"off",label:(0,u.__)("Last Separator","co-authors-plus"),value:k||"",onChange:e=>{c({lastSeparator:e})},help:(0,u.__)("Enter character(s) used to separate the last author.","co-authors-plus")}))))},save:function(e){var t,o;let{attributes:n}=e;const{layout:l,textAlign:c}=n,i={gap:"block"===l.type?(0,a.__experimentalGetGapCSSValue)(null===(t=n.style)||void 0===t||null===(o=t.spacing)||void 0===o?void 0:o.blockGap):null},s=d()({[`is-layout-cap-${l.type}`]:l.type,[`has-text-align-${c}`]:c});return(0,r.createElement)("div",a.useBlockProps.save({className:s,style:i}),(0,r.createElement)(a.InnerBlocks.Content,null))}})},184:function(e,t){var o;!function(){"use strict";var n={}.hasOwnProperty;function r(){for(var e=[],t=0;t=a)&&Object.keys(n.O).every((function(e){return n.O[e](o[i])}))?o.splice(i--,1):(c=!1,a0&&e[u-1][2]>a;u--)e[u]=e[u-1];e[u]=[o,r,a]},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,{a:t}),t},n.d=function(e,t){for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},function(){var e={887:0,270:0};n.O.j=function(t){return 0===e[t]};var t=function(t,o){var r,a,l=o[0],c=o[1],i=o[2],s=0;if(l.some((function(t){return 0!==e[t]}))){for(r in c)n.o(c,r)&&(n.m[r]=c[r]);if(i)var u=i(n)}for(t&&t(o);s{a(o)},s={display:n?"none":void 0};return(0,r.createElement)("div",w({},l,{tabIndex:0,role:"button",onClick:i,onKeyUp:i,style:s}))}));function g(){return(0,r.createElement)("div",(0,c.useInnerBlocksProps)({className:"wp-block-cap-coauthor"},{template:[["cap/coauthor-name"]]}))}const y=["core/bold","core/italic","core/text-color"];var x=JSON.parse('{"u2":"cap/coauthors"}');(0,n.registerBlockType)(x.u2,{edit:function(e){var t,o;let{attributes:n,setAttributes:a,clientId:l,context:s,isSelected:d}=e;const{prefix:w,separator:x,lastSeparator:k,suffix:_,layout:E,textAlign:C}=n,{postId:S}=s,O=(0,p.useSelect)((e=>e("cap/blocks").getAuthorPlaceholder()),[]),[A,B]=(0,r.useState)([O]),[P,z]=(0,r.useState)(),I=(0,p.useDispatch)("core/notices");function N(e){"AbortError"!==e.name&&I.createErrorNotice(e.message,{isDismissible:!0})}(0,r.useEffect)((()=>{if(!S)return;const e=new AbortController;return u()({path:`/coauthors-blocks/v1/coauthors/${S}/`,signal:e.signal}).then(B).catch(N),()=>{e.abort()}}),[S]);const j=(0,p.useSelect)((e=>e(c.store).getBlocks(l))),G=e=>{a({layout:{...E,...e}})},V=[{icon:h,title:(0,v.__)("Inline","co-authors-plus"),onClick:()=>G({type:"inline"}),isActive:"inline"===E.type},{icon:f,title:(0,v.__)("Block","co-authors-plus"),onClick:()=>G({type:"block"}),isActive:"block"===E.type}];return(0,r.createElement)(r.Fragment,null,(0,r.createElement)(c.BlockControls,null,(0,r.createElement)(i.ToolbarGroup,{controls:V}),(0,r.createElement)(c.AlignmentControl,{value:C,onChange:e=>{a({textAlign:e})}})),(0,r.createElement)("div",(0,c.useBlockProps)({className:m()({[`is-layout-cap-${E.type}`]:E.type,[`has-text-align-${C}`]:C}),style:{gap:(0,c.__experimentalGetGapCSSValue)(null==n||null===(t=n.style)||void 0===t||null===(o=t.spacing)||void 0===o?void 0:o.blockGap)}}),A&&"inline"===E.type&&(d||w)&&(0,r.createElement)(c.RichText,{allowedFormats:y,className:"wp-block-cap-coauthors__prefix",multiline:!1,"aria-label":(0,v.__)("Prefix","co-authors-plus"),placeholder:(0,v.__)("Prefix","co-authors-plus")+" ",value:w,onChange:e=>a({prefix:e}),tagName:"span"}),A&&A.map((e=>{var t;const o=e.id===(P||(null===(t=A[0])||void 0===t?void 0:t.id));return(0,r.createElement)(c.BlockContextProvider,{key:e.id,value:{"cap/author":e}},o?(0,r.createElement)(g,null):null,(0,r.createElement)(b,{blocks:j,blockContextId:e.id,setActiveBlockContextId:z,isHidden:o}))})).reduce(((e,t,o,n)=>(0,r.createElement)(r.Fragment,null,e,"inline"===E.type&&(0,r.createElement)("span",{className:"wp-block-cap-coauthors__separator"},k&&o===n.length-1?`${k}`:`${x}`),t))),A&&"inline"===E.type&&(d||_)&&(0,r.createElement)(c.RichText,{allowedFormats:y,className:"wp-block-cap-coauthors__suffix",multiline:!1,"aria-label":(0,v.__)("Suffix"),placeholder:(0,v.__)("Suffix")+" ",value:_,onChange:e=>a({suffix:e}),tagName:"span"})),(0,r.createElement)(c.InspectorControls,null,"inline"===E.type&&(0,r.createElement)(i.PanelBody,{title:(0,v.__)("Co-authors Layout","co-authors-plus")},(0,r.createElement)(i.TextControl,{autoComplete:"off",label:(0,v.__)("Separator","co-authors-plus"),value:x||"",onChange:e=>{a({separator:e})},help:(0,v.__)("Enter character(s) used to separate authors.","co-authors-plus")}),(0,r.createElement)(i.TextControl,{autoComplete:"off",label:(0,v.__)("Last Separator","co-authors-plus"),value:k||"",onChange:e=>{a({lastSeparator:e})},help:(0,v.__)("Enter character(s) used to separate the last author.","co-authors-plus")}))))},save:function(e){var t,o;let{attributes:n}=e;const{layout:a,textAlign:l}=n,i={gap:"block"===a.type?(0,c.__experimentalGetGapCSSValue)(null===(t=n.style)||void 0===t||null===(o=t.spacing)||void 0===o?void 0:o.blockGap):null},s=m()({[`is-layout-cap-${a.type}`]:a.type,[`has-text-align-${l}`]:l});return(0,r.createElement)("div",c.useBlockProps.save({className:s,style:i}),(0,r.createElement)(c.InnerBlocks.Content,null))},icon:l})},184:function(e,t){var o;!function(){"use strict";var n={}.hasOwnProperty;function r(){for(var e=[],t=0;t=a)&&Object.keys(n.O).every((function(e){return n.O[e](o[i])}))?o.splice(i--,1):(c=!1,a0&&e[u-1][2]>a;u--)e[u]=e[u-1];e[u]=[o,r,a]},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,{a:t}),t},n.d=function(e,t){for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},function(){var e={887:0,270:0};n.O.j=function(t){return 0===e[t]};var t=function(t,o){var r,a,l=o[0],c=o[1],i=o[2],s=0;if(l.some((function(t){return 0!==e[t]}))){for(r in c)n.o(c,r)&&(n.m[r]=c[r]);if(i)var u=i(n)}for(t&&t(o);s