@chaibuilder/sdk 1.2.28 → 1.2.29
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 +2 -2
- package/dist/web-blocks.js +2 -5
- 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"),a=require("./jsx-runtime-Z_BpKhVy.cjs"),w=require("react"),o=require("./controls-KK2oLIa8.cjs"),d=require("@chaibuilder/runtime"),b=require("./empty-slot-nzYOgZuS.cjs"),h=require("@radix-ui/react-icons"),f=require("./Functions-N3yhPYKY.cjs"),E=require("./html-to-json-vP1ESB_e.cjs");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("clsx");require("tailwind-merge");require("himalaya");require("./STRINGS-gPz7CUOk.cjs");function R(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const l in e)if(l!=="default"){const s=Object.getOwnPropertyDescriptor(e,l);Object.defineProperty(t,l,s.get?s:{enumerable:!0,get:()=>e[l]})}}return t.default=e,Object.freeze(t)}const p=R(w),T=p.memo(e=>{const{blockProps:t,inBuilder:l,backgroundImage:s,children:r,tag:n="div",styles:i}=e;let c=r;r||(c=a.jsxRuntimeExports.jsx(b.EmptySlot,{blockProps:{},styles:{},inBuilder:l}));let u={};return s&&(u={backgroundImage:`url(${s})`}),p.createElement(n,{...t,...i,style:u},c)});d.registerChaiBlock(T,{type:"Box",label:"Box",category:"core",group:"basic",props:{styles:o.S({default:""}),tag:o.s({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.o({title:"Background Image"})},canAcceptBlock:()=>!0});const C=e=>{const{blockProps:t,styles:l,content:s,level:r="h1",children:n=null}=e;return n?p.createElement(r,{...l,...t},n):p.createElement(r,{...l,...t,dangerouslySetInnerHTML:{__html:s}})};d.registerChaiBlock(C,{type:"Heading",label:"Heading",category:"core",icon:h.HeadingIcon,group:"typography",props:{level:o.s({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 L=e=>{const{blockProps:t,styles:l,content:s}=e;return y.isNull(e.children)?p.createElement("p",{...l,...t,dangerouslySetInnerHTML:{__html:s}}):p.createElement("p",{...l,...t},e.children)};d.registerChaiBlock(L,{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 _=e=>{const{blockProps:t,styles:l,content:s,children:r=null,tag:n}=e;return r?p.createElement("span",{...l,...t},r):p.createElement(n||"span",{...l,...t,dangerouslySetInnerHTML:{__html:s}})};d.registerChaiBlock(_,{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 P=e=>{const{blockProps:t,content:l,styles:s}=e;return a.jsxRuntimeExports.jsx("div",{className:"max-w-full",children:a.jsxRuntimeExports.jsx("div",{...t,...s,dangerouslySetInnerHTML:{__html:l}})})};d.registerChaiBlock(P,{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 A=e=>{const{blockProps:t,iconSize:l,icon:s,content:r,iconPos:n,styles:i,children:c}=e,u=s,m=c||a.jsxRuntimeExports.jsxs(a.jsxRuntimeExports.Fragment,{children:[a.jsxRuntimeExports.jsx("span",{children:r}),u&&a.jsxRuntimeExports.jsx("div",{style:{width:l+"px"},className:n+" "+(n==="order-first"?"mr-2":"ml-2")||"",dangerouslySetInnerHTML:{__html:u}})]});return p.createElement("button",{...t,...i,type:"button"},m)};d.registerChaiBlock(A,{type:"Button",label:"Button",category:"core",icon:h.ButtonIcon,group:"basic",props:{content:o.u({title:"Label",default:"Button",multiLingual:!0}),styles:o.S({default:"text-white bg-primary px-4 py-2 rounded-global flex items-center"}),icon:o.T({title:"Icon",default:""}),iconSize:o.c({title:"Icon Size",default:24}),iconPos:o.s({title:"Icon Position",default:"order-last",options:[{title:"Start",value:"order-first"},{title:"End",value:"order-last"}]})}});const M=e=>{const{blockProps:t,link:l,children:s,styles:r,inBuilder:n,content:i}=e;return!s&&y.isEmpty(r==null?void 0:r.className)&&y.isEmpty(i)?a.jsxRuntimeExports.jsx(b.EmptySlot,{blockProps:t,inBuilder:n}):n?s?a.jsxRuntimeExports.jsx("span",{"data-simulate":"a",...t,...r,children:s}):p.createElement("span",{...t,...r,dangerouslySetInnerHTML:{__html:i},"data-simulate":"a"}):s?a.jsxRuntimeExports.jsx("a",{href:l.href||"#/",target:l.target,...t,...r,children:s}):p.createElement("a",{...t,...r,href:l.href||"#",target:l.target||"_self",dangerouslySetInnerHTML:{__html:i}})};d.registerChaiBlock(M,{type:"Link",label:"Link",category:"core",icon:h.Link1Icon,group:"basic",props:{styles:o.S({default:""}),content:o.u({title:"Content",default:""}),link:o.q({title:"Link",default:{type:"page",target:"_self",href:""}})},canAcceptBlock:()=>!0});const N=e=>{const{blockProps:t,children:l,listType:s,styles:r,tag:n,inBuilder:i}=e,c=f.cn(y.get(r,"className",""),s);return!l&&y.isEmpty(r==null?void 0:r.className)?a.jsxRuntimeExports.jsx(b.EmptySlot,{inBuilder:i,blockProps:t,text:"LIST ITEM"}):p.createElement(n||(s==="list-decimal"?"ol":"ul"),{...t,...r,className:c},l)};d.registerChaiBlock(N,{type:"List",label:"List",icon:h.RowsIcon,category:"core",group:"basic",props:{styles:o.S({default:""}),listType:o.s({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 H=e=>{const{blockProps:t,content:l,styles:s,children:r,tag:n}=e;return r?p.createElement(n||"li",{...s,...t},r):p.createElement(n||"li",{...s,...t,dangerouslySetInnerHTML:{__html:l}})};d.registerChaiBlock(H,{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,...t)=>({...e,className:f.cn(e.className,...t)}),D=e=>{const{blockProps:t,icon:l,styles:s,width:r,inBuilder:n,height:i}=e,c=k(s,f.cn("inline-block",r?`w-[${r}px]`:"",i?`h-[${i}px]`:""));if(y.isEmpty(l))return a.jsxRuntimeExports.jsx(b.EmptySlot,{blockProps:t,text:"",inBuilder:n,className:"h-8 w-14"});const u=l.replace(/<svg /g,'<svg class="w-[inherit] h-[inherit]" ');return p.createElement("span",{...t,...c,dangerouslySetInnerHTML:{__html:u}})};d.registerChaiBlock(D,{type:"Icon",label:"Icon",category:"core",icon:h.SketchLogoIcon,group:"media",props:{styles:o.S({default:"text-black"}),icon:o.T({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 U=e=>{const{blockProps:t,image:l,styles:s,alt:r,height:n,width:i}=e;return y.isEmpty(l)?a.jsxRuntimeExports.jsx(b.EmptySlot,{blockProps:t,text:"IMAGE URL",className:"h-36"}):p.createElement("img",{...t,...s,src:l,alt:r,height:n,width:i})};d.registerChaiBlock(U,{type:"Image",label:"Image",category:"core",icon:h.ImageIcon,group:"media",props:{styles:o.S({default:""}),image:o.o({title:"Image",default:"https://fakeimg.pl/400x200?text=Choose&font=bebas"}),alt:o.u({title:"Alt",default:""}),width:o.u({title:"Width",default:""}),height:o.u({title:"Height",default:""})}});const q=e=>{var i;const{blockProps:t,inBuilder:l,styles:s,children:r}=e;let n=null;return!r&&l&&(n=a.jsxRuntimeExports.jsx("div",{className:f.cn("flex flex-col items-center justify-center",(i=e.emptyStyles)==null?void 0:i.className),children:a.jsxRuntimeExports.jsx("div",{className:"h-full w-full rounded-md border-4 border-dashed",children:a.jsxRuntimeExports.jsxs("p",{className:"truncate p-1 text-left text-xs text-gray-400",children:["Slot: ",e.name]})})})),p.createElement("div",{...s,...t,droppable:"yes"},r||n)};d.registerChaiBlock(q,{type:"Slot",label:"Slot",group:"basic",category:"core",hidden:!0,props:{styles:o.S({default:""}),emptyStyles:o.S({default:""})},canAcceptBlock:()=>!0});const j=/^(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_-]+)/,F=e=>{if(j.test(e)){const t=e.match(j);return t?`https://www.youtube.com/embed/${t[4]}`:e}if(S.test(e)){const t=e.match(S);return t?`https://player.vimeo.com/video/${t[3]}`:e}if(I.test(e)){const t=e.match(I);return t?`https://www.dailymotion.com/embed/video/${t[4]}`:e}return null},O=p.memo(e=>{const{blockProps:t,inBuilder:l,styles:s,url:r,controls:n}=e,i=y.get(n,"autoPlay",!1),c=y.get(n,"controls",!1),u=i||y.get(n,"muted",!0),m=y.get(n,"loop",!1);if(y.isEmpty(r))return a.jsxRuntimeExports.jsx(b.EmptySlot,{inBuilder:l,blockProps:t,text:"VIDEO URL",className:"h-36"});let x=F(r),g=null;if(x){if(!y.isEmpty(x)){const v=[];v.push(`autoplay=${i?1:0}`),v.push(`controls=${n?1:0}`),v.push(`mute=${u?1:0}&muted=${u?1:0}`),v.push(`loop=${m?1:0}`),x=`${x}?${v.join("&")}`}g=p.createElement("iframe",{...t,className:"absolute inset-0 w-full h-full",src:x,allow:l?"":"autoplay *; fullscreen *",allowFullScreen:!0,frameBorder:0})}else g=p.createElement("video",{...t,className:"absolute inset-0 w-full h-full",src:r,controls:c,muted:u,autoPlay:l?!1:i,loop:m});return a.jsxRuntimeExports.jsx("div",{...y.pick(s,["className"]),children:a.jsxRuntimeExports.jsxs("div",{className:"relative w-full overflow-hidden",style:{paddingBottom:"56.25%"},children:[l?a.jsxRuntimeExports.jsx("div",{...t,...y.omit(s,["className"]),className:"absolute inset-0 z-20 h-full w-full"}):null,g]})})});d.registerChaiBlock(O,{type:"Video",label:"Video",category:"core",icon:h.VideoIcon,group:"media",props:{styles:o.S({default:""}),url:o.u({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 z=p.memo(e=>{const{blockProps:t,styles:l,content:s,inBuilder:r}=e;return a.jsxRuntimeExports.jsxs("div",{className:"relative",children:[r?a.jsxRuntimeExports.jsx("div",{...t,...l,className:"absolute z-20 h-full w-full"}):null,p.createElement("div",{...l,dangerouslySetInnerHTML:{__html:s}})]})});d.registerChaiBlock(z,{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 $=e=>{const{blockProps:t,styles:l}=e;return p.createElement("hr",{...l,...t})};d.registerChaiBlock($,{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 V=e=>e.inBuilder?a.jsxRuntimeExports.jsx("span",{className:"inline-block",...e.blockProps,children:e.content}):`${e.content}`;d.registerChaiBlock(V,{type:"Text",label:"Text",hidden:!0,category:"core",group:"typography",icon:h.SpaceBetweenVerticallyIcon,props:{content:o.g({title:"Content",defaultValue:""})}});const G=({children:e,blockProps:t,styles:l})=>{const s=k(l,"hs-accordion-group");return a.jsxRuntimeExports.jsx("div",{...t,...s,children:e})};d.registerChaiBlock(G,{type:"AccordionGroup",label:"Accordion Group",category:"core",group:"advanced",props:{styles:o.S({default:""})},blocks:()=>{const e="dnd-accordion-"+f.generateUUID();return E.getBlocksFromHTML(`<div class="hs-accordion-group">
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("lodash-es"),a=require("./jsx-runtime-Z_BpKhVy.cjs"),w=require("react"),o=require("./controls-KK2oLIa8.cjs"),d=require("@chaibuilder/runtime"),b=require("./empty-slot-nzYOgZuS.cjs"),h=require("@radix-ui/react-icons"),f=require("./Functions-N3yhPYKY.cjs"),E=require("./html-to-json-vP1ESB_e.cjs");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("clsx");require("tailwind-merge");require("himalaya");require("./STRINGS-gPz7CUOk.cjs");function R(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const l in e)if(l!=="default"){const s=Object.getOwnPropertyDescriptor(e,l);Object.defineProperty(t,l,s.get?s:{enumerable:!0,get:()=>e[l]})}}return t.default=e,Object.freeze(t)}const p=R(w),T=p.memo(e=>{const{blockProps:t,inBuilder:l,backgroundImage:s,children:r,tag:n="div",styles:i}=e;let c=r;r||(c=a.jsxRuntimeExports.jsx(b.EmptySlot,{blockProps:{},styles:{},inBuilder:l}));let u={};return s&&(u={backgroundImage:`url(${s})`}),p.createElement(n,{...t,...i,style:u},c)});d.registerChaiBlock(T,{type:"Box",label:"Box",category:"core",group:"basic",props:{styles:o.S({default:""}),tag:o.s({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.o({title:"Background Image"})},canAcceptBlock:()=>!0});const C=e=>{const{blockProps:t,styles:l,content:s,level:r="h1",children:n=null}=e;return n?p.createElement(r,{...l,...t},n):p.createElement(r,{...l,...t,dangerouslySetInnerHTML:{__html:s}})};d.registerChaiBlock(C,{type:"Heading",label:"Heading",category:"core",icon:h.HeadingIcon,group:"typography",props:{level:o.s({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 L=e=>{const{blockProps:t,styles:l,content:s}=e;return y.isNull(e.children)?p.createElement("p",{...l,...t,dangerouslySetInnerHTML:{__html:s}}):p.createElement("p",{...l,...t},e.children)};d.registerChaiBlock(L,{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 _=e=>{const{blockProps:t,styles:l,content:s,children:r=null,tag:n}=e;return r?p.createElement("span",{...l,...t},r):p.createElement(n||"span",{...l,...t,dangerouslySetInnerHTML:{__html:s}})};d.registerChaiBlock(_,{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 P=e=>{const{blockProps:t,content:l,styles:s}=e;return a.jsxRuntimeExports.jsx("div",{className:"max-w-full",children:a.jsxRuntimeExports.jsx("div",{...t,...s,dangerouslySetInnerHTML:{__html:l}})})};d.registerChaiBlock(P,{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 A=e=>{const{blockProps:t,iconSize:l,icon:s,content:r,iconPos:n,styles:i,children:c}=e,u=s,m=c||a.jsxRuntimeExports.jsxs(a.jsxRuntimeExports.Fragment,{children:[a.jsxRuntimeExports.jsx("span",{children:r}),u&&a.jsxRuntimeExports.jsx("div",{style:{width:l+"px"},className:n+" "+(n==="order-first"?"mr-2":"ml-2")||"",dangerouslySetInnerHTML:{__html:u}})]});return p.createElement("button",{...t,...i,type:"button"},m)};d.registerChaiBlock(A,{type:"Button",label:"Button",category:"core",icon:h.ButtonIcon,group:"basic",props:{content:o.u({title:"Label",default:"Button",multiLingual:!0}),styles:o.S({default:"text-white bg-primary px-4 py-2 rounded-global flex items-center"}),icon:o.T({title:"Icon",default:""}),iconSize:o.c({title:"Icon Size",default:24}),iconPos:o.s({title:"Icon Position",default:"order-last",options:[{title:"Start",value:"order-first"},{title:"End",value:"order-last"}]})}});const M=e=>{const{blockProps:t,link:l,children:s,styles:r,inBuilder:n,content:i}=e;return!s&&y.isEmpty(r==null?void 0:r.className)&&y.isEmpty(i)?a.jsxRuntimeExports.jsx(b.EmptySlot,{blockProps:t,inBuilder:n}):n?s?a.jsxRuntimeExports.jsx("span",{"data-simulate":"a",...t,...r,children:s}):p.createElement("span",{...t,...r,dangerouslySetInnerHTML:{__html:i},"data-simulate":"a"}):s?a.jsxRuntimeExports.jsx("a",{href:l.href||"#/",target:l.target,...t,...r,children:s}):p.createElement("a",{...t,...r,href:l.href||"#",target:l.target||"_self",dangerouslySetInnerHTML:{__html:i}})};d.registerChaiBlock(M,{type:"Link",label:"Link",category:"core",icon:h.Link1Icon,group:"basic",props:{styles:o.S({default:""}),content:o.u({title:"Content",default:""}),link:o.q({title:"Link",default:{type:"page",target:"_self",href:""}})},canAcceptBlock:()=>!0});const N=e=>{const{blockProps:t,children:l,listType:s,styles:r,tag:n,inBuilder:i}=e,c=f.cn(y.get(r,"className",""),s);return!l&&y.isEmpty(r==null?void 0:r.className)?a.jsxRuntimeExports.jsx(b.EmptySlot,{inBuilder:i,blockProps:t,text:"LIST ITEM"}):p.createElement(n||(s==="list-decimal"?"ol":"ul"),{...t,...r,className:c},l)};d.registerChaiBlock(N,{type:"List",label:"List",icon:h.RowsIcon,category:"core",group:"basic",props:{styles:o.S({default:""}),listType:o.s({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 H=e=>{const{blockProps:t,content:l,styles:s,children:r,tag:n}=e;return r?p.createElement(n||"li",{...s,...t},r):p.createElement(n||"li",{...s,...t,dangerouslySetInnerHTML:{__html:l}})};d.registerChaiBlock(H,{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,...t)=>({...e,className:f.cn(e.className,...t)}),D=e=>{const{blockProps:t,icon:l,styles:s,width:r,inBuilder:n,height:i}=e,c=k(s,f.cn(r?`w-[${r}px]`:"",i?`h-[${i}px]`:""));if(y.isEmpty(l))return a.jsxRuntimeExports.jsx(b.EmptySlot,{blockProps:t,text:"",inBuilder:n,className:"h-8 w-14"});const u=l.replace(/<svg /g,'<svg class="w-[inherit] h-[inherit]" ');return p.createElement("span",{...t,...c,dangerouslySetInnerHTML:{__html:u}})};d.registerChaiBlock(D,{type:"Icon",label:"Icon",category:"core",icon:h.SketchLogoIcon,group:"media",props:{styles:o.S({default:"text-black"}),icon:o.T({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 U=e=>{const{blockProps:t,image:l,styles:s,alt:r,height:n,width:i}=e;return y.isEmpty(l)?a.jsxRuntimeExports.jsx(b.EmptySlot,{blockProps:t,text:"IMAGE URL",className:"h-36"}):p.createElement("img",{...t,...s,src:l,alt:r,height:n,width:i})};d.registerChaiBlock(U,{type:"Image",label:"Image",category:"core",icon:h.ImageIcon,group:"media",props:{styles:o.S({default:""}),image:o.o({title:"Image",default:"https://fakeimg.pl/400x200?text=Choose&font=bebas"}),alt:o.u({title:"Alt",default:""}),width:o.u({title:"Width",default:""}),height:o.u({title:"Height",default:""})}});const q=e=>{var i;const{blockProps:t,inBuilder:l,styles:s,children:r}=e;let n=null;return!r&&l&&(n=a.jsxRuntimeExports.jsx("div",{className:f.cn("flex flex-col items-center justify-center",(i=e.emptyStyles)==null?void 0:i.className),children:a.jsxRuntimeExports.jsx("div",{className:"h-full w-full rounded-md border-4 border-dashed",children:a.jsxRuntimeExports.jsxs("p",{className:"truncate p-1 text-left text-xs text-gray-400",children:["Slot: ",e.name]})})})),p.createElement("div",{...s,...t,droppable:"yes"},r||n)};d.registerChaiBlock(q,{type:"Slot",label:"Slot",group:"basic",category:"core",hidden:!0,props:{styles:o.S({default:""}),emptyStyles:o.S({default:""})},canAcceptBlock:()=>!0});const j=/^(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_-]+)/,F=e=>{if(j.test(e)){const t=e.match(j);return t?`https://www.youtube.com/embed/${t[4]}`:e}if(S.test(e)){const t=e.match(S);return t?`https://player.vimeo.com/video/${t[3]}`:e}if(I.test(e)){const t=e.match(I);return t?`https://www.dailymotion.com/embed/video/${t[4]}`:e}return null},O=p.memo(e=>{const{blockProps:t,inBuilder:l,styles:s,url:r,controls:n}=e,i=y.get(n,"autoPlay",!1),c=y.get(n,"controls",!1),u=i||y.get(n,"muted",!0),m=y.get(n,"loop",!1);if(y.isEmpty(r))return a.jsxRuntimeExports.jsx(b.EmptySlot,{inBuilder:l,blockProps:t,text:"VIDEO URL",className:"h-36"});let x=F(r),g=null;if(x){if(!y.isEmpty(x)){const v=[];v.push(`autoplay=${i?1:0}`),v.push(`controls=${n?1:0}`),v.push(`mute=${u?1:0}&muted=${u?1:0}`),v.push(`loop=${m?1:0}`),x=`${x}?${v.join("&")}`}g=p.createElement("iframe",{...t,className:"absolute inset-0 w-full h-full",src:x,allow:l?"":"autoplay *; fullscreen *",allowFullScreen:!0,frameBorder:0})}else g=p.createElement("video",{...t,className:"absolute inset-0 w-full h-full",src:r,controls:c,muted:u,autoPlay:l?!1:i,loop:m});return a.jsxRuntimeExports.jsx("div",{...y.pick(s,["className"]),children:a.jsxRuntimeExports.jsxs("div",{className:"relative w-full overflow-hidden",style:{paddingBottom:"56.25%"},children:[l?a.jsxRuntimeExports.jsx("div",{...t,...y.omit(s,["className"]),className:"absolute inset-0 z-20 h-full w-full"}):null,g]})})});d.registerChaiBlock(O,{type:"Video",label:"Video",category:"core",icon:h.VideoIcon,group:"media",props:{styles:o.S({default:""}),url:o.u({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 z=p.memo(e=>{const{blockProps:t,styles:l,content:s,inBuilder:r}=e;return a.jsxRuntimeExports.jsxs("div",{className:"relative",children:[r?a.jsxRuntimeExports.jsx("div",{...t,...l,className:"absolute z-20 h-full w-full"}):null,p.createElement("div",{...l,dangerouslySetInnerHTML:{__html:s}})]})});d.registerChaiBlock(z,{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 $=e=>{const{blockProps:t,styles:l}=e;return p.createElement("hr",{...l,...t})};d.registerChaiBlock($,{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 V=e=>e.inBuilder?a.jsxRuntimeExports.jsx("span",{className:"inline-block",...e.blockProps,children:e.content}):`${e.content}`;d.registerChaiBlock(V,{type:"Text",label:"Text",hidden:!0,category:"core",group:"typography",icon:h.SpaceBetweenVerticallyIcon,props:{content:o.g({title:"Content",defaultValue:""})}});const G=({children:e,blockProps:t,styles:l})=>{const s=k(l,"hs-accordion-group");return a.jsxRuntimeExports.jsx("div",{...t,...s,children:e})};d.registerChaiBlock(G,{type:"AccordionGroup",label:"Accordion Group",category:"core",group:"advanced",props:{styles:o.S({default:""})},blocks:()=>{const e="dnd-accordion-"+f.generateUUID();return E.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
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
It is hidden by default, until the collapse plugin adds the appropriate classes that we use to style each element.
|
|
26
26
|
</div>
|
|
27
27
|
</div>
|
|
28
|
-
`.replace(/hs-unstyled-heading/g,e).replace(/hs-unstyled-collapse/g,e))}});const Y=({children:e,blockProps:t,styles:l})=>{const s=k(l,"hs-accordion-toggle");return a.jsxRuntimeExports.jsx("button",{...s,...t,children:e})};d.registerChaiBlock(Y,{type:"AccordionToggle",label:"Accordion Toggle",category:"core",group:"advanced",hidden:!0,props:{styles:o.S({default:"hs-accordion-active:text-blue-600 dark:hs-accordion-active:text-blue-500 inline-flex w-full items-center gap-x-3 rounded-lg px-6 py-3 text-start text-sm font-semibold text-gray-800 hover:text-gray-500 disabled:pointer-events-none disabled:opacity-50 dark:text-neutral-200 dark:hover:text-neutral-400"})},canAcceptBlock:()=>!0,canDelete:()=>!1,canMove:()=>!1,canDuplicate:()=>!1});const X=({children:e,blockProps:t,styles:l,blockState:s,inBuilder:r})=>{const n=k(l,"hs-accordion-content",r&&s?s!=null&&s.active?"!block !opacity-100":"!hidden !opacity-0":"");return a.jsxRuntimeExports.jsx("div",{...n,...t,children:e})};d.registerChaiBlock(X,{type:"AccordionContent",label:"Accordion Content",category:"core",group:"advanced",hidden:!0,props:{styles:o.S({default:"w-full overflow-hidden transition-height hidden duration-300"})},getBlockStateFrom:e=>[e._parent],canAcceptBlock:()=>!0,canDelete:()=>!1,canMove:()=>!1,canDuplicate:()=>!1});const Z=({children:e,blockProps:t,styles:l,blockState:s,inBuilder:r})=>{const n=r&&(s!=null&&s.active)?" open":"",i=k(l,"hs-collapse-toggle",n);return a.jsxRuntimeExports.jsx("button",{type:"button",...i,...t,children:e})};d.registerChaiBlock(Z,{type:"CollapseToggle",label:"Collapse Toggle",category:"core",group:"advanced",hidden:!0,props:{styles:o.S({default:""})},canAcceptBlock:()=>!0,customStylingStates:{"hs-collapse-open":"Collapse Open"},getBlockStateFrom:(e,t)=>{const l=y.get(e,"styles_attrs.data-hs-collapse","").replace("#","");if(!l)return[];const s=y.find(t,r=>y.get(r,"styles_attrs.id")===l);return s?[s==null?void 0:s._id]:[]}});const J=({children:e,blockProps:t,styles:l,blockState:s,inBuilder:r})=>{const n=r?{"!block !opacity-100 open":s==null?void 0:s.active,"
|
|
28
|
+
`.replace(/hs-unstyled-heading/g,e).replace(/hs-unstyled-collapse/g,e))}});const Y=({children:e,blockProps:t,styles:l})=>{const s=k(l,"hs-accordion-toggle");return a.jsxRuntimeExports.jsx("button",{...s,...t,children:e})};d.registerChaiBlock(Y,{type:"AccordionToggle",label:"Accordion Toggle",category:"core",group:"advanced",hidden:!0,props:{styles:o.S({default:"hs-accordion-active:text-blue-600 dark:hs-accordion-active:text-blue-500 inline-flex w-full items-center gap-x-3 rounded-lg px-6 py-3 text-start text-sm font-semibold text-gray-800 hover:text-gray-500 disabled:pointer-events-none disabled:opacity-50 dark:text-neutral-200 dark:hover:text-neutral-400"})},canAcceptBlock:()=>!0,canDelete:()=>!1,canMove:()=>!1,canDuplicate:()=>!1});const X=({children:e,blockProps:t,styles:l,blockState:s,inBuilder:r})=>{const n=k(l,"hs-accordion-content",r&&s?s!=null&&s.active?"!block !opacity-100":"!hidden !opacity-0":"");return a.jsxRuntimeExports.jsx("div",{...n,...t,children:e})};d.registerChaiBlock(X,{type:"AccordionContent",label:"Accordion Content",category:"core",group:"advanced",hidden:!0,props:{styles:o.S({default:"w-full overflow-hidden transition-height hidden duration-300"})},getBlockStateFrom:e=>[e._parent],canAcceptBlock:()=>!0,canDelete:()=>!1,canMove:()=>!1,canDuplicate:()=>!1});const Z=({children:e,blockProps:t,styles:l,blockState:s,inBuilder:r})=>{const n=r&&(s!=null&&s.active)?" open":"",i=k(l,"hs-collapse-toggle",n);return a.jsxRuntimeExports.jsx("button",{type:"button",...i,...t,children:e})};d.registerChaiBlock(Z,{type:"CollapseToggle",label:"Collapse Toggle",category:"core",group:"advanced",hidden:!0,props:{styles:o.S({default:""})},canAcceptBlock:()=>!0,customStylingStates:{"hs-collapse-open":"Collapse Open"},getBlockStateFrom:(e,t)=>{const l=y.get(e,"styles_attrs.data-hs-collapse","").replace("#","");if(!l)return[];const s=y.find(t,r=>y.get(r,"styles_attrs.id")===l);return s?[s==null?void 0:s._id]:[]}});const J=({children:e,blockProps:t,styles:l,blockState:s,inBuilder:r})=>{const n=r?{"!block !opacity-100 open":s==null?void 0:s.active,"":!(s!=null&&s.active)}:{},i=Object.keys(n).filter(u=>n[u]).join(" "),c=k(l,"hs-collapse",i);return a.jsxRuntimeExports.jsx("div",{...c,...t,children:e})};d.registerChaiBlock(J,{type:"Collapse",label:"Collapse",category:"core",group:"advanced",props:{styles:o.S({default:"transition-opacity transition-margin duration hs-collapse-open:opacity-100 opacity-0 w-56 hidden z-10 mt-2 min-w-60 bg-white"})},canAcceptBlock:()=>!0,blockState:{active:o.r({default:!1,title:"Show collapse in canvas"})},getBlockStateFrom:e=>[e._id],blocks:()=>E.getBlocksFromHTML(`<button type="button" class="hs-collapse-toggle" id="hs-unstyled-collapse" data-hs-collapse="#hs-unstyled-collapse-content">
|
|
29
29
|
Collapse
|
|
30
30
|
</button>
|
|
31
31
|
<div id="hs-unstyled-collapse-content" class="hs-collapse hidden w-full overflow-hidden transition-[height] duration-300" aria-labelledby="hs-unstyled-collapse">
|
package/dist/web-blocks.js
CHANGED
|
@@ -291,10 +291,7 @@ const w = (e, ...t) => ({
|
|
|
291
291
|
...e,
|
|
292
292
|
className: S(e.className, ...t)
|
|
293
293
|
}), Be = (e) => {
|
|
294
|
-
const { blockProps: t, icon: l, styles: o, width: s, inBuilder: a, height: r } = e, c = w(
|
|
295
|
-
o,
|
|
296
|
-
S("inline-block", s ? `w-[${s}px]` : "", r ? `h-[${r}px]` : "")
|
|
297
|
-
);
|
|
294
|
+
const { blockProps: t, icon: l, styles: o, width: s, inBuilder: a, height: r } = e, c = w(o, S(s ? `w-[${s}px]` : "", r ? `h-[${r}px]` : ""));
|
|
298
295
|
if (k(l))
|
|
299
296
|
return /* @__PURE__ */ n.jsx(v, { blockProps: t, text: "", inBuilder: a, className: "h-8 w-14" });
|
|
300
297
|
const u = l.replace(/<svg /g, '<svg class="w-[inherit] h-[inherit]" ');
|
|
@@ -639,7 +636,7 @@ d(He, {
|
|
|
639
636
|
}
|
|
640
637
|
});
|
|
641
638
|
const Re = ({ children: e, blockProps: t, styles: l, blockState: o, inBuilder: s }) => {
|
|
642
|
-
const a = s ? { "!block !opacity-100 open": o == null ? void 0 : o.active, "
|
|
639
|
+
const a = s ? { "!block !opacity-100 open": o == null ? void 0 : o.active, "": !(o != null && o.active) } : {}, r = Object.keys(a).filter((u) => a[u]).join(" "), c = w(l, "hs-collapse", r);
|
|
643
640
|
return /* @__PURE__ */ n.jsx("div", { ...c, ...t, children: e });
|
|
644
641
|
};
|
|
645
642
|
d(Re, {
|