PluginProbe
bBlocks – Essential Gutenberg Blocks & Patterns Collection / 2.1.8
bBlocks – Essential Gutenberg Blocks & Patterns Collection v2.1.8
2.1.8 2.1.7 2.1.6 2.1.5 2.1.4 2.1.3 2.1.2 2.1.1 2.1.0 2.0.43 2.0.42 2.0.41 2.0.40 2.0.39 2.0.38 trunk 1.0 1.1 1.2 1.3 1.4 1.5 1.5.1 1.5.2 1.5.3 All 108 releases
← All changes | build/chart/view.js +1 -1 2.1.6 → 2.1.8 View file →
@@ -1 +1 @@
1 -(()=>{"use strict";const t=window.ReactDOM,e=window.React,n="linear-gradient(135deg, #0040E3, #18D4FD)",r=t=>{const e=(t=>{try{const e=new URL(t);return["http:","https:"].includes(e.protocol)?e.toString():null}catch(e){return"string"==typeof t&&t.startsWith("/")&&!t.startsWith("//")?t:null}})(t);return e?`url('${e.replace(/['"()]/g,"")}')`:"none"},o=(t,e)=>{return null==(n=e)||""===n||Array.isArray(n)&&0===n.length||"object"==typeof n&&0===Object.keys(n).length||"string"==typeof n&&""===n.trim()||"number"==typeof n&&0===n?"":`${t}: ${e};`;var n},i=(t,e=!0,i=!0,a=!0)=>{const{type:s="solid",color:l="",gradient:c=n,image:d={},position:u="center center",attachment:b="",repeat:g="no-repeat",size:p="",overlayColor:h=""}=t||{};return"gradient"===s&&i?o("background",c):"image"===s&&a?`background: ${r(d?.url)};\n\t\t\t\t${o("background-color",h)}\n\t\t\t\t${o("background-position",u)}\n\t\t\t\t${o("background-size",p)}\n\t\t\t\t${o("background-repeat",g)}\n\t\t\t\t${o("background-attachment",b)}\n\t\t\t\t${o("background-repeat",g)}\n\t\t\t\tbackground-blend-mode: overlay;`:e&&o("background",l)},a="bBlocksChart",s=window.ReactJSXRuntime,l=({attributes:t,id:e})=>{const{background:n,width:r,height:o,alignment:l}=t,c=`#${e}`,d=`${c} .${a}`;return(0,s.jsx)("style",{dangerouslySetInnerHTML:{__html:`\n\t\t${c}{\n\t\t\ttext-align: ${l};\n\t\t}\n\t\t${d}{\n\t\t\theight: ${o};\n\t\t}\n\t\t${d},\n\t\t${c} .downloadArea{\n\t\t\twidth: ${r};\n\t\t}\n\t\t${d} canvas{\n\t\t\t${i(n)};\n\t\t}\n\t\t`.replace(/\s+/g," ")}})},c=({attributes:t,id:n,isBackend:r=!1})=>{const{data:o,type:i,textColor:l,isXScale:c,isXGridLine:d,isYScale:u,isYGridLine:b,gridLineColor:g,isTitle:p,title:h,titleFontSize:y,titleColor:m,isSubtitle:$,subtitle:k,subtitleFontSize:w,subtitleColor:S,isDownload:f}=t,v=(0,e.useRef)(null),x=(0,e.useRef)(null),C=r?[o,i,l,c,d,u,b,g,p,h,y,m,$,k,w,S,f,v.current]:[];return(0,e.useEffect)((()=>{r&&(v.current.innerHTML="",v.current.innerHTML="<canvas>Your browser does not support the canvas element.</canvas>");const e=v.current.ownerDocument,o=e.querySelector(`#${n} .${a} canvas`),i=o&&new Chart(o,(t=>{const{data:e,type:n,textColor:r,isXScale:o,isXGridLine:i,isYScale:a,isYGridLine:s,gridLineColor:l,isTitle:c,title:d,titleFontSize:u,titleColor:b,isSubtitle:g,subtitle:p,subtitleFontSize:h,subtitleColor:y}=t;return{type:n,data:e,options:{maintainAspectRatio:!1,plugins:{legend:{position:"top",labels:{usePointStyle:!0,color:r}},title:{display:c,text:d,color:b,font:{size:u,family:"Roboto"},padding:{bottom:10}},subtitle:{display:g,text:p,color:y,font:{size:h,family:"Roboto"},padding:{bottom:15}},tooltip:{position:"nearest",usePointStyle:!0}},scales:{x:{display:o,ticks:{color:r},grid:{display:i,color:l}},y:{display:a,beginAtZero:!0,ticks:{color:r},grid:{display:s,color:l}}}}}})(t));f&&x?.current.addEventListener("click",(()=>{const t=e.createElement("a");t.href=i.toBase64Image(),t.download="b-chart.png",t.click()}))}),C),(0,s.jsxs)(s.Fragment,{children:[f&&(0,s.jsx)("div",{className:"downloadArea",children:(0,s.jsx)("div",{className:"downloadChart",ref:x,children:"Download Chart"})}),(0,s.jsx)("div",{className:a,ref:v,children:(0,s.jsx)("canvas",{children:"Your browser does not support the canvas element."})})]})};document.addEventListener("DOMContentLoaded",(()=>{document.querySelectorAll(".wp-block-b-blocks-chart").forEach((e=>{const n=JSON.parse(e.dataset.attributes);(0,t.createRoot)(e).render((0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(l,{attributes:n,id:e.id}),(0,s.jsx)(c,{attributes:n,id:e.id})]})),e?.removeAttribute("data-attributes")}))}))})();
1 +(()=>{"use strict";const t=window.ReactDOM,e=window.React;new class{constructor(t={}){this.defaultOptions={allowedTags:["svg","g","path","rect","circle","ellipse","line","polyline","polygon","text","tspan","defs","clipPath","mask","linearGradient","radialGradient","stop","style","title","desc"],allowedAttributes:["id","class","style","transform","xmlns","xmlns:xlink","version","baseProfile","xml:space","d","x","y","width","height","cx","cy","r","rx","ry","points","x1","y1","x2","y2","viewBox","preserveAspectRatio","overflow","fill","fill-opacity","fill-rule","stroke","stroke-width","stroke-linecap","stroke-linejoin","stroke-opacity","stroke-dasharray","stroke-dashoffset","stroke-miterlimit","opacity","color","paint-order","vector-effect","shape-rendering","display","visibility","clip-path","clip-rule","clipPathUnits","mask","maskUnits","maskContentUnits","offset","stop-color","stop-opacity","gradientUnits","gradientTransform","spreadMethod","fx","fy","fr","dx","dy","text-anchor","dominant-baseline","alignment-baseline","font-family","font-size","font-style","font-weight","letter-spacing","word-spacing","textLength","lengthAdjust","role","focusable","aria-hidden","aria-label","aria-labelledby","aria-describedby"],allowedProtocols:["http","https","data"],removeScripts:!0,removeEvents:!0,removeExternalResources:!0,sanitizeStyle:!0},this.options={...this.defaultOptions,...t},this.allowedTagSet=new Set(this.options.allowedTags.map((t=>t.toLowerCase()))),this.allowedAttributeSet=new Set(this.options.allowedAttributes.map((t=>t.toLowerCase())))}sanitize(t){if("string"!=typeof t||""===t.trim())return"";const e=(new DOMParser).parseFromString(t,"image/svg+xml"),r=e.documentElement;return!r||"svg"!==r.localName.toLowerCase()||e.getElementsByTagName("parsererror").length?"":(this.removeScripts(e),this.sanitizeElements(e),(new XMLSerializer).serializeToString(e.documentElement))}async sanitizeFile(t){const e=await fetch(t),r=await e.text();return this.sanitize(`${r}`)}removeScripts(t){this.options.removeScripts&&Array.from(t.querySelectorAll("*")).forEach((t=>{t.localName.toLowerCase().includes("script")&&t.remove()}))}sanitizeElements(t){Array.from(t.querySelectorAll("*")).forEach((t=>{const e=t.localName.toLowerCase();this.allowedTagSet.has(e)?("style"===e&&this.options.sanitizeStyle&&(t.textContent=this.sanitizeCss(t.textContent)),this.sanitizeAttributes(t)):t.remove()}))}sanitizeAttributes(t){Array.from(t.attributes).forEach((e=>{const r=e.name,i=r.toLowerCase(),s=e.value;if(this.options.removeEvents&&i.startsWith("on"))return void t.removeAttribute(r);if(this.options.removeExternalResources&&("href"===i||i.endsWith(":href"))&&!this.isAllowedUrl(s))return void t.removeAttribute(r);const o=i.replace("xlink:","");this.allowedAttributeSet.has(i)||this.allowedAttributeSet.has(o)?this.options.removeExternalResources&&this.hasExternalUrl(s)?t.removeAttribute(r):"style"===i&&this.options.sanitizeStyle&&t.setAttribute(r,this.sanitizeCss(s)):t.removeAttribute(r)}))}hasExternalUrl(t){return!("string"!=typeof t||!/url\s*\(/i.test(t))&&Array.from(t.matchAll(/url\s*\(\s*['"]?([^'")]*)/gi)).some((([,t])=>!t.trim().startsWith("#")))}isAllowedUrl(t){const e=String(t||"").trim();if(e.startsWith("#"))return!0;if(/^data:/i.test(e))return this.options.allowedProtocols.includes("data")&&/^data:image\/(png|jpe?g|gif|webp);base64,/i.test(e);try{return this.options.allowedProtocols.includes(new URL(e).protocol.replace(":",""))}catch{return!1}}sanitizeCss(t){return String(t||"").replace(/expression\s*\(/gi,"").replace(/javascript:/gi,"").replace(/behavior\s*:/gi,"").replace(/binding\s*:/gi,"").replace(/@import[^;]*;?/gi,"").replace(/url\s*\(\s*(['"]?)(?!#)[^)]*\)/gi,"none")}};const r="linear-gradient(135deg, #0040E3, #18D4FD)",i=t=>{const e=(t=>{try{const e=new URL(t);return["http:","https:"].includes(e.protocol)?e.toString():null}catch(e){return"string"==typeof t&&t.startsWith("/")&&!t.startsWith("//")?t:null}})(t);return e?`url('${e.replace(/['"()]/g,"")}')`:"none"},s=(t,e)=>{return null==(r=e)||""===r||Array.isArray(r)&&0===r.length||"object"==typeof r&&0===Object.keys(r).length||"string"==typeof r&&""===r.trim()||"number"==typeof r&&0===r?"":`${t}: ${e};`;var r},o=(t,e=!0,o=!0,n=!0)=>{const{type:a="solid",color:l="",gradient:c=r,image:d={},position:u="center center",attachment:p="",repeat:h="no-repeat",size:m="",overlayColor:g=""}=t||{};return"gradient"===a&&o?s("background",c):"image"===a&&n?`background: ${i(d?.url)};\n\t\t\t\t${s("background-color",g)}\n\t\t\t\t${s("background-position",u)}\n\t\t\t\t${s("background-size",m)}\n\t\t\t\t${s("background-repeat",h)}\n\t\t\t\t${s("background-attachment",p)}\n\t\t\t\t${s("background-repeat",h)}\n\t\t\t\tbackground-blend-mode: overlay;`:e&&s("background",l)},n="bBlocksChart",a=window.ReactJSXRuntime,l=({attributes:t,id:e})=>{const{background:r,width:i,height:s,alignment:l}=t,c=`#${e}`,d=`${c} .${n}`;return(0,a.jsx)("style",{dangerouslySetInnerHTML:{__html:`\n\t\t${c}{\n\t\t\ttext-align: ${l};\n\t\t}\n\t\t${d}{\n\t\t\theight: ${s};\n\t\t}\n\t\t${d},\n\t\t${c} .downloadArea{\n\t\t\twidth: ${i};\n\t\t}\n\t\t${d} canvas{\n\t\t\t${o(r)};\n\t\t}\n\t\t`.replace(/\s+/g," ")}})},c=({attributes:t,id:r,isBackend:i=!1})=>{const{data:s,type:o,textColor:l,isXScale:c,isXGridLine:d,isYScale:u,isYGridLine:p,gridLineColor:h,isTitle:m,title:g,titleFontSize:b,titleColor:y,isSubtitle:f,subtitle:w,subtitleFontSize:v,subtitleColor:x,isDownload:S}=t,k=(0,e.useRef)(null),A=(0,e.useRef)(null),C=i?[s,o,l,c,d,u,p,h,m,g,b,y,f,w,v,x,S,k.current]:[];return(0,e.useEffect)((()=>{i&&(k.current.innerHTML="",k.current.innerHTML="<canvas>Your browser does not support the canvas element.</canvas>");const e=k.current.ownerDocument,s=e.querySelector(`#${r} .${n} canvas`),o=s&&new Chart(s,(t=>{const{data:e,type:r,textColor:i,isXScale:s,isXGridLine:o,isYScale:n,isYGridLine:a,gridLineColor:l,isTitle:c,title:d,titleFontSize:u,titleColor:p,isSubtitle:h,subtitle:m,subtitleFontSize:g,subtitleColor:b}=t;return{type:r,data:e,options:{maintainAspectRatio:!1,plugins:{legend:{position:"top",labels:{usePointStyle:!0,color:i}},title:{display:c,text:d,color:p,font:{size:u,family:"Roboto"},padding:{bottom:10}},subtitle:{display:h,text:m,color:b,font:{size:g,family:"Roboto"},padding:{bottom:15}},tooltip:{position:"nearest",usePointStyle:!0}},scales:{x:{display:s,ticks:{color:i},grid:{display:o,color:l}},y:{display:n,beginAtZero:!0,ticks:{color:i},grid:{display:a,color:l}}}}}})(t));S&&A?.current.addEventListener("click",(()=>{const t=e.createElement("a");t.href=o.toBase64Image(),t.download="b-chart.png",t.click()}))}),C),(0,a.jsxs)(a.Fragment,{children:[S&&(0,a.jsx)("div",{className:"downloadArea",children:(0,a.jsx)("div",{className:"downloadChart",ref:A,children:"Download Chart"})}),(0,a.jsx)("div",{className:n,ref:k,children:(0,a.jsx)("canvas",{children:"Your browser does not support the canvas element."})})]})};document.addEventListener("DOMContentLoaded",(()=>{document.querySelectorAll(".wp-block-b-blocks-chart").forEach((e=>{const r=JSON.parse(e.dataset.attributes);(0,t.createRoot)(e).render((0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(l,{attributes:r,id:e.id}),(0,a.jsx)(c,{attributes:r,id:e.id})]})),e?.removeAttribute("data-attributes")}))}))})();