updated plugin ActivityPub version 9.1.0
This commit is contained in:
@ -2,7 +2,7 @@
|
||||
"$schema": "https://schemas.wp.org/trunk/block.json",
|
||||
"name": "activitypub/reactions",
|
||||
"apiVersion": 3,
|
||||
"version": "8.3.0",
|
||||
"version": "9.1.0",
|
||||
"title": "Fediverse Reactions",
|
||||
"category": "widgets",
|
||||
"icon": "heart",
|
||||
|
||||
@ -1 +1 @@
|
||||
<?php return array('dependencies' => array('react-jsx-runtime', 'wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-element', 'wp-i18n'), 'version' => '1e13568c338d5be171c1');
|
||||
<?php return array('dependencies' => array('react-jsx-runtime', 'wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-element', 'wp-i18n'), 'version' => '6306c831521d83d3a536');
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
(()=>{"use strict";var e,t={2091(e,t,s){const i=window.wp.blocks,r=window.wp.blockEditor,a=window.ReactJSXRuntime,n=[{attributes:{},supports:{html:!1,align:!0,layout:{default:{type:"constrained",orientation:"vertical",justifyContent:"center"}}},save:()=>(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(r.InnerBlocks.Content,{}),(0,a.jsx)("div",{className:"activitypub-reactions-block"})]})},{attributes:{title:{type:"string",default:"Fediverse reactions"}},supports:{html:!1,align:!0,layout:{default:{type:"constrained",orientation:"vertical",justifyContent:"center"}}},save:()=>null,isEligible:({title:e})=>!!e,migrate:({title:e,...t})=>[t,[(0,i.createBlock)("core/heading",{content:e,level:6})]]}];function o(e){var t,s,i="";if("string"==typeof e||"number"==typeof e)i+=e;else if("object"==typeof e)if(Array.isArray(e)){var r=e.length;for(t=0;t<r;t++)e[t]&&(s=o(e[t]))&&(i&&(i+=" "),i+=s)}else for(s in e)e[s]&&(i&&(i+=" "),i+=s);return i}const l=function(){for(var e,t,s=0,i="",r=arguments.length;s<r;s++)(e=arguments[s])&&(t=o(e))&&(i&&(i+=" "),i+=t);return i},c=window.wp.components,p=window.wp.i18n,u=window.wp.data,d=window.wp.element,f=window.wp.apiFetch;var v=s.n(f);function y(){return window._activityPubOptions||{}}const m={like:(0,p.__)("Like","activitypub"),likes:(0,p.__)("Like","activitypub"),repost:(0,p.__)("Repost","activitypub"),reposts:(0,p.__)("Repost","activitypub"),quote:(0,p.__)("Quote","activitypub"),quotes:(0,p.__)("Quote","activitypub")},h=({reactions:e,displayStyle:t})=>{const{defaultAvatarUrl:s}=y();return"compact"===t?null:(0,a.jsx)("ul",{className:"reaction-avatars",children:e.map((e,t)=>{const i=["reaction-avatar"].filter(Boolean).join(" "),r=e.avatar||s;return(0,a.jsx)("li",{children:(0,a.jsx)("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",children:(0,a.jsx)("img",{src:r,alt:e.name,className:i,width:"32",height:"32",onError:e=>{e.target.src=s}})})},t)})})},b=({reactions:e,displayStyle:t})=>{const{defaultAvatarUrl:s}=y();return(0,a.jsx)("ul",{className:"reactions-list",children:e.map((e,i)=>{const r=e.avatar||s;return(0,a.jsx)("li",{className:"reaction-item",children:(0,a.jsxs)("a",{href:e.url,className:"reaction-item",target:"_blank",rel:"noopener noreferrer",children:["facepile"===t&&(0,a.jsx)("img",{src:r,alt:e.name,width:"32",height:"32",onError:e=>{e.target.src=s}}),(0,a.jsx)("span",{className:"reaction-name",children:e.name})]})},i)})})},w=({items:e,label:t,displayStyle:s,showActions:i,actionLabel:r})=>{const[n,o]=(0,d.useState)(!1),[l,p]=(0,d.useState)(null),u=(0,d.useRef)(null),f=e.slice(0,20);return(0,a.jsxs)("div",{className:"reaction-group",ref:u,children:[i&&r&&(0,a.jsx)("button",{className:"reaction-action-button wp-element-button",type:"button",disabled:!0,children:r}),(0,a.jsx)(h,{reactions:f,displayStyle:s}),(0,a.jsx)(c.Button,{ref:p,className:"reaction-label is-link",onClick:()=>o(!n),"aria-expanded":n,children:t}),n&&l&&(0,a.jsx)(c.Popover,{anchor:l,onClose:()=>o(!1),className:"activitypub-popover",children:(0,a.jsx)(b,{reactions:e,displayStyle:s})})]})};function g({postId:e=null,reactions:t=null,fallbackReactions:s=null,displayStyle:i="facepile",showActions:r=!1}){const{namespace:n}=y(),[o,l]=(0,d.useState)(t),[c,p]=(0,d.useState)(!t),u=(0,d.useCallback)(()=>{s&&l(s),p(!1)},[s]);return(0,d.useEffect)(()=>{if(t)return l(t),void p(!1);e&&"number"==typeof e?(p(!0),v()({path:`/${n}/posts/${e}/reactions`}).then(e=>{const t=Object.values(e).some(e=>e.items?.length>0);l(!t&&s?s:e),p(!1)}).catch(u)):u()},[e,t,s,n,u]),c?null:o&&Object.values(o).some(e=>e.items?.length>0)?(0,a.jsx)("div",{className:"activitypub-reactions",children:Object.entries(o).map(([e,t])=>t.items?.length?(0,a.jsx)(w,{items:t.items,label:t.label,displayStyle:i,showActions:r,actionLabel:m[e]},e):null)}):null}const x=(e,t,s,i)=>Array.from({length:e},(e,r)=>({name:`${t} ${r+1}`,url:"#",avatar:`data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'%3E%3Ccircle cx='32' cy='32' r='32' fill='%23${i[r%i.length]}'/%3E%3Ctext x='32' y='38' font-family='sans-serif' font-size='24' fill='white' text-anchor='middle'%3E${String.fromCharCode(s+r)}%3C/text%3E%3C/svg%3E`})),j=["FF6B6B","4ECDC4","45B7D1","96CEB4","D4A5A5","9B59B6","3498DB","E67E22"],k={likes:{label:(0,p.sprintf)(/* translators: %d: Number of likes */ /* translators: %d: Number of likes */
|
||||
(0,p._x)("%d likes","number of likes","activitypub"),9),items:x(9,"User",65,j)},reposts:{label:(0,p.sprintf)(/* translators: %d: Number of reposts */ /* translators: %d: Number of reposts */
|
||||
(0,p._x)("%d reposts","number of reposts","activitypub"),6),items:x(6,"Reposter",82,j)},quotes:{label:(0,p.sprintf)(/* translators: %d: Number of quotes */ /* translators: %d: Number of quotes */
|
||||
(0,p._x)("%d quotes","number of quotes","activitypub"),7),items:x(7,"Quoter",81,j)}},_=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","name":"activitypub/reactions","apiVersion":3,"version":"8.2.1","title":"Fediverse Reactions","category":"widgets","icon":"heart","keywords":["fediverse","activitypub","likes","reposts"],"description":"Display Fediverse likes and reposts for your posts.","example":{"attributes":{"className":"is-style-facepile"}},"styles":[{"name":"facepile","label":"Facepile","isDefault":true},{"name":"compact","label":"Compact"}],"attributes":{"displayStyle":{"type":"string","default":"facepile"},"showActions":{"type":"boolean","default":false}},"supports":{"align":["wide","full"],"color":{"gradients":true},"__experimentalBorder":{"radius":true,"width":true,"color":true,"style":true},"html":false,"interactivity":true,"shadow":true,"typography":{"fontSize":true,"__experimentalDefaultControls":{"fontSize":true}}},"blockHooks":{"core/post-content":"after"},"textdomain":"activitypub","editorScript":"file:./index.js","style":"file:./style-index.css","viewStyle":"file:./view.css","viewScriptModule":"file:./view.js","viewScript":"wp-api-fetch","render":"file:./render.php"}');(0,i.registerBlockType)(_,{deprecated:n,edit:function({attributes:e,setAttributes:t}){const{className:s="",displayStyle:i="facepile",showActions:n=!1}=e,o=(0,r.useBlockProps)(),{getCurrentPostId:f}=(0,u.select)("core/editor"),{showAvatars:v=!0}=y(),m=(0,d.useRef)(!1);(0,d.useEffect)(()=>{if(m.current)return;m.current=!0;const e=s?.includes("is-style-");if(!e){const e=v?"facepile":"compact";t({className:l(s,`is-style-${e}`),displayStyle:e})}},[s,v,t]);const h=s?.includes("is-style-compact")?"compact":"facepile";(0,d.useEffect)(()=>{h!==i&&t({displayStyle:h})},[h,i,t]);const b=[["core/heading",{level:6,placeholder:(0,p.__)("Fediverse Reactions","activitypub"),content:(0,p.__)("Fediverse Reactions","activitypub")}]];return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(r.InspectorControls,{children:(0,a.jsx)(c.PanelBody,{title:(0,p.__)("Action Buttons","activitypub"),children:(0,a.jsx)(c.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,p.__)("Show action buttons","activitypub"),help:(0,p.__)("Display Like and Boost buttons so visitors can interact from their Fediverse server.","activitypub"),checked:n,onChange:e=>t({showActions:e})})})}),(0,a.jsxs)("div",{...o,children:[(0,a.jsx)(r.InnerBlocks,{template:b,allowedBlocks:["core/heading"],templateLock:"all",renderAppender:!1}),(0,a.jsx)(g,{postId:f(),fallbackReactions:k,displayStyle:i,showActions:n})]})]})},save:function(){return(0,a.jsx)("div",{...r.useBlockProps.save(),children:(0,a.jsx)(r.InnerBlocks.Content,{})})}})}},s={};function i(e){var r=s[e];if(void 0!==r)return r.exports;var a=s[e]={exports:{}};return t[e](a,a.exports,i),a.exports}i.m=t,e=[],i.O=(t,s,r,a)=>{if(!s){var n=1/0;for(p=0;p<e.length;p++){for(var[s,r,a]=e[p],o=!0,l=0;l<s.length;l++)(!1&a||n>=a)&&Object.keys(i.O).every(e=>i.O[e](s[l]))?s.splice(l--,1):(o=!1,a<n&&(n=a));if(o){e.splice(p--,1);var c=r();void 0!==c&&(t=c)}}return t}a=a||0;for(var p=e.length;p>0&&e[p-1][2]>a;p--)e[p]=e[p-1];e[p]=[s,r,a]},i.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return i.d(t,{a:t}),t},i.d=(e,t)=>{for(var s in t)i.o(t,s)&&!i.o(e,s)&&Object.defineProperty(e,s,{enumerable:!0,get:t[s]})},i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{var e={608:0,104:0};i.O.j=t=>0===e[t];var t=(t,s)=>{var r,a,[n,o,l]=s,c=0;if(n.some(t=>0!==e[t])){for(r in o)i.o(o,r)&&(i.m[r]=o[r]);if(l)var p=l(i)}for(t&&t(s);c<n.length;c++)a=n[c],i.o(e,a)&&e[a]&&e[a][0](),e[a]=0;return i.O(p)},s=globalThis.webpackChunkwordpress_activitypub=globalThis.webpackChunkwordpress_activitypub||[];s.forEach(t.bind(null,0)),s.push=t.bind(null,s.push.bind(s))})();var r=i.O(void 0,[104],()=>i(2091));r=i.O(r)})();
|
||||
(()=>{"use strict";var e={91(e,t,s){const i=window.wp.blocks,r=window.wp.blockEditor,n=window.ReactJSXRuntime,a=[{attributes:{},supports:{html:!1,align:!0,layout:{default:{type:"constrained",orientation:"vertical",justifyContent:"center"}}},save:()=>(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(r.InnerBlocks.Content,{}),(0,n.jsx)("div",{className:"activitypub-reactions-block"})]})},{attributes:{title:{type:"string",default:"Fediverse reactions"}},supports:{html:!1,align:!0,layout:{default:{type:"constrained",orientation:"vertical",justifyContent:"center"}}},save:()=>null,isEligible:({title:e})=>!!e,migrate:({title:e,...t})=>[t,[(0,i.createBlock)("core/heading",{content:e,level:6})]]}];function o(e){var t,s,i="";if("string"==typeof e||"number"==typeof e)i+=e;else if("object"==typeof e)if(Array.isArray(e)){var r=e.length;for(t=0;t<r;t++)e[t]&&(s=o(e[t]))&&(i&&(i+=" "),i+=s)}else for(s in e)e[s]&&(i&&(i+=" "),i+=s);return i}const l=function(){for(var e,t,s=0,i="",r=arguments.length;s<r;s++)(e=arguments[s])&&(t=o(e))&&(i&&(i+=" "),i+=t);return i},c=window.wp.components,u=window.wp.i18n,p=window.wp.data,d=window.wp.element,f=window.wp.apiFetch;var y=s.n(f);function v(){return window._activityPubOptions||{}}const m={like:(0,u.__)("Like","activitypub"),likes:(0,u.__)("Like","activitypub"),repost:(0,u.__)("Repost","activitypub"),reposts:(0,u.__)("Repost","activitypub"),quote:(0,u.__)("Quote","activitypub"),quotes:(0,u.__)("Quote","activitypub")},h=({reactions:e,displayStyle:t})=>{const{defaultAvatarUrl:s}=v();return"compact"===t?null:(0,n.jsx)("ul",{className:"reaction-avatars",children:e.map((e,t)=>{const i=["reaction-avatar"].filter(Boolean).join(" "),r=e.avatar||s;return(0,n.jsx)("li",{children:(0,n.jsx)("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",children:(0,n.jsx)("img",{src:r,alt:e.name,className:i,width:"32",height:"32",onError:e=>{e.target.src=s}})})},t)})})},b=({reactions:e,displayStyle:t})=>{const{defaultAvatarUrl:s}=v();return(0,n.jsx)("ul",{className:"reactions-list",children:e.map((e,i)=>{const r=e.avatar||s;return(0,n.jsx)("li",{className:"reaction-item",children:(0,n.jsxs)("a",{href:e.url,className:"reaction-item",target:"_blank",rel:"noopener noreferrer",children:["facepile"===t&&(0,n.jsx)("img",{src:r,alt:e.name,width:"32",height:"32",onError:e=>{e.target.src=s}}),(0,n.jsx)("span",{className:"reaction-name",children:e.name})]})},i)})})},w=({items:e,label:t,displayStyle:s,showActions:i,actionLabel:r})=>{const[a,o]=(0,d.useState)(!1),[l,u]=(0,d.useState)(null),p=(0,d.useRef)(null),f=e.slice(0,20);return(0,n.jsxs)("div",{className:"reaction-group",ref:p,children:[i&&r&&(0,n.jsx)("button",{className:"reaction-action-button wp-element-button",type:"button",disabled:!0,children:r}),(0,n.jsx)(h,{reactions:f,displayStyle:s}),(0,n.jsx)(c.Button,{ref:u,className:"reaction-label is-link",onClick:()=>o(!a),"aria-expanded":a,children:t}),a&&l&&(0,n.jsx)(c.Popover,{anchor:l,onClose:()=>o(!1),className:"activitypub-popover",children:(0,n.jsx)(b,{reactions:e,displayStyle:s})})]})};function g({postId:e=null,reactions:t=null,fallbackReactions:s=null,displayStyle:i="facepile",showActions:r=!1}){const{namespace:a}=v(),[o,l]=(0,d.useState)(t),[c,u]=(0,d.useState)(!t),p=(0,d.useCallback)(()=>{s&&l(s),u(!1)},[s]);return(0,d.useEffect)(()=>{if(t)return l(t),void u(!1);e&&"number"==typeof e?(u(!0),y()({path:`/${a}/posts/${e}/reactions`}).then(e=>{const t=Object.values(e).some(e=>e.items?.length>0);l(!t&&s?s:e),u(!1)}).catch(p)):p()},[e,t,s,a,p]),c?null:o&&Object.values(o).some(e=>e.items?.length>0)?(0,n.jsx)("div",{className:"activitypub-reactions",children:Object.entries(o).map(([e,t])=>t.items?.length?(0,n.jsx)(w,{items:t.items,label:t.label,displayStyle:i,showActions:r,actionLabel:m[e]},e):null)}):null}const x=(e,t,s,i)=>Array.from({length:e},(e,r)=>({name:`${t} ${r+1}`,url:"#",avatar:`data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'%3E%3Ccircle cx='32' cy='32' r='32' fill='%23${i[r%i.length]}'/%3E%3Ctext x='32' y='38' font-family='sans-serif' font-size='24' fill='white' text-anchor='middle'%3E${String.fromCharCode(s+r)}%3C/text%3E%3C/svg%3E`})),j=["FF6B6B","4ECDC4","45B7D1","96CEB4","D4A5A5","9B59B6","3498DB","E67E22"],k={likes:{label:(0,u.sprintf)(/* translators: %d: Number of likes */ /* translators: %d: Number of likes */
|
||||
(0,u._x)("%d likes","number of likes","activitypub"),9),items:x(9,"User",65,j)},reposts:{label:(0,u.sprintf)(/* translators: %d: Number of reposts */ /* translators: %d: Number of reposts */
|
||||
(0,u._x)("%d reposts","number of reposts","activitypub"),6),items:x(6,"Reposter",82,j)},quotes:{label:(0,u.sprintf)(/* translators: %d: Number of quotes */ /* translators: %d: Number of quotes */
|
||||
(0,u._x)("%d quotes","number of quotes","activitypub"),7),items:x(7,"Quoter",81,j)}},_=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","name":"activitypub/reactions","apiVersion":3,"version":"9.0.1","title":"Fediverse Reactions","category":"widgets","icon":"heart","keywords":["fediverse","activitypub","likes","reposts"],"description":"Display Fediverse likes and reposts for your posts.","example":{"attributes":{"className":"is-style-facepile"}},"styles":[{"name":"facepile","label":"Facepile","isDefault":true},{"name":"compact","label":"Compact"}],"attributes":{"displayStyle":{"type":"string","default":"facepile"},"showActions":{"type":"boolean","default":false}},"supports":{"align":["wide","full"],"color":{"gradients":true},"__experimentalBorder":{"radius":true,"width":true,"color":true,"style":true},"html":false,"interactivity":true,"shadow":true,"typography":{"fontSize":true,"__experimentalDefaultControls":{"fontSize":true}}},"blockHooks":{"core/post-content":"after"},"textdomain":"activitypub","editorScript":"file:./index.js","style":"file:./style-index.css","viewStyle":"file:./view.css","viewScriptModule":"file:./view.js","viewScript":"wp-api-fetch","render":"file:./render.php"}');(0,i.registerBlockType)(_,{deprecated:a,edit:function({attributes:e,setAttributes:t}){const{className:s="",displayStyle:i="facepile",showActions:a=!1}=e,o=(0,r.useBlockProps)(),{getCurrentPostId:f}=(0,p.select)("core/editor"),{showAvatars:y=!0}=v(),m=(0,d.useRef)(!1);(0,d.useEffect)(()=>{if(m.current)return;m.current=!0;const e=s?.includes("is-style-");if(!e){const e=y?"facepile":"compact";t({className:l(s,`is-style-${e}`),displayStyle:e})}},[s,y,t]);const h=s?.includes("is-style-compact")?"compact":"facepile";(0,d.useEffect)(()=>{h!==i&&t({displayStyle:h})},[h,i,t]);const b=[["core/heading",{level:6,placeholder:(0,u.__)("Fediverse Reactions","activitypub"),content:(0,u.__)("Fediverse Reactions","activitypub")}]];return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(r.InspectorControls,{children:(0,n.jsx)(c.PanelBody,{title:(0,u.__)("Action Buttons","activitypub"),children:(0,n.jsx)(c.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,u.__)("Show action buttons","activitypub"),help:(0,u.__)("Display Like and Boost buttons so visitors can interact from their Fediverse server.","activitypub"),checked:a,onChange:e=>t({showActions:e})})})}),(0,n.jsxs)("div",{...o,children:[(0,n.jsx)(r.InnerBlocks,{template:b,allowedBlocks:["core/heading"],templateLock:"all",renderAppender:!1}),(0,n.jsx)(g,{postId:f(),fallbackReactions:k,displayStyle:i,showActions:a})]})]})},save:function(){return(0,n.jsx)("div",{...r.useBlockProps.save(),children:(0,n.jsx)(r.InnerBlocks.Content,{})})}})}};const t={};function s(i){const r=t[i];if(void 0!==r)return r.exports;const n=t[i]={exports:{}};return e[i](n,n.exports,s),n.exports}s.m=e,(()=>{const e=[];s.O=(t,i,r,n)=>{if(i){n=n||0;for(var a=e.length;a>0&&e[a-1][2]>n;a--)e[a]=e[a-1];return void(e[a]=[i,r,n])}let o=1/0;for(a=0;a<e.length;a++){let[i,r,n]=e[a],c=!0;for(var l=0;l<i.length;l++)(!1&n||o>=n)&&Object.keys(s.O).every(e=>s.O[e](i[l]))?i.splice(l--,1):(c=!1,n<o&&(o=n));if(c){e.splice(a--,1);const s=r();void 0!==s&&(t=s)}}return t}})(),s.n=e=>{const t=e&&e.__esModule?()=>e.default:()=>e;return s.d(t,{a:t}),t},s.d=(e,t)=>{if(Array.isArray(t))for(var i=0;i<t.length;){var r=t[i++],n=t[i++];s.o(e,r)?0===n&&i++:0===n?Object.defineProperty(e,r,{enumerable:!0,value:t[i++]}):Object.defineProperty(e,r,{enumerable:!0,get:n})}else for(var r in t)s.o(t,r)&&!s.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},s.o=(e,t)=>Object.hasOwn(e,t),(()=>{const e={608:0,104:0};s.O.j=t=>0===e[t];const t=(t,i)=>{let[r,n,a]=i;var o,l,c=0;if(r.some(t=>0!==e[t])){for(o in n)s.o(n,o)&&(s.m[o]=n[o]);if(a)var u=a(s)}for(t&&t(i);c<r.length;c++)l=r[c],s.o(e,l)&&e[l]&&e[l][0](),e[l]=0;return s.O(u)},i=globalThis.webpackChunkwordpress_activitypub||=[];i.forEach(t.bind(null,0)),i.push=t.bind(null,i.push.bind(i))})();let i=s.O(void 0,[104],()=>s(91));i=s.O(i)})();
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user