PluginProbe
bBlocks – Essential Gutenberg Blocks & Patterns Collection / 2.1.7
bBlocks – Essential Gutenberg Blocks & Patterns Collection v2.1.7
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 1.5.4 All 107 releases
← All changes | build/text-path/view.js +1 -1 2.0.432.1.7 View file →
@@ -1 +1 @@
1 -(()=>{"use strict";var t={5338:(t,e,n)=>{var r=n(5795);e.H=r.createRoot,r.hydrateRoot},5795:t=>{t.exports=window.ReactDOM}},e={};function n(r){var o=e[r];if(void 0!==o)return o.exports;var l=e[r]={exports:{}};return t[r](l,l.exports,n),l.exports}n.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return n.d(e,{a:e}),e},n.d=(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=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);const r=window.React;var o=n.n(r),l=n(5338);const s="@media only screen and (max-width: 1024px)",a="@media only screen and (max-width: 640px)",i=(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},c=(t,e,n=!0)=>{const{fontFamily:r="Default",fontCategory:o="sans-serif",fontVariant:l=400,fontWeight:c,isUploadFont:u=!0,fontSize:$={desktop:null,tablet:null,mobile:null},fontStyle:f,textTransform:m,textDecoration:p,lineHeight:d,letterSpace:h}=e||{},y=!n||!r||"Default"===r,g=$?.desktop||$,x=$?.tablet||g,b=$?.mobile||x,v=t=>{const e=String(t);return["px","em","rem","%","vh","vw"].some((t=>e.endsWith(t)))?e:"number"==typeof t?`${e}px`:""},k=`\n\t\t${y?"":`font-family: '${r}', ${o};`}\n\t\t${i("font-weight",c)}\n\t\t${i("font-size",v(g))}\n\t\t${i("font-style",f)}\n\t\t${i("text-transform",m)}\n\t\t${i("text-decoration",p)}\n\t\t${i("line-height",d)}\n\t\t${i("letter-spacing",h)}\n\t`,w=l&&400!==l?"400i"===l?":ital@1":l?.includes("00i")?`: ital, wght@1, ${l?.replace("00i","00")} `:`: wght@${l} `:"",S=y?"":`https://fonts.googleapis.com/css2?family=${r?.split(" ").join("+")}${w.replace(/ /g,"")}&display=swap`;return{googleFontLink:!u||y?"":`@import url(${S});`,styles:`${t}{\n\t\t\t${k}\n\t\t}\n\t\t${s} {\n\t\t\t${t}{\n\t\t\t\t${i("font-size",v(x))}\n\t\t\t}\n\t\t}\n\t\t${a} {\n\t\t\t${t}{\n\t\t\t\t${i("font-size",v(b))}\n\t\t\t}\n\t\t}`.replace(/\s+/g," ").trim()}},u=({attributes:t,id:e})=>{const{styles:n}=t,{container:o,title:l,path:u}=n,$=`#${e} .b-blocks-text-path-container`,f=`${$} .b-blocks-text-path-svg`,m=`${f} .b-blocks-text-path-title`,p=(t="normal")=>{const e=l[t],n=e?.textStroke.isStroke?`${i("stroke-width",e.textStroke.size?e.textStroke.size+"px":"")}\n\t\t\t${i("stroke",e.textStroke.color)}`:"";return`\n\t\t\t${i("color",e.color)}\n\t\t\t${i("fill",e.color)}\n\t\t\t${i("text-shadow",((t,e="box")=>{let n="";return t?.map(((r,o)=>{const{hOffset:l="0px",vOffset:s="0px",blur:a="0px",spreed:i="0px",color:c="#e7f0fe",isInset:u=!1}=r||{},$=u?"inset":"",f=`${l} ${s} ${a}`,m=o+1>=t.length?"":", ";n+="text"===e?`${f} ${c}${m}`:`${f} ${i} ${c} ${$}${m}`})),n||""})(e.textShadow,"text"))}\n\t\t\t${n}\n\t\t`};return(0,r.createElement)("style",{dangerouslySetInnerHTML:{__html:`\n\n\t\t${c("",l.typo).googleFontLink}\n\n\t\t${c(m,l.typo).styles}\n\n\t\t${$}{\n\t\t\t${i("justify-content",o.desktop.alignment)}\n\t\t}\n\n\t\t${f}{\n\t\t\t${i("rotate",u.rotate?u.rotate+"deg":"")}\n\t\t\t${i("width",u.size)}\n\t\t\t${i("width",u.size)}\n\t\t}\n\n\t\t${m}{\n\t\t\t${p("normal")}\t\t\n\t\t\ttransition: all ${l.transition}s ease-in-out;\n\t\t}\n\n\t\t${m}:hover{\n\t\t\t${p("hover")}\t\t\n\t\t}\n\t\t\n\t\t${s}{\n\t\t\t\t${$}{\n\t\t\t${i("justify-content",o.tablet.alignment)}\n\t\t\t}\n\t\t}\n\t\t${a}{\n\t\t\t\t${$}{\n\t\t\t${i("justify-content",o.mobile.alignment)}\n\t\t\t}\n\t\t}\n\t\t\n\t`}})};function $(t,e,n){return Math.max(e,Math.min(n,t))}function f(t){if("number"==typeof t)return $(t,0,1);const e=String(t).trim();if(e.endsWith("%"))return $(parseFloat(e.slice(0,-1))/100,0,1);const n=Number(e);return Number.isFinite(n)?$(n,0,1):0}const m=({pathSize:t=300,alignment:e="start",customPath:n="",customSvgPathSelector:l="",showIcon:s=!1,icon:a=null,iconSize:i=24,iconStartOffset:c="5%",iconEndOffset:u="95%",attributes:$})=>{const{icon:m,styles:p}=$,{type:d,iconType:h,title:y}=m,{path:g}=p,x="custom"===d?"library"===h?m.library:m.upload:"",b=(0,r.useMemo)((()=>`textPath-${Math.random().toString(36).slice(2)}`),[]),v=(0,r.useRef)(null),[k,w]=(0,r.useState)(null),[S,E]=(0,r.useState)(null),M=(0,r.useMemo)((()=>x?function(t,e){if(!t||"string"!=typeof t)return null;if("undefined"==typeof window)return null;try{const n=(new DOMParser).parseFromString(t,"image/svg+xml"),r=n.querySelector("svg");if(!r)return null;const o=r.getAttribute("viewBox")||null,l=(e?n.querySelector(e):null)||n.querySelector("path"),s=l?.getAttribute("d")||null;return s?{viewBox:o,d:s}:null}catch{return null}}(x,l||null):null),[x,l]),O="custom"===d&&M?.viewBox||M?.viewBox||`0 0 ${t} ${t}`;(0,r.useEffect)((()=>{if(!s)return;const t=v.current;if(!t)return;let e=0;try{e=t.getTotalLength()}catch{return}if(!e||!Number.isFinite(e))return;const n=f(c),r=f(u),o=t.getPointAtLength(e*n),l=t.getPointAtLength(e*r);w({x:o.x,y:o.y}),E({x:l.x,y:l.y})}),[s,c,u,t,d,n,x,M?.d]);const A=()=>{var t,e;return a&&o().isValidElement(a)?o().cloneElement(a,{...a.props,width:i,height:i,fill:null!==(t=a.props.fill)&&void 0!==t?t:"currentColor",stroke:null!==(e=a.props.stroke)&&void 0!==e?e:"currentColor",style:{display:"block",...a.props.style||{}}}):null};return(0,r.createElement)("div",{className:"b-blocks-text-path-container"},(0,r.createElement)("svg",{viewBox:O,style:{transition:"transform 0.3s ease"},className:"b-blocks-text-path-svg"},(0,r.createElement)("defs",null,(0,r.createElement)("path",{ref:v,id:b,d:(()=>{const e=t,r=t,o=e/2,l=r/2;switch(d){case"arc":return`M 50,${l+50} Q ${o},${l-100} ${e-50},${l+50}`;case"wave":{const t=40,n=2;let r=`M 0,${l}`;for(let o=0;o<=e;o+=5)r+=` L ${o},${l+t*Math.sin(o/e*Math.PI*n)}`;return r}case"circle":{const t=Math.min(e,r)/2-20;return`M ${o-t},${l}\n A ${t},${t} 0 1,1 ${o+t},${l}\n A ${t},${t} 0 1,1 ${o-t},${l}`}case"custom":return x&&M?.d?M.d:n||`M 50,${l} L ${e-50},${l}`;case"line":return`M 50,${l} L ${e-50},${l}`}})(),fill:"none",stroke:g.color,strokeWidth:g.thickness,strokeLinecap:"round",style:{transition:"stroke 0.3s ease"}})),(0,r.createElement)("use",{href:`#${b}`}),s&&k&&(0,r.createElement)("g",{transform:`translate(${k.x}, ${k.y})`},(0,r.createElement)("g",{transform:`translate(${-i/2}, ${-i/2})`,fill:g.color,stroke:g.color},A())),s&&S&&(0,r.createElement)("g",{transform:`translate(${S.x}, ${S.y})`},(0,r.createElement)("g",{transform:`translate(${-i/2}, ${-i/2})`,fill:g.color,stroke:g.color},A())),(0,r.createElement)("text",{className:"b-blocks-text-path-title",textAnchor:e},(0,r.createElement)("textPath",{href:`#${b}`,startOffset:g.staringPoint,style:{textAnchor:e}},y))))};document.addEventListener("DOMContentLoaded",(()=>{document.querySelectorAll(".wp-block-b-blocks-text-path").forEach((t=>{const e=JSON.parse(t.dataset.attributes);(0,l.H)(t).render((0,r.createElement)(r.Fragment,null,(0,r.createElement)(u,{attributes:e,id:t.id}),(0,r.createElement)(m,{attributes:e}))),t?.removeAttribute("data-attributes")}))}))})();
1 +(()=>{"use strict";var t={n:e=>{var n=e&&e.__esModule?()=>e.default:()=>e;return t.d(n,{a:n}),n},d:(e,n)=>{for(var r in n)t.o(n,r)&&!t.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:n[r]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e)};const e=window.ReactDOM,n="@media only screen and (max-width: 1024px)",r="@media only screen and (max-width: 640px)",o=window.React;var s=t.n(o);const l=(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,o=!0)=>{const{fontFamily:s="Default",fontCategory:i="sans-serif",fontVariant:a=400,fontWeight:c,isUploadFont:u=!0,fontSize:$={desktop:null,tablet:null,mobile:null},fontStyle:f,textTransform:h,textDecoration:d,lineHeight:p,letterSpace:m}=e||{},x=!o||!s||"Default"===s,y=$?.desktop||$,g=$?.tablet||y,b=$?.mobile||g,w=t=>{const e=String(t);return["px","em","rem","%","vh","vw"].some((t=>e.endsWith(t)))?e:"number"==typeof t?`${e}px`:""},k=`\n\t\t${x?"":`font-family: '${s}', ${i};`}\n\t\t${l("font-weight",c)}\n\t\t${l("font-size",w(y))}\n\t\t${l("font-style",f)}\n\t\t${l("text-transform",h)}\n\t\t${l("text-decoration",d)}\n\t\t${l("line-height",p)}\n\t\t${l("letter-spacing",m)}\n\t`,S=a&&400!==a?"400i"===a?":ital@1":a?.includes("00i")?`: ital, wght@1, ${a?.replace("00i","00")} `:`: wght@${a} `:"",v=x?"":`https://fonts.googleapis.com/css2?family=${s?.split(" ").join("+")}${S.replace(/ /g,"")}&display=swap`;return{googleFontLink:!u||x?"":`@import url(${v});`,styles:`${t}{\n\t\t\t${k}\n\t\t}\n\t\t${n} {\n\t\t\t${t}{\n\t\t\t\t${l("font-size",w(g))}\n\t\t\t}\n\t\t}\n\t\t${r} {\n\t\t\t${t}{\n\t\t\t\t${l("font-size",w(b))}\n\t\t\t}\n\t\t}`.replace(/\s+/g," ").trim()}},a=window.ReactJSXRuntime,c=({attributes:t,id:e})=>{const{styles:o}=t,{container:s,title:c,path:u}=o,$=`#${e} .b-blocks-text-path-container`,f=`${$} .b-blocks-text-path-svg`,h=`${f} .b-blocks-text-path-title`,d=(t="normal")=>{const e=c[t],n=e?.textStroke.isStroke?`${l("stroke-width",e.textStroke.size?e.textStroke.size+"px":"")}\n\t\t\t${l("stroke",e.textStroke.color)}`:"";return`\n\t\t\t${l("color",e.color)}\n\t\t\t${l("fill",e.color)}\n\t\t\t${l("text-shadow",((t,e="box")=>{let n="";return t?.map(((r,o)=>{const{hOffset:s="0px",vOffset:l="0px",blur:i="0px",spreed:a="0px",color:c="#e7f0fe",isInset:u=!1}=r||{},$=u?"inset":"",f=`${s} ${l} ${i}`,h=o+1>=t.length?"":", ";n+="text"===e?`${f} ${c}${h}`:`${f} ${a} ${c} ${$}${h}`})),n||""})(e.textShadow,"text"))}\n\t\t\t${n}\n\t\t`};return(0,a.jsx)("style",{dangerouslySetInnerHTML:{__html:`\n\n\t\t${i("",c.typo).googleFontLink}\n\n\t\t${i(h,c.typo).styles}\n\n\t\t${$}{\n\t\t\t${l("justify-content",s.desktop.alignment)}\n\t\t}\n\n\t\t${f}{\n\t\t\t${l("rotate",u.rotate?u.rotate+"deg":"")}\n\t\t\t${l("width",u.size)}\n\t\t\t${l("width",u.size)}\n\t\t}\n\n\t\t${h}{\n\t\t\t${d("normal")}\t\t\n\t\t\ttransition: all ${c.transition}s ease-in-out;\n\t\t}\n\n\t\t${h}:hover{\n\t\t\t${d("hover")}\t\t\n\t\t}\n\t\t\n\t\t${n}{\n\t\t\t\t${$}{\n\t\t\t${l("justify-content",s.tablet.alignment)}\n\t\t\t}\n\t\t}\n\t\t${r}{\n\t\t\t\t${$}{\n\t\t\t${l("justify-content",s.mobile.alignment)}\n\t\t\t}\n\t\t}\n\t\t\n\t`}})};function u(t,e,n){return Math.max(e,Math.min(n,t))}function $(t){if("number"==typeof t)return u(t,0,1);const e=String(t).trim();if(e.endsWith("%"))return u(parseFloat(e.slice(0,-1))/100,0,1);const n=Number(e);return Number.isFinite(n)?u(n,0,1):0}const f=({pathSize:t=300,alignment:e="start",customPath:n="",customSvgPathSelector:r="",showIcon:l=!1,icon:i=null,iconSize:c=24,iconStartOffset:u="5%",iconEndOffset:f="95%",attributes:h})=>{const{icon:d,styles:p}=h,{type:m,iconType:x,title:y}=d,{path:g}=p,b="custom"===m?"library"===x?d.library:d.upload:"",w=(0,o.useMemo)((()=>`textPath-${Math.random().toString(36).slice(2)}`),[]),k=(0,o.useRef)(null),[S,v]=(0,o.useState)(null),[j,M]=(0,o.useState)(null),O=(0,o.useMemo)((()=>b?function(t,e){if(!t||"string"!=typeof t)return null;if("undefined"==typeof window)return null;try{const n=(new DOMParser).parseFromString(t,"image/svg+xml"),r=n.querySelector("svg");if(!r)return null;const o=r.getAttribute("viewBox")||null,s=(e?n.querySelector(e):null)||n.querySelector("path"),l=s?.getAttribute("d")||null;return l?{viewBox:o,d:l}:null}catch{return null}}(b,r||null):null),[b,r]),A="custom"===m&&O?.viewBox||O?.viewBox||`0 0 ${t} ${t}`;(0,o.useEffect)((()=>{if(!l)return;const t=k.current;if(!t)return;let e=0;try{e=t.getTotalLength()}catch{return}if(!e||!Number.isFinite(e))return;const n=$(u),r=$(f),o=t.getPointAtLength(e*n),s=t.getPointAtLength(e*r);v({x:o.x,y:o.y}),M({x:s.x,y:s.y})}),[l,u,f,t,m,n,b,O?.d]);const L=()=>i&&s().isValidElement(i)?s().cloneElement(i,{...i.props,width:c,height:c,fill:i.props.fill??"currentColor",stroke:i.props.stroke??"currentColor",style:{display:"block",...i.props.style||{}}}):null;return(0,a.jsx)("div",{className:"b-blocks-text-path-container",children:(0,a.jsxs)("svg",{viewBox:A,style:{transition:"transform 0.3s ease"},className:"b-blocks-text-path-svg",children:[(0,a.jsx)("defs",{children:(0,a.jsx)("path",{ref:k,id:w,d:(()=>{const e=t,r=t,o=e/2,s=r/2;switch(m){case"arc":return`M 50,${s+50} Q ${o},${s-100} ${e-50},${s+50}`;case"wave":{const t=40,n=2;let r=`M 0,${s}`;for(let o=0;o<=e;o+=5)r+=` L ${o},${s+t*Math.sin(o/e*Math.PI*n)}`;return r}case"circle":{const t=Math.min(e,r)/2-20;return`M ${o-t},${s}\n A ${t},${t} 0 1,1 ${o+t},${s}\n A ${t},${t} 0 1,1 ${o-t},${s}`}case"custom":return b&&O?.d?O.d:n||`M 50,${s} L ${e-50},${s}`;case"line":return`M 50,${s} L ${e-50},${s}`}})(),fill:"none",stroke:g.color,strokeWidth:g.thickness,strokeLinecap:"round",style:{transition:"stroke 0.3s ease"}})}),(0,a.jsx)("use",{href:`#${w}`}),l&&S&&(0,a.jsx)("g",{transform:`translate(${S.x}, ${S.y})`,children:(0,a.jsx)("g",{transform:`translate(${-c/2}, ${-c/2})`,fill:g.color,stroke:g.color,children:L()})}),l&&j&&(0,a.jsx)("g",{transform:`translate(${j.x}, ${j.y})`,children:(0,a.jsx)("g",{transform:`translate(${-c/2}, ${-c/2})`,fill:g.color,stroke:g.color,children:L()})}),(0,a.jsx)("text",{className:"b-blocks-text-path-title",textAnchor:e,children:(0,a.jsx)("textPath",{href:`#${w}`,startOffset:g.staringPoint,style:{textAnchor:e},children:y})})]})})};document.addEventListener("DOMContentLoaded",(()=>{document.querySelectorAll(".wp-block-b-blocks-text-path").forEach((t=>{const n=JSON.parse(t.dataset.attributes);(0,e.createRoot)(t).render((0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(c,{attributes:n,id:t.id}),(0,a.jsx)(f,{attributes:n})]})),t?.removeAttribute("data-attributes")}))}))})();