PluginProbe
bBlocks – Essential Gutenberg Blocks & Patterns Collection / 2.0.39
bBlocks – Essential Gutenberg Blocks & Patterns Collection v2.0.39
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
b-blocks / build / star-rating / view.js

view.js in bBlocks – Essential Gutenberg Blocks & Patterns Collection 2.0.39, at build/star-rating/view.js

1 lines 5.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 (()=>{"use strict";var t={5795:t=>{t.exports=window.ReactDOM},8744:(t,e,n)=>{var r=n(5795);e.H=r.createRoot,r.hydrateRoot}},e={};const n=window.React;var r=function n(r){var a=e[r];if(void 0!==a)return a.exports;var s=e[r]={exports:{}};return t[r](s,s.exports,n),s.exports}(8744);const a=(t,e,n=!1)=>{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}${n?" !important":""};`;var r},s=(t,e="box")=>{let n="";return t?.map(((r,a)=>{const{hOffset:s="0px",vOffset:o="0px",blur:l="0px",spreed:i="0px",color:c="#e7f0fe",isInset:p=!1}=r||{},m=p?"inset":"",$=`${s} ${o} ${l}`,u=a+1>=t.length?"":", ";n+="text"===e?`${$} ${c}${u}`:`${$} ${i} ${c} ${m}${u}`})),n||""},o=(t,e,n=!0)=>{const{fontFamily:r="Default",fontCategory:s="sans-serif",fontVariant:o=400,fontWeight:l,isUploadFont:i=!0,fontSize:c={desktop:null,tablet:null,mobile:null},fontStyle:p,textTransform:m,textDecoration:$,lineHeight:u,letterSpace:g}=e||{},f=!n||!r||"Default"===r,d=c?.desktop||c,h=c?.tablet||d,x=c?.mobile||h,y=t=>{const e=String(t);return["px","em","rem","%","vh","vw"].some((t=>e.endsWith(t)))?e:"number"==typeof t?`${e}px`:""},w=`\n\t\t${f?"":`font-family: '${r}', ${s};`}\n\t\t${a("font-weight",l)}\n\t\t${a("font-size",y(d))}\n\t\t${a("font-style",p)}\n\t\t${a("text-transform",m)}\n\t\t${a("text-decoration",$)}\n\t\t${a("line-height",u)}\n\t\t${a("letter-spacing",g)}\n\t`,v=o&&400!==o?"400i"===o?":ital@1":o?.includes("00i")?`: ital, wght@1, ${o?.replace("00i","00")} `:`: wght@${o} `:"",b=f?"":`https://fonts.googleapis.com/css2?family=${r?.split(" ").join("+")}${v.replace(/ /g,"")}&display=swap`;return{googleFontLink:!i||f?"":`@import url(${b});`,styles:`${t}{\n\t\t\t${w}\n\t\t}\n\t\t@media only screen and (max-width: 1024px) {\n\t\t\t${t}{\n\t\t\t\t${a("font-size",y(h))}\n\t\t\t}\n\t\t}\n\t\t@media only screen and (max-width: 640px) {\n\t\t\t${t}{\n\t\t\t\t${a("font-size",y(x))}\n\t\t\t}\n\t\t}`.replace(/\s+/g," ").trim()}},l=t=>{if(!t)return"";if("string"==typeof t)return t;if("object"==typeof t&&!Array.isArray(t)){const e=["top","right","bottom","left"];return e.map((e=>t[e]||"")).every((t=>!t))?"":e.map((e=>t[e]||"0")).join(" ")}return""},i=t=>Array.from({length:t},((t,e)=>e+1)),c="bBlocksRating",p=({attributes:t,id:e})=>{const{rating:r,gap:p,alignment:m,margin:$,textTypo:u,textColor:g,textShadow:f,iconColor:d="#f0ad4e"}=t,h=`#${e} .${c}`,x=`${h} .stars .star`,y=(r+"").split("."),w=parseInt(y[0]),v=parseInt(y[1]||0);return(0,n.createElement)("style",{dangerouslySetInnerHTML:{__html:`\n\t\t${o("",u)?.googleFontLink}\n\t\t${o(`${h} .ratingPrefix`,u)?.styles}\n\n\t\t${h} {\n\t\t\tjustify-content: ${m};\n\t\t\tgap: ${p};\n\t\t\tcolor: ${g};\n\t\t\t${a("margin",l($))}\n\t\t}\n\n\t\t${h} .ratingPrefix{\n\t\t\ttext-shadow: ${s(f,"text")}\n\t\t}\n\n\t\t${x}>.starFill>svg{\n\t\t\t${a("fill",d)}\n\t\t}\n\n\t\t${i(w).map((t=>`${x}:nth-child(${t}) .starFill`)).join(", ")}{\n\t\t\twidth: 100%;\n\t\t}\n\n\t\t${x}:nth-child(${w+1}) .starFill{\n\t\t\twidth: ${(()=>{switch(v){case 1:return 25;case 2:return 30;case 3:return 35;case 4:return 42.5;case 5:return 50;case 6:return 57.5;case 7:return 65;case 8:return 70;case 9:return 75;default:return 0}})()}%;\n\t\t}\n\t`}})},m=((0,n.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,n.createElement)("polygon",{points:"12 4 9.22 9.27 3 10.11 7.5 14.21 6.44 20 12 17.27 17.56 20 16.5 14.21 21 10.11 14.78 9.27 12 4",style:{fill:"none",stroke:"rgb(0, 0, 0)",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2}})),(0,n.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 576 512"},(0,n.createElement)("path",{d:"M316.9 18C311.6 7 300.4 0 288.1 0s-23.4 7-28.8 18L195 150.3 51.4 171.5c-12 1.8-22 10.2-25.7 21.7s-.7 24.2 7.9 32.7L137.8 329 113.2 474.7c-2 12 3 24.2 12.9 31.3s23 8 33.8 2.3l128.3-68.5 128.3 68.5c10.8 5.7 23.9 4.9 33.8-2.3s14.9-19.3 12.9-31.3L438.5 329 542.7 225.9c8.6-8.5 11.7-21.2 7.9-32.7s-13.7-19.9-25.7-21.7L381.2 150.3 316.9 18z"}))),$=(0,n.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 576 512"},(0,n.createElement)("path",{d:"M287.9 0c9.2 0 17.6 5.2 21.6 13.5l68.6 141.3 153.2 22.6c9 1.3 16.5 7.6 19.3 16.3s.5 18.1-5.9 24.5L433.6 328.4l26.2 155.6c1.5 9-2.2 18.1-9.6 23.5s-17.3 6-25.3 1.7l-137-73.2L151 509.1c-8.1 4.3-17.9 3.7-25.3-1.7s-11.2-14.5-9.7-23.5l26.2-155.6L31.1 218.2c-6.5-6.4-8.7-15.9-5.9-24.5s10.3-14.9 19.3-16.3l153.2-22.6L266.3 13.5C270.4 5.2 278.7 0 287.9 0zm0 79L235.4 187.2c-3.5 7.1-10.2 12.1-18.1 13.3L99 217.9 184.9 303c5.5 5.5 8.1 13.3 6.8 21L171.4 443.7l105.2-56.2c7.1-3.8 15.6-3.8 22.6 0l105.2 56.2L384.2 324.1c-1.3-7.7 1.2-15.5 6.8-21l85.9-85.1L358.6 200.5c-7.8-1.2-14.6-6.1-18.1-13.3L287.9 79z"})),u=({attributes:t})=>{const{ratingScale:e,iconStyle:r,prefix:a}=t;return(0,n.createElement)("div",{className:c},(0,n.createElement)("span",{className:"ratingPrefix"},a),(0,n.createElement)("div",{className:"stars"},i(e).map((t=>(0,n.createElement)("span",{key:t,className:"star"},"solid"===r?m:$,(0,n.createElement)("span",{className:"starFill"},m))))))};document.addEventListener("DOMContentLoaded",(()=>{document.querySelectorAll(".wp-block-b-blocks-star-rating").forEach((t=>{const e=JSON.parse(t.dataset.attributes);(0,r.H)(t).render((0,n.createElement)(n.Fragment,null,(0,n.createElement)(p,{attributes:e,id:t.id}),(0,n.createElement)(u,{attributes:e}))),t?.removeAttribute("data-attributes")}))}))})();