@chaibuilder/sdk 1.2.47 → 1.2.48
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/web-blocks.cjs +1 -1
- package/dist/web-blocks.js +1 -1
- package/package.json +1 -1
package/dist/web-blocks.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("lodash-es"),n=require("./jsx-runtime-Z_BpKhVy.cjs"),w=require("react"),o=require("./controls-jWJDao88.cjs"),d=require("@chaibuilder/runtime"),x=require("./empty-slot-Sy930lX6.cjs"),h=require("@radix-ui/react-icons"),f=require("./Functions-N3yhPYKY.cjs"),j=require("./html-to-json-VPWiWWGH.cjs");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("clsx");require("tailwind-merge");require("himalaya");require("./STRINGS-gPz7CUOk.cjs");function R(e){const l=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const s=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(l,t,s.get?s:{enumerable:!0,get:()=>e[t]})}}return l.default=e,Object.freeze(l)}const u=R(w),C=u.memo(e=>{const{blockProps:l,inBuilder:t,backgroundImage:s,children:r,tag:a="div",styles:i}=e;let c=r;r||(c=n.jsxRuntimeExports.jsx(x.EmptySlot,{inBuilder:t}));let p={};return s&&(p={backgroundImage:`url(${s})`}),u.createElement(a,{...l,...i,style:p},c)});d.registerChaiBlock(C,{type:"Box",label:"Box",category:"core",group:"basic",props:{styles:o.S({default:""}),tag:o.y({title:"Tag",default:"div",options:[{value:"div",title:"div"},{value:"header",title:"header"},{value:"footer",title:"footer"},{value:"section",title:"section"},{value:"article",title:"article"},{value:"aside",title:"aside"},{value:"main",title:"main"},{value:"nav",title:"nav"},{value:"figure",title:"figure"},{value:"details",title:"details"},{value:"summary",title:"summary"},{value:"dialog",title:"dialog"},{value:"strike",title:"strike"},{value:"caption",title:"caption"},{value:"legend",title:"legend"},{value:"figcaption",title:"figcaption"},{value:"mark",title:"mark"}]}),backgroundImage:o.q({title:"Background Image"})},canAcceptBlock:()=>!0});const T=u.memo(e=>{const{blockProps:l,styles:t}=e;return u.createElement("div",{...l,...t})});d.registerChaiBlock(T,{type:"EmptyBox",label:"Empty Box",category:"core",group:"basic",props:{styles:o.S({default:""})},canAcceptBlock:()=>!1});const L=e=>{const{blockProps:l,styles:t,content:s,level:r="h1",children:a=null}=e;return a?u.createElement(r,{...t,...l},a):u.createElement(r,{...t,...l,"data-ai-key":"content","data-ai-type":"html",dangerouslySetInnerHTML:{__html:s}})};d.registerChaiBlock(L,{type:"Heading",label:"Heading",category:"core",icon:h.HeadingIcon,group:"typography",props:{level:o.y({title:"Level",default:"h1",binding:!1,options:[{value:"h1",title:"h1"},{value:"h2",title:"h2"},{value:"h3",title:"h3"},{value:"h4",title:"h4"},{value:"h5",title:"h5"},{value:"h6",title:"h6"}]}),styles:o.S({default:"text-3xl"}),content:o.g({title:"Content",default:"Heading goes here"})},canAcceptBlock:e=>e==="Span"||e==="Text"});const _=e=>{const{blockProps:l,styles:t,content:s}=e;return y.isNull(e.children)?u.createElement("p",{...t,...l,"data-ai-key":"content","data-ai-type":"html",dangerouslySetInnerHTML:{__html:s}}):u.createElement("p",{...t,...l},e.children)};d.registerChaiBlock(_,{type:"Paragraph",label:"Paragraph",category:"core",icon:h.TextIcon,group:"typography",props:{styles:o.S({default:""}),content:o.g({title:"Content",default:"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse varius enim in eros elementum tristique. Duis cursus, mi quis viverra ornare, eros dolor interdum nulla, ut commodo diam libero vitae erat. Aenean faucibus nibh et justo cursus id rutrum lorem imperdiet. Nunc ut sem vitae risus tristique posuere."})},canAcceptBlock:e=>e==="Span"||e==="Link"});const P=e=>{const{blockProps:l,styles:t,content:s,children:r=null,tag:a}=e;return r?u.createElement("span",{...t,...l},r):u.createElement(a||"span",{...t,...l,"data-ai-key":"content",dangerouslySetInnerHTML:{__html:s}})};d.registerChaiBlock(P,{type:"Span",label:"Span",category:"core",group:"typography",props:{styles:o.S({default:""}),content:o.g({title:"Content",default:"Enter your content"})},canAcceptBlock:()=>!0});const M=e=>{const{blockProps:l,content:t,styles:s}=e;return n.jsxRuntimeExports.jsx("div",{className:"max-w-full",children:n.jsxRuntimeExports.jsx("div",{"data-ai-key":"content","data-ai-type":"richtext",...l,...s,dangerouslySetInnerHTML:{__html:t}})})};d.registerChaiBlock(M,{type:"RichText",label:"Rich Text",category:"core",icon:h.CursorTextIcon,group:"typography",props:{styles:o.S({default:""}),content:o.m({title:"Content",default:"<p>This is a rich text block. You can add text, and other content here.</p>"})}});const N=e=>{const{blockProps:l,iconSize:t,icon:s,content:r,iconPos:a,styles:i,children:c}=e,p=s,m=c||n.jsxRuntimeExports.jsxs(n.jsxRuntimeExports.Fragment,{children:[n.jsxRuntimeExports.jsx("span",{"data-ai-key":"content",children:r}),p&&n.jsxRuntimeExports.jsx("div",{style:{width:t+"px"},className:a+" "+(a==="order-first"?"mr-2":"ml-2")||"",dangerouslySetInnerHTML:{__html:p}})]});return u.createElement("button",{...l,...i,type:"button"},m)};d.registerChaiBlock(N,{type:"Button",label:"Button",category:"core",icon:h.ButtonIcon,group:"basic",props:{content:o.l({title:"Label",default:"Button"}),styles:o.S({default:"text-white bg-primary px-4 py-2 rounded-global flex items-center"}),icon:o.o({title:"Icon",default:""}),iconSize:o.c({title:"Icon Size",default:24}),iconPos:o.y({title:"Icon Position",default:"order-last",options:[{title:"Start",value:"order-first"},{title:"End",value:"order-last"}]})}});const A=e=>{const{blockProps:l,link:t,children:s,styles:r,inBuilder:a,content:i}=e;return!s&&y.isEmpty(r==null?void 0:r.className)&&y.isEmpty(i)?n.jsxRuntimeExports.jsx(x.EmptySlot,{inBuilder:a}):a?s?n.jsxRuntimeExports.jsx("span",{...l,...r,children:s}):u.createElement("span",{...l,...r,dangerouslySetInnerHTML:{__html:i}}):s?n.jsxRuntimeExports.jsx("a",{href:t.href||"#/",target:t.target,...l,...r,children:s}):u.createElement("a",{...l,...r,"data-ai-key":"content",href:t.href||"#",target:t.target||"_self",dangerouslySetInnerHTML:{__html:i}})};d.registerChaiBlock(A,{type:"Link",label:"Link",category:"core",icon:h.Link1Icon,group:"basic",props:{styles:o.S({default:""}),content:o.l({title:"Content",default:""}),link:o.T({title:"Link",default:{type:"page",target:"_self",href:""}})},canAcceptBlock:e=>e!=="Link"});const H=e=>{const{blockProps:l,children:t,listType:s,styles:r,tag:a,inBuilder:i}=e,c=f.cn(y.get(r,"className",""),s);return!t&&y.isEmpty(r==null?void 0:r.className)?n.jsxRuntimeExports.jsx(x.EmptySlot,{inBuilder:i}):u.createElement(a||(s==="list-decimal"?"ol":"ul"),{...l,...r,className:c},t)};d.registerChaiBlock(H,{type:"List",label:"List",icon:h.RowsIcon,category:"core",group:"basic",props:{styles:o.S({default:""}),listType:o.y({title:"List type",default:"list-disc",options:[{value:"list-none",title:"None"},{value:"list-disc",title:"Disc"},{value:"list-decimal",title:"Number"}]})},canAcceptBlock:e=>e==="ListItem",blocks:[{_type:"List",_id:"a",listType:"list-none",styles:"#styles:,"},{_type:"ListItem",_id:"b",_parent:"a",styles:"#styles:,",content:"Item 1"},{_type:"ListItem",_id:"c",_parent:"a",styles:"#styles:,",content:"Item 2"},{_type:"ListItem",_id:"d",_parent:"a",styles:"#styles:,",content:"Item 3"}]});const U=e=>{const{blockProps:l,content:t,styles:s,children:r,tag:a}=e;return r?u.createElement(a||"li",{...s,...l},r):u.createElement(a||"li",{...s,...l,"data-ai-key":"content",dangerouslySetInnerHTML:{__html:t}})};d.registerChaiBlock(U,{type:"ListItem",label:"List Item",icon:h.ColumnsIcon,category:"core",group:"basic",props:{styles:o.S({default:""}),content:o.g({title:"Content",default:"List item"})},canAcceptBlock:()=>!0,canBeNested:e=>e==="List"});const k=(e,...l)=>({...e,className:f.cn(e.className,...l)}),D=e=>{const{blockProps:l,icon:t,styles:s,width:r,inBuilder:a,height:i}=e,c=k(s,f.cn(r?`w-[${r}px]`:"",i?`h-[${i}px]`:""));if(y.isEmpty(t))return n.jsxRuntimeExports.jsx(x.EmptySlot,{inBuilder:a,className:"h-8 w-14"});const p=t.replace(/<svg /g,'<svg class="w-[inherit] h-[inherit]" ');return u.createElement("span",{...l,...c,dangerouslySetInnerHTML:{__html:p}})};d.registerChaiBlock(D,{type:"Icon",label:"Icon",category:"core",icon:h.SketchLogoIcon,group:"media",props:{styles:o.S({default:"text-black"}),icon:o.o({title:"Icon",default:'<svg stroke="currentColor" fill="currentColor" stroke-width="0" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><path d="M8 16c4.418 0 8-3.582 8-8s-3.582-8-8-8-8 3.582-8 8 3.582 8 8 8zM8 1.5c3.59 0 6.5 2.91 6.5 6.5s-2.91 6.5-6.5 6.5-6.5-2.91-6.5-6.5 2.91-6.5 6.5-6.5zM8 9.356c1.812 0 3.535-0.481 5-1.327-0.228 2.788-2.393 4.971-5 4.971s-4.772-2.186-5-4.973c1.465 0.845 3.188 1.329 5 1.329zM4 5.5c0-0.828 0.448-1.5 1-1.5s1 0.672 1 1.5c0 0.828-0.448 1.5-1 1.5s-1-0.672-1-1.5zM10 5.5c0-0.828 0.448-1.5 1-1.5s1 0.672 1 1.5c0 0.828-0.448 1.5-1 1.5s-1-0.672-1-1.5z"></path></svg>'}),width:o.c({title:"Width",default:""}),height:o.c({title:"Height",default:""})}});const q=e=>{const{blockProps:l,image:t,styles:s,alt:r,height:a,width:i}=e;return y.isEmpty(t)?n.jsxRuntimeExports.jsx(x.EmptySlot,{className:"h-36"}):u.createElement("img",{...l,...s,src:t,alt:r,loading:"lazy",height:a,width:i})};d.registerChaiBlock(q,{type:"Image",label:"Image",category:"core",icon:h.ImageIcon,group:"media",props:{styles:o.S({default:""}),image:o.q({title:"Image",default:"https://fakeimg.pl/400x200?text=Choose&font=bebas"}),alt:o.l({title:"Alt",default:""}),width:o.l({title:"Width",default:""}),height:o.l({title:"Height",default:""})}});const F=e=>{var i;const{blockProps:l,inBuilder:t,styles:s,children:r}=e;let a=null;return!r&&t&&(a=n.jsxRuntimeExports.jsx("div",{className:f.cn("flex flex-col items-center justify-center",(i=e.emptyStyles)==null?void 0:i.className),children:n.jsxRuntimeExports.jsx("div",{className:"h-full w-full rounded-md border-4 border-dashed",children:n.jsxRuntimeExports.jsxs("p",{className:"truncate p-1 text-left text-xs text-gray-400",children:["Slot: ",e.name]})})})),u.createElement("div",{...s,...l,droppable:"yes"},r||a)};d.registerChaiBlock(F,{type:"Slot",label:"Slot",group:"basic",category:"core",hidden:!0,props:{styles:o.S({default:""}),emptyStyles:o.S({default:""})},canAcceptBlock:()=>!0});const E=/^(https?:\/\/)?(www\.)?youtube\.com\/(watch\?v=|embed\/)([a-zA-Z0-9_-]{11})/,S=/^(https?:\/\/)?(www\.)?player.vimeo\.com/,I=/^(https?:\/\/)?(www\.)?dailymotion\.com\/(video|embed\/video)\/([a-zA-Z0-9_-]+)/,z=e=>{if(E.test(e)){const l=e.match(E);return l?`https://www.youtube.com/embed/${l[4]}`:e}if(S.test(e)){const l=e.match(S);return l?`https://player.vimeo.com/video/${l[3]}`:e}if(I.test(e)){const l=e.match(I);return l?`https://www.dailymotion.com/embed/video/${l[4]}`:e}return null},$=u.memo(e=>{const{blockProps:l,inBuilder:t,styles:s,url:r,controls:a}=e,i=y.get(a,"autoPlay",!1),c=y.get(a,"controls",!1),p=i||y.get(a,"muted",!0),m=y.get(a,"loop",!1);if(y.isEmpty(r))return n.jsxRuntimeExports.jsx(x.EmptySlot,{inBuilder:t,className:"h-36"});let b=z(r),g=null;if(b){if(!y.isEmpty(b)){const v=[];v.push(`autoplay=${i?1:0}`),v.push(`controls=${a?1:0}`),v.push(`mute=${p?1:0}&muted=${p?1:0}`),v.push(`loop=${m?1:0}`),b=`${b}?${v.join("&")}`}g=u.createElement("iframe",{...l,className:"absolute inset-0 w-full h-full",src:b,allow:t?"":"autoplay *; fullscreen *",allowFullScreen:!0,frameBorder:0})}else g=u.createElement("video",{...l,className:"absolute inset-0 w-full h-full",src:r,controls:c,muted:p,autoPlay:t?!1:i,loop:m});return n.jsxRuntimeExports.jsx("div",{...y.pick(s,["className"]),children:n.jsxRuntimeExports.jsxs("div",{className:"relative w-full overflow-hidden",style:{paddingBottom:"56.25%"},children:[t?n.jsxRuntimeExports.jsx("div",{...l,...y.omit(s,["className"]),className:"absolute inset-0 z-20 h-full w-full"}):null,g]})})});d.registerChaiBlock($,{type:"Video",label:"Video",category:"core",icon:h.VideoIcon,group:"media",props:{styles:o.S({default:""}),url:o.l({title:"Video URL",default:"https://www.youtube.com/watch?v=9xwazD5SyVg&ab_channel=MaximilianMustermann"}),controls:o.b({title:"Controls",properties:{autoPlay:o.r({title:"Autoplay",default:!0}),controls:o.r({title:"Show controls",default:!1}),loop:o.r({title:"Loop",default:!1}),muted:o.r({title:"Muted",default:!0})}})}});const O=u.memo(e=>{const{blockProps:l,styles:t,content:s,inBuilder:r}=e;return n.jsxRuntimeExports.jsxs("div",{className:"relative",children:[r?n.jsxRuntimeExports.jsx("div",{...l,...t,className:"absolute z-20 h-full w-full"}):null,u.createElement("div",{...t,dangerouslySetInnerHTML:{__html:s}})]})});d.registerChaiBlock(O,{type:"CustomHTML",label:"Custom HTML",category:"core",icon:h.CodeIcon,group:"advanced",props:{styles:o.S({default:""}),content:o.g({title:"HTML Content",default:"<div><p>HTML Snippet goes here...</p></div>",placeholder:"Enter custom HTML code here"})}});const V=e=>{const{blockProps:l,styles:t}=e;return u.createElement("hr",{...t,...l})};d.registerChaiBlock(V,{type:"Divider",label:"Divider",category:"core",icon:h.DividerHorizontalIcon,group:"basic",props:{styles:o.S({default:"bg-gray-900 h-0.5 py-2 my-1"})}});const G=e=>e.inBuilder||e.forceWrapper?n.jsxRuntimeExports.jsx("span",{"data-ai-key":"content",...e.blockProps,children:e.content}):`${e.content}`;d.registerChaiBlock(G,{type:"Text",label:"Text",hidden:!0,category:"core",group:"typography",icon:h.SpaceBetweenVerticallyIcon,props:{content:o.g({title:"Content",defaultValue:""})}});const W=({children:e,blockProps:l,styles:t})=>{const s=k(t,"hs-accordion-group");return n.jsxRuntimeExports.jsx("div",{...l,...s,children:e})};d.registerChaiBlock(W,{type:"AccordionGroup",label:"Accordion Group",category:"core",group:"advanced",props:{styles:o.S({default:""})},blocks:()=>{const e="dnd-accordion-"+f.generateUUID();return j.getBlocksFromHTML(`<div class="hs-accordion-group">
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("lodash-es"),n=require("./jsx-runtime-Z_BpKhVy.cjs"),w=require("react"),o=require("./controls-jWJDao88.cjs"),d=require("@chaibuilder/runtime"),x=require("./empty-slot-Sy930lX6.cjs"),h=require("@radix-ui/react-icons"),f=require("./Functions-N3yhPYKY.cjs"),j=require("./html-to-json-VPWiWWGH.cjs");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("clsx");require("tailwind-merge");require("himalaya");require("./STRINGS-gPz7CUOk.cjs");function R(e){const l=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const s=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(l,t,s.get?s:{enumerable:!0,get:()=>e[t]})}}return l.default=e,Object.freeze(l)}const u=R(w),C=u.memo(e=>{const{blockProps:l,inBuilder:t,backgroundImage:s,children:r,tag:a="div",styles:i}=e;let c=r;r||(c=n.jsxRuntimeExports.jsx(x.EmptySlot,{inBuilder:t}));let p={};return s&&(p={backgroundImage:`url(${s})`}),u.createElement(a,{...l,...i,style:p},c)});d.registerChaiBlock(C,{type:"Box",label:"Box",category:"core",group:"basic",props:{styles:o.S({default:""}),tag:o.y({title:"Tag",default:"div",options:[{value:"div",title:"div"},{value:"header",title:"header"},{value:"footer",title:"footer"},{value:"section",title:"section"},{value:"article",title:"article"},{value:"aside",title:"aside"},{value:"main",title:"main"},{value:"nav",title:"nav"},{value:"figure",title:"figure"},{value:"details",title:"details"},{value:"summary",title:"summary"},{value:"dialog",title:"dialog"},{value:"strike",title:"strike"},{value:"caption",title:"caption"},{value:"legend",title:"legend"},{value:"figcaption",title:"figcaption"},{value:"mark",title:"mark"}]}),backgroundImage:o.q({title:"Background Image"})},canAcceptBlock:()=>!0});const T=u.memo(e=>{const{blockProps:l,styles:t}=e;return u.createElement("div",{...l,...t})});d.registerChaiBlock(T,{type:"EmptyBox",label:"Empty Box",category:"core",group:"basic",props:{styles:o.S({default:""})},canAcceptBlock:()=>!1});const L=e=>{const{blockProps:l,styles:t,content:s,level:r="h1",children:a=null}=e;return a?u.createElement(r,{...t,...l},a):u.createElement(r,{...t,...l,"data-ai-key":"content","data-ai-type":"html",dangerouslySetInnerHTML:{__html:s}})};d.registerChaiBlock(L,{type:"Heading",label:"Heading",category:"core",icon:h.HeadingIcon,group:"typography",props:{level:o.y({title:"Level",default:"h1",binding:!1,options:[{value:"h1",title:"h1"},{value:"h2",title:"h2"},{value:"h3",title:"h3"},{value:"h4",title:"h4"},{value:"h5",title:"h5"},{value:"h6",title:"h6"}]}),styles:o.S({default:"text-3xl"}),content:o.g({title:"Content",default:"Heading goes here"})},canAcceptBlock:e=>e==="Span"||e==="Text"});const _=e=>{const{blockProps:l,styles:t,content:s}=e;return y.isNull(e.children)?u.createElement("p",{...t,...l,"data-ai-key":"content","data-ai-type":"html",dangerouslySetInnerHTML:{__html:s}}):u.createElement("p",{...t,...l},e.children)};d.registerChaiBlock(_,{type:"Paragraph",label:"Paragraph",category:"core",icon:h.TextIcon,group:"typography",props:{styles:o.S({default:""}),content:o.g({title:"Content",default:"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse varius enim in eros elementum tristique. Duis cursus, mi quis viverra ornare, eros dolor interdum nulla, ut commodo diam libero vitae erat. Aenean faucibus nibh et justo cursus id rutrum lorem imperdiet. Nunc ut sem vitae risus tristique posuere."})},canAcceptBlock:e=>e==="Span"||e==="Link"});const P=e=>{const{blockProps:l,styles:t,content:s,children:r=null,tag:a}=e;return r?u.createElement("span",{...t,...l},r):u.createElement(a||"span",{...t,...l,"data-ai-key":"content",dangerouslySetInnerHTML:{__html:s}})};d.registerChaiBlock(P,{type:"Span",label:"Span",category:"core",group:"typography",props:{styles:o.S({default:""}),content:o.g({title:"Content",default:"Enter your content"})},canAcceptBlock:()=>!0});const M=e=>{const{blockProps:l,content:t,styles:s}=e;return n.jsxRuntimeExports.jsx("div",{className:"max-w-full",children:n.jsxRuntimeExports.jsx("div",{"data-ai-key":"content","data-ai-type":"richtext",...l,...s,dangerouslySetInnerHTML:{__html:t}})})};d.registerChaiBlock(M,{type:"RichText",label:"Rich Text",category:"core",icon:h.CursorTextIcon,group:"typography",props:{styles:o.S({default:""}),content:o.m({title:"Content",default:"<p>This is a rich text block. You can add text, and other content here.</p>"})}});const N=e=>{const{blockProps:l,iconSize:t,icon:s,content:r,iconPos:a,styles:i,children:c}=e,p=s,m=c||n.jsxRuntimeExports.jsxs(n.jsxRuntimeExports.Fragment,{children:[n.jsxRuntimeExports.jsx("span",{"data-ai-key":"content",children:r}),p&&n.jsxRuntimeExports.jsx("div",{style:{width:t+"px"},className:a+" "+(a==="order-first"?"mr-2":"ml-2")||"",dangerouslySetInnerHTML:{__html:p}})]});return u.createElement("button",{...l,...i,type:"button"},m)};d.registerChaiBlock(N,{type:"Button",label:"Button",category:"core",icon:h.ButtonIcon,group:"basic",props:{content:o.l({title:"Label",default:"Button"}),styles:o.S({default:"text-white bg-primary px-4 py-2 rounded-global flex items-center"}),icon:o.o({title:"Icon",default:""}),iconSize:o.c({title:"Icon Size",default:24}),iconPos:o.y({title:"Icon Position",default:"order-last",options:[{title:"Start",value:"order-first"},{title:"End",value:"order-last"}]})}});const A=e=>{const{blockProps:l,link:t,children:s,styles:r,inBuilder:a,content:i}=e;return!s&&y.isEmpty(r==null?void 0:r.className)&&y.isEmpty(i)?n.jsxRuntimeExports.jsx(x.EmptySlot,{inBuilder:a}):a?s?n.jsxRuntimeExports.jsx("span",{...l,...r,children:s}):u.createElement("span",{...l,...r,dangerouslySetInnerHTML:{__html:i}}):s?n.jsxRuntimeExports.jsx("a",{href:t.href||"#/",target:t.target,...l,...r,children:s}):u.createElement("a",{...l,...r,"data-ai-key":"content",href:t.href||"#",target:t.target||"_self",dangerouslySetInnerHTML:{__html:i}})};d.registerChaiBlock(A,{type:"Link",label:"Link",category:"core",icon:h.Link1Icon,group:"basic",props:{styles:o.S({default:""}),content:o.l({title:"Content",default:""}),link:o.T({title:"Link",default:{type:"page",target:"_self",href:""}})},canAcceptBlock:e=>e!=="Link"});const H=e=>{const{blockProps:l,children:t,listType:s,styles:r,tag:a,inBuilder:i}=e,c=f.cn(y.get(r,"className",""),s);return!t&&y.isEmpty(r==null?void 0:r.className)?n.jsxRuntimeExports.jsx(x.EmptySlot,{inBuilder:i}):u.createElement(a||(s==="list-decimal"?"ol":"ul"),{...l,...r,className:c},t)};d.registerChaiBlock(H,{type:"List",label:"List",icon:h.RowsIcon,category:"core",group:"basic",props:{styles:o.S({default:""}),listType:o.y({title:"List type",default:"list-none",options:[{value:"list-none",title:"None"},{value:"list-disc",title:"Disc"},{value:"list-decimal",title:"Number"}]})},canAcceptBlock:e=>e==="ListItem",blocks:[{_type:"List",_id:"a",listType:"list-none",styles:"#styles:,"},{_type:"ListItem",_id:"b",_parent:"a",styles:"#styles:,",content:"Item 1"},{_type:"ListItem",_id:"c",_parent:"a",styles:"#styles:,",content:"Item 2"},{_type:"ListItem",_id:"d",_parent:"a",styles:"#styles:,",content:"Item 3"}]});const U=e=>{const{blockProps:l,content:t,styles:s,children:r,tag:a}=e;return r?u.createElement(a||"li",{...s,...l},r):u.createElement(a||"li",{...s,...l,"data-ai-key":"content",dangerouslySetInnerHTML:{__html:t}})};d.registerChaiBlock(U,{type:"ListItem",label:"List Item",icon:h.ColumnsIcon,category:"core",group:"basic",props:{styles:o.S({default:""}),content:o.g({title:"Content",default:"List item"})},canAcceptBlock:()=>!0,canBeNested:e=>e==="List"});const k=(e,...l)=>({...e,className:f.cn(e.className,...l)}),D=e=>{const{blockProps:l,icon:t,styles:s,width:r,inBuilder:a,height:i}=e,c=k(s,f.cn(r?`w-[${r}px]`:"",i?`h-[${i}px]`:""));if(y.isEmpty(t))return n.jsxRuntimeExports.jsx(x.EmptySlot,{inBuilder:a,className:"h-8 w-14"});const p=t.replace(/<svg /g,'<svg class="w-[inherit] h-[inherit]" ');return u.createElement("span",{...l,...c,dangerouslySetInnerHTML:{__html:p}})};d.registerChaiBlock(D,{type:"Icon",label:"Icon",category:"core",icon:h.SketchLogoIcon,group:"media",props:{styles:o.S({default:"text-black"}),icon:o.o({title:"Icon",default:'<svg stroke="currentColor" fill="currentColor" stroke-width="0" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><path d="M8 16c4.418 0 8-3.582 8-8s-3.582-8-8-8-8 3.582-8 8 3.582 8 8 8zM8 1.5c3.59 0 6.5 2.91 6.5 6.5s-2.91 6.5-6.5 6.5-6.5-2.91-6.5-6.5 2.91-6.5 6.5-6.5zM8 9.356c1.812 0 3.535-0.481 5-1.327-0.228 2.788-2.393 4.971-5 4.971s-4.772-2.186-5-4.973c1.465 0.845 3.188 1.329 5 1.329zM4 5.5c0-0.828 0.448-1.5 1-1.5s1 0.672 1 1.5c0 0.828-0.448 1.5-1 1.5s-1-0.672-1-1.5zM10 5.5c0-0.828 0.448-1.5 1-1.5s1 0.672 1 1.5c0 0.828-0.448 1.5-1 1.5s-1-0.672-1-1.5z"></path></svg>'}),width:o.c({title:"Width",default:""}),height:o.c({title:"Height",default:""})}});const q=e=>{const{blockProps:l,image:t,styles:s,alt:r,height:a,width:i}=e;return y.isEmpty(t)?n.jsxRuntimeExports.jsx(x.EmptySlot,{className:"h-36"}):u.createElement("img",{...l,...s,src:t,alt:r,loading:"lazy",height:a,width:i})};d.registerChaiBlock(q,{type:"Image",label:"Image",category:"core",icon:h.ImageIcon,group:"media",props:{styles:o.S({default:""}),image:o.q({title:"Image",default:"https://fakeimg.pl/400x200?text=Choose&font=bebas"}),alt:o.l({title:"Alt",default:""}),width:o.l({title:"Width",default:""}),height:o.l({title:"Height",default:""})}});const F=e=>{var i;const{blockProps:l,inBuilder:t,styles:s,children:r}=e;let a=null;return!r&&t&&(a=n.jsxRuntimeExports.jsx("div",{className:f.cn("flex flex-col items-center justify-center",(i=e.emptyStyles)==null?void 0:i.className),children:n.jsxRuntimeExports.jsx("div",{className:"h-full w-full rounded-md border-4 border-dashed",children:n.jsxRuntimeExports.jsxs("p",{className:"truncate p-1 text-left text-xs text-gray-400",children:["Slot: ",e.name]})})})),u.createElement("div",{...s,...l,droppable:"yes"},r||a)};d.registerChaiBlock(F,{type:"Slot",label:"Slot",group:"basic",category:"core",hidden:!0,props:{styles:o.S({default:""}),emptyStyles:o.S({default:""})},canAcceptBlock:()=>!0});const E=/^(https?:\/\/)?(www\.)?youtube\.com\/(watch\?v=|embed\/)([a-zA-Z0-9_-]{11})/,S=/^(https?:\/\/)?(www\.)?player.vimeo\.com/,I=/^(https?:\/\/)?(www\.)?dailymotion\.com\/(video|embed\/video)\/([a-zA-Z0-9_-]+)/,z=e=>{if(E.test(e)){const l=e.match(E);return l?`https://www.youtube.com/embed/${l[4]}`:e}if(S.test(e)){const l=e.match(S);return l?`https://player.vimeo.com/video/${l[3]}`:e}if(I.test(e)){const l=e.match(I);return l?`https://www.dailymotion.com/embed/video/${l[4]}`:e}return null},$=u.memo(e=>{const{blockProps:l,inBuilder:t,styles:s,url:r,controls:a}=e,i=y.get(a,"autoPlay",!1),c=y.get(a,"controls",!1),p=i||y.get(a,"muted",!0),m=y.get(a,"loop",!1);if(y.isEmpty(r))return n.jsxRuntimeExports.jsx(x.EmptySlot,{inBuilder:t,className:"h-36"});let b=z(r),g=null;if(b){if(!y.isEmpty(b)){const v=[];v.push(`autoplay=${i?1:0}`),v.push(`controls=${a?1:0}`),v.push(`mute=${p?1:0}&muted=${p?1:0}`),v.push(`loop=${m?1:0}`),b=`${b}?${v.join("&")}`}g=u.createElement("iframe",{...l,className:"absolute inset-0 w-full h-full",src:b,allow:t?"":"autoplay *; fullscreen *",allowFullScreen:!0,frameBorder:0})}else g=u.createElement("video",{...l,className:"absolute inset-0 w-full h-full",src:r,controls:c,muted:p,autoPlay:t?!1:i,loop:m});return n.jsxRuntimeExports.jsx("div",{...y.pick(s,["className"]),children:n.jsxRuntimeExports.jsxs("div",{className:"relative w-full overflow-hidden",style:{paddingBottom:"56.25%"},children:[t?n.jsxRuntimeExports.jsx("div",{...l,...y.omit(s,["className"]),className:"absolute inset-0 z-20 h-full w-full"}):null,g]})})});d.registerChaiBlock($,{type:"Video",label:"Video",category:"core",icon:h.VideoIcon,group:"media",props:{styles:o.S({default:""}),url:o.l({title:"Video URL",default:"https://www.youtube.com/watch?v=9xwazD5SyVg&ab_channel=MaximilianMustermann"}),controls:o.b({title:"Controls",properties:{autoPlay:o.r({title:"Autoplay",default:!0}),controls:o.r({title:"Show controls",default:!1}),loop:o.r({title:"Loop",default:!1}),muted:o.r({title:"Muted",default:!0})}})}});const O=u.memo(e=>{const{blockProps:l,styles:t,content:s,inBuilder:r}=e;return n.jsxRuntimeExports.jsxs("div",{className:"relative",children:[r?n.jsxRuntimeExports.jsx("div",{...l,...t,className:"absolute z-20 h-full w-full"}):null,u.createElement("div",{...t,dangerouslySetInnerHTML:{__html:s}})]})});d.registerChaiBlock(O,{type:"CustomHTML",label:"Custom HTML",category:"core",icon:h.CodeIcon,group:"advanced",props:{styles:o.S({default:""}),content:o.g({title:"HTML Content",default:"<div><p>HTML Snippet goes here...</p></div>",placeholder:"Enter custom HTML code here"})}});const V=e=>{const{blockProps:l,styles:t}=e;return u.createElement("hr",{...t,...l})};d.registerChaiBlock(V,{type:"Divider",label:"Divider",category:"core",icon:h.DividerHorizontalIcon,group:"basic",props:{styles:o.S({default:"bg-gray-900 h-0.5 py-2 my-1"})}});const G=e=>e.inBuilder||e.forceWrapper?n.jsxRuntimeExports.jsx("span",{"data-ai-key":"content",...e.blockProps,children:e.content}):`${e.content}`;d.registerChaiBlock(G,{type:"Text",label:"Text",hidden:!0,category:"core",group:"typography",icon:h.SpaceBetweenVerticallyIcon,props:{content:o.g({title:"Content",defaultValue:""})}});const W=({children:e,blockProps:l,styles:t})=>{const s=k(t,"hs-accordion-group");return n.jsxRuntimeExports.jsx("div",{...l,...s,children:e})};d.registerChaiBlock(W,{type:"AccordionGroup",label:"Accordion Group",category:"core",group:"advanced",props:{styles:o.S({default:""})},blocks:()=>{const e="dnd-accordion-"+f.generateUUID();return j.getBlocksFromHTML(`<div class="hs-accordion-group">
|
|
2
2
|
<div class="hs-accordion active" id="hs-unstyled-heading-one">
|
|
3
3
|
<button class="hs-accordion-toggle" aria-controls="hs-unstyled-collapse-one">
|
|
4
4
|
Accordion #1
|
package/dist/web-blocks.js
CHANGED