@creaditor/newsletter-starterkit 1.0.12 → 1.0.13

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.
@@ -1,4 +1,4 @@
1
- "use strict";(("undefined"!=typeof self?self:this).webpackChunkCreaditor=("undefined"!=typeof self?self:this).webpackChunkCreaditor||[]).push([[6236],{46236:(e,t,r)=>{r.r(t),r.d(t,{BreadCrumbs:()=>l});var s=r(56666),i=r(40949),n=r(21293),o=(r(58860),r(70235)),c=r(23602),a=r(45607);class l extends n.oi{constructor(){super(),this.crumbs=[],this.cover=function(){const e=document.createElement("div");return e.style.position="fixed",e.style.background="var(--primary)",e.style.zIndex=2,e.style.border="1px dashed black",e.style.opacity=.2,e}(),this.currectCrumb={},this.onSubscribe=()=>{let e;this.crumbs=[];const t=a.Z.components[a.Z.components.length-1];if(!t)return;e=t.element;let r=t.type.getElementType(),s="";t.props.as&&(s=` (${o.h.get("lang",t.props.as)||t.props.as})`),this.currectCrumb={type:r,as:s,name:t.props.name,id:t.id};if(e){let t=e;for(;t&&t.parentElement;)if(t=t.parentElement.closest("[data-type]"),t){const e=o.h.get("components",t.dataset.id);let r=!0;e&&"row"!==e.type&&("col"===e.type&&"block"!==e.parent().type&&(r=!1),r&&this.crumbs.unshift({type:e.type,name:e.props.name,id:e.id,element:e.element,compose:e}))}this.dispatchEvent(new CustomEvent("change",[...this.crumbs]))}},this.onSubscribe=this.onSubscribe.bind(this)}onHover(e){if(e){const t=e.getBoundingClientRect();this.cover.style.left=t.left+"px",this.cover.style.top=t.top+"px",this.cover.style.width=t.width+"px",this.cover.style.height=t.height+"px",document.body.appendChild(this.cover)}}render(){const e=o.h.get("langConfig","direction");return this.crumbs.length>0?n.dy`
1
+ "use strict";(("undefined"!=typeof self?self:this).webpackChunkCreaditor=("undefined"!=typeof self?self:this).webpackChunkCreaditor||[]).push([[6236],{46236:(e,t,r)=>{r.r(t),r.d(t,{BreadCrumbs:()=>l});var s=r(56666),o=r(40949),n=r(21293),i=(r(58860),r(70235)),c=r(23602),a=r(45607);class l extends n.oi{constructor(){super(),this.crumbs=[],this.cover=function(){const e=document.createElement("div");return e.style.position="fixed",e.style.background="var(--primary)",e.style.zIndex=2,e.style.border="1px dashed black",e.style.opacity=.2,e}(),this.currectCrumb={},this.onSubscribe=()=>{let e;this.crumbs=[];const t=a.Z.components[a.Z.components.length-1];if(!t)return;if(e=t.element,!e)return void console.error("selectElement not found","#1ppqmvss6");let r=t.type.getElementType(),s="";t.props.as&&(s=` (${i.h.get("lang",t.props.as)||t.props.as})`),this.currectCrumb={type:r,as:s,name:t.props.name,id:t.id};if(e){let t=e;for(;t&&t.parentElement;)if(t=t.parentElement.closest("[data-type]"),t){const e=i.h.get("components",t.dataset.id);let r=!0;e&&"row"!==e.type&&("col"===e.type&&"block"!==e.parent().type&&(r=!1),r&&this.crumbs.unshift({type:e.type,name:e.props.name,id:e.id,element:e.element,compose:e}))}this.dispatchEvent(new CustomEvent("change",[...this.crumbs]))}},this.onSubscribe=this.onSubscribe.bind(this)}onHover(e){if(e){const t=e.getBoundingClientRect();this.cover.style.left=t.left+"px",this.cover.style.top=t.top+"px",this.cover.style.width=t.width+"px",this.cover.style.height=t.height+"px",document.body.appendChild(this.cover)}}render(){const e=i.h.get("langConfig","direction");return this.crumbs.length>0?n.dy`
2
2
  <!-- <cdtr-tooltip content="breadcrumbs_info" .opened=${!0}></cdtr-tooltip> -->
3
3
  <div>
4
4
  ${this.crumbs.map(((t,r)=>n.dy` <span
@@ -7,7 +7,7 @@
7
7
  @mousedown=${()=>this.clickBread(t)}
8
8
  class="breadcrumb"
9
9
  >${t.name||n.dy`<lang-text text=${t.type}></lang-text>`}</span
10
- >${this.crumbs.length===r?null:(0,i.Z)(c.IT,{style:{transform:`rotate(${"ltr"===e?"180deg":"0"})`},class:"arrow"})}`))}
10
+ >${this.crumbs.length===r?null:(0,o.Z)(c.IT,{style:{transform:`rotate(${"ltr"===e?"180deg":"0"})`},class:"arrow"})}`))}
11
11
  ${this.mainText?n.dy` <div class="currect">
12
12
  ${this.currectCrumb.name||n.dy`<lang-text text=${this.currectCrumb.type}></lang-text
13
13
  >${this.currectCrumb.as}`}
Binary file
@@ -1,6 +1,6 @@
1
- "use strict";(("undefined"!=typeof self?self:this).webpackChunkCreaditor=("undefined"!=typeof self?self:this).webpackChunkCreaditor||[]).push([[7637],{77637:(e,t,r)=>{r.r(t),r.d(t,{default:()=>L});var n=r(9571),s=r(8427);let i={};function a(e){i.selected=e}function c(e){return i.selected}const o=[{type:"youtube",src:"https://panel.sendmsg.co.il/templateContentImages/images/CreaditorGeneral/youtube.png"},{type:"whatsapp",src:"https://panel.sendmsg.co.il/templateContentImages/images/CreaditorGeneral/whatsapp.png"},{type:"snapchat",src:"https://panel.sendmsg.co.il/templateContentImages/images/CreaditorGeneral/snapchat.png"},{type:"instagram",src:"https://render.creaditor.ai/media/social-icons/instagram-black-square.png"},{type:"telegram",src:"https://render.creaditor.ai/media/social-icons/telegram-blue-square.png"},{type:"facebook",src:"https://render.creaditor.ai/media/social-icons/facebook-black-square.png"},{type:"vimeo",src:"https://render.creaditor.ai/media/social-icons/vimeo-blue-square.png"},{type:"email",src:"https://render.creaditor.ai/media/social-icons/broken-link-black-circle.png"},{type:"phone",src:"https://render.creaditor.ai/media/social-icons/phone-black-circle.png"},{type:"x",src:"https://render.creaditor.ai/media/social-icons/x-black-circle.png"},{type:"linkedin",src:"https://render.creaditor.ai/media/social-icons/linkedin-black-circle.png"},{type:"tiktok",src:"https://render.creaditor.ai/media/social-icons/tiktok-black-circle.png"},{type:"reddit",src:"https://render.creaditor.ai/media/social-icons/reddit-black-circle.png"},{type:"twitch",src:"https://render.creaditor.ai/media/social-icons/twitch-black-circle.png"}];const l=e=>{{const{component:t,commands:r}=e,n=c();return n?{select:e=>{let{changeTab:t,tab:r}=e;"link"!==r&&t("link")},tabs:e=>{const t=[{text:"image"},{text:"link"},{text:"design"}];return t.forEach((t=>t.selected=t.selected=t.text===e)),t},layout:e=>{let{tab:i,changeTab:a,tabs:c}=e;const l=[{type:"node",node:()=>s.dy`<img
1
+ "use strict";(("undefined"!=typeof self?self:this).webpackChunkCreaditor=("undefined"!=typeof self?self:this).webpackChunkCreaditor||[]).push([[7637],{77637:(e,t,s)=>{s.r(t),s.d(t,{default:()=>_});var r=s(9571),i=s(8427);let n={};function a(e){n.selected=e}function c(e){return n.selected}const o=[{type:"youtube",src:"https://panel.sendmsg.co.il/templateContentImages/images/CreaditorGeneral/youtube.png"},{type:"whatsapp",src:"https://panel.sendmsg.co.il/templateContentImages/images/CreaditorGeneral/whatsapp.png"},{type:"snapchat",src:"https://panel.sendmsg.co.il/templateContentImages/images/CreaditorGeneral/snapchat.png"},{type:"instagram",src:"https://render.creaditor.ai/media/social-icons/instagram-black-square.png"},{type:"telegram",src:"https://render.creaditor.ai/media/social-icons/telegram-blue-square.png"},{type:"facebook",src:"https://render.creaditor.ai/media/social-icons/facebook-black-square.png"},{type:"vimeo",src:"https://render.creaditor.ai/media/social-icons/vimeo-blue-square.png"},{type:"email",src:"https://render.creaditor.ai/media/social-icons/broken-link-black-circle.png"},{type:"phone",src:"https://render.creaditor.ai/media/social-icons/phone-black-circle.png"},{type:"x",src:"https://render.creaditor.ai/media/social-icons/x-black-circle.png"},{type:"linkedin",src:"https://render.creaditor.ai/media/social-icons/linkedin-black-circle.png"},{type:"tiktok",src:"https://render.creaditor.ai/media/social-icons/tiktok-black-circle.png"},{type:"reddit",src:"https://render.creaditor.ai/media/social-icons/reddit-black-circle.png"},{type:"twitch",src:"https://render.creaditor.ai/media/social-icons/twitch-black-circle.png"}];const l=e=>{{const{component:t,commands:s}=e;let r=c();return r||(r=t.props.items.find((e=>!e.link)),r||(r=t.props.items[0])),{select:e=>{let{changeTab:t,tab:s}=e;"link"!==s&&t("link")},tabs:e=>{const t=[{text:"image"},{text:"link"},{text:"design"}];return t.forEach((t=>t.selected=t.selected=t.text===e)),t},layout:e=>{let{tab:n,changeTab:a,tabs:c}=e;const l=[{type:"node",node:()=>i.dy`<img
2
2
  style="padding:10px;display:block;margin:auto"
3
3
  width="52"
4
4
  height="52"
5
- src=${n?.src}
6
- />`},{type:"button",text:"delete",bgColor:"#df381d",color:"#fff",icon:"deleteBin",active:!0,onClick:e=>{const s=[...t.props.items];if(s.length<2)return;const i=s.findIndex((e=>e.id===n.id));-1!==i&&(s.splice(i,1),r.execCommand("items",s))}},{type:"divider"},{type:"gallery",active:"image"===i.text,src:n?.src,hasPreview:!0,text:"open_gallery",justify:"flex-start",onChange:e=>{let s=e.detail;Array.isArray(s)&&(s=s[0]);const i=t.props,a=JSON.parse(JSON.stringify(i.items)),c=a.findIndex((e=>e.id===n.id));-1!==c&&(a[c].src=s.src,r.execCommand("items",a))}},{type:"linkpicker",href:n.link||n.url,active:()=>"link"===i.text&&!!n,onChange:e=>{const s=e.target.value,i=t.props,a=JSON.parse(JSON.stringify(i.items)),c=a.findIndex((e=>e.id===n.id));if(-1!==c){if(o.find((e=>e.src===a[c].src))){let e=function(e){if("string"!=typeof e)return;const t=document.createElement("a");t.href=e;const r=t.hostname,n=o.find((e=>-1!==r.indexOf(e.type)));return"tel:"===t.protocol?"https://render.creaditor.ai/media/social-icons/phone-black-circle.png":"mailto:"===t.protocol?"https://render.creaditor.ai/media/social-icons/mail-black-circle.png":n?n.src:"https://render.creaditor.ai/media/social-icons/broken-link-black-circle.png"}(s.href);e&&(a[c].src=e)}a[c].url=s.href,a[c].link=s,r.execCommand("items",a)}}},{type:"slider",title:"size",active:"design"===i.text,value:parseInt(n?.style?.width),min:10,max:80,onInput:e=>{const n=e.target.value,s=[...t.props.items];s.forEach((e=>{e.style.width=n+"px",e.style.height=n+"px"})),r.execCommand("items",s)}},{type:"divider"},{type:"slider",title:"spacing",active:"design"===i.text,value:parseFloat(t.props.style.gap),min:0,max:80,onInput:e=>{const t=e.target.value;r.execCommand("style",{gap:t+"px"})}}];return l}}:null}};var d=r(46245);const p=()=>({set:(e,t,r)=>{switch(t){case"style":if("object"==typeof r)return e[t]=(0,d.Z)(e[t],r),!0;case"items":if(e[t]=r,Array.isArray(r)){const e=c(),t=r.find((t=>t.id===e.id));if(t)return a(t),!0}case"src":const n=c();if(n){const s=[...e.items],i=s.findIndex((e=>e.id===n.id));if(-1!==i)return s[i].src=r,e[t]=s,!0}}}});var m=r(46062),h=r.n(m),u=r(32877),f=r.n(u),g=r(96793),y=r.n(g),b=r(17892),k=r.n(b),C=r(11173),x=r.n(C),v=r(12089),A={};A.setAttributes=k(),A.insert=y().bind(null,"head"),A.domAPI=f(),A.insertStyleElement=x();h()(v.Z,A);const w=v.Z&&v.Z.locals?v.Z.locals:void 0;var I=r(51921);const L=()=>{const e="social";return{name:e,create:t=>{let{createElement:r,compose:s,helpers:i}=t;const d=document.createElement("div"),m=document.createElement("div");m.classList.add(w.root);new I.ZP(m,{sort:!0,delay:0,delayOnTouchOnly:!1,touchStartThreshold:0,disabled:!1,store:null,animation:150,easing:"cubic-bezier(1, 0, 0, 1)",preventOnFilter:!0,draggable:".item",dataIdAttr:"data-id",ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",swapThreshold:1,invertSwap:!1,invertedSwapThreshold:1,direction:"horizontal",forceFallback:!1,fallbackClass:"sortable-fallback",fallbackOnBody:!1,fallbackTolerance:0,dragoverBubble:!1,removeCloneOnHide:!0,emptyInsertThreshold:5,setData:function(e,t){e.setData("Text",t.textContent)},onChoose:function(e){e.oldIndex},onUnchoose:function(e){},onStart:function(e){e.oldIndex},onEnd:function(e){const t=JSON.parse(JSON.stringify(s.props.items)),{oldIndex:r,newIndex:n}=e,[i]=t.splice(r,1);t.splice(n,0,i),s.editor.store().execCommand("items",t)},onMove:function(e,t){e.dragged,e.draggedRect,e.related,e.relatedRect,e.willInsertAfter,t.clientY},onChange:function(e){e.newIndex}});d.appendChild(m);return r({name:e,id:s.id,template:d,draggable:{group:"element"},droppable:{group:"element"},render:()=>{for(s.props.items.forEach((e=>{if(!e.src){const t=(e=>{if(!e)return;const t=e.toLowerCase();if(t.startsWith("mailto:"))return"email";if(t.startsWith("tel:"))return"phone";try{const r=(t.startsWith("http")?new URL(e):new URL(`https://${e}`)).hostname.replace("www.",""),n=r.split(".")[0];return o.find((e=>{const t=e.type.toLowerCase();return r.includes(t)||t.includes(n)||n.includes(t)}))?.type}catch(e){return o.find((e=>{const r=e.type.toLowerCase();return t.includes(r)||r.includes(t)}))?.type}})(e.url);t&&(e.src=o.find((e=>e.type===t))?.src)}}));m.firstChild;)m.removeChild(m.firstChild);i.mergeDiff(m,{style:s.props.style});const e=c();s.props.items.forEach((t=>{const r=document.createElement("img");e?.id===t.id&&r.classList.add(w.selected),r.addEventListener("click",(()=>{a(t),Array.from(m.children).forEach((e=>{e.classList.remove(w.selected)})),r.classList.add(w.selected)})),r.classList.add("item"),t.id&&r.setAttribute("data-id",t.id),r.src=t.src,i.mergeDiff(r,{style:t.style}),m.append(r)}));const t=document.createElement("paper-button");t.style.minWidth="0",t.style.padding=0,t.innerHTML="<cdtr-icon icon='add'></cdtr-icon>",m.append(t),t.addEventListener("click",(()=>{setTimeout((()=>{const e=s.props.items[s.props.items.length-1],t={id:(0,n.Z)(),fgColor:"",bgColor:"",style:e.style,url:"",src:"https://render.creaditor.ai/media/social-icons/broken-link-black-circle.png"},r=[...s.props.items];r.push(t),a(t),s.editor.store().execCommand("items",r)}),200)}))},handleBar:!0,defaultProps:{},validator:p(),schema:s.schema,onSelect:e=>{},onDeselect:e=>{},elementProps:s,remove:()=>{d.remove()},createEditor:l})}}}},12089:(e,t,r)=>{r.d(t,{Z:()=>c});var n=r(40272),s=r.n(n),i=r(82609),a=r.n(i)()(s());a.push([e.id,".kfYL5P8k1NoeIcHkTLa_{\n display: flex;\n}\n.qVA_0R0VNI45kslNcUpm{\n border:1px solid var(--primary);\n}","",{version:3,sources:["webpack://./../social-editor-component-newsletter/lib/style.module.css"],names:[],mappings:"AAAA;IACI,aAAa;AACjB;AACA;IACI,+BAA+B;AACnC",sourcesContent:[".root{\n display: flex;\n}\n.selected{\n border:1px solid var(--primary);\n}"],sourceRoot:""}]),a.locals={root:"kfYL5P8k1NoeIcHkTLa_",selected:"qVA_0R0VNI45kslNcUpm"};const c=a}}]);
5
+ src=${r?.src}
6
+ />`},{type:"button",text:"delete",bgColor:"#df381d",color:"#fff",icon:"deleteBin",active:!0,onClick:e=>{const i=[...t.props.items];if(i.length<2)return;const n=i.findIndex((e=>e.id===r.id));-1!==n&&(i.splice(n,1),s.execCommand("items",i))}},{type:"divider"},{type:"gallery",active:"image"===n.text,src:r?.src,hasPreview:!0,text:"open_gallery",justify:"flex-start",onChange:e=>{let i=e.detail;Array.isArray(i)&&(i=i[0]);const n=t.props,a=JSON.parse(JSON.stringify(n.items)),c=a.findIndex((e=>e.id===r.id));-1!==c&&(a[c].src=i.src,s.execCommand("items",a))}},{type:"linkpicker",href:r.link||r.url,active:()=>"link"===n.text&&!!r,onChange:e=>{const i=e.target.value,n=t.props,a=JSON.parse(JSON.stringify(n.items)),c=a.findIndex((e=>e.id===r.id));if(-1!==c){if(o.find((e=>e.src===a[c].src))){let e=function(e){if("string"!=typeof e)return;const t=document.createElement("a");t.href=e;const s=t.hostname,r=o.find((e=>-1!==s.indexOf(e.type)));return"tel:"===t.protocol?"https://render.creaditor.ai/media/social-icons/phone-black-circle.png":"mailto:"===t.protocol?"https://render.creaditor.ai/media/social-icons/mail-black-circle.png":r?r.src:"https://render.creaditor.ai/media/social-icons/broken-link-black-circle.png"}(i.href);e&&(a[c].src=e)}a[c].url=i.href,a[c].link=i,s.execCommand("items",a)}}},{type:"slider",title:"size",active:"design"===n.text,value:parseInt(r?.style?.width),min:10,max:80,onInput:e=>{const r=e.target.value,i=[...t.props.items];i.forEach((e=>{e.style.width=r+"px",e.style.height=r+"px"})),s.execCommand("items",i)}},{type:"divider"},{type:"slider",title:"spacing",active:"design"===n.text,value:parseFloat(t.props.style.gap),min:0,max:80,onInput:e=>{const t=e.target.value;s.execCommand("style",{gap:t+"px"})}}];return l}}}};var d=s(46245);const p=()=>({set:(e,t,s)=>{switch(t){case"style":if("object"==typeof s)return e[t]=(0,d.Z)(e[t],s),!0;case"items":if(e[t]=s,Array.isArray(s)){const e=c(),t=s.find((t=>t.id===e.id));if(t)return a(t),!0}case"src":const r=c();if(r){const i=[...e.items],n=i.findIndex((e=>e.id===r.id));if(-1!==n)return i[n].src=s,e[t]=i,!0}}}});var m=s(46062),h=s.n(m),u=s(32877),f=s.n(u),g=s(96793),y=s.n(g),b=s(17892),k=s.n(b),C=s(11173),x=s.n(C),v=s(12089),w={};w.setAttributes=k(),w.insert=y().bind(null,"head"),w.domAPI=f(),w.insertStyleElement=x();h()(v.Z,w);const A=v.Z&&v.Z.locals?v.Z.locals:void 0;var I=s(51921);const _=()=>{const e="social";return{name:e,create:t=>{let{createElement:s,compose:i,helpers:n}=t;const d=document.createElement("div"),m=document.createElement("div");m.classList.add(A.root);new I.ZP(m,{sort:!0,delay:0,delayOnTouchOnly:!1,touchStartThreshold:0,disabled:!1,store:null,animation:150,easing:"cubic-bezier(1, 0, 0, 1)",preventOnFilter:!0,draggable:".item",dataIdAttr:"data-id",ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",swapThreshold:1,invertSwap:!1,invertedSwapThreshold:1,direction:"horizontal",forceFallback:!1,fallbackClass:"sortable-fallback",fallbackOnBody:!1,fallbackTolerance:0,dragoverBubble:!1,removeCloneOnHide:!0,emptyInsertThreshold:5,setData:function(e,t){e.setData("Text",t.textContent)},onChoose:function(e){e.oldIndex},onUnchoose:function(e){},onStart:function(e){e.oldIndex},onEnd:function(e){const t=JSON.parse(JSON.stringify(i.props.items)),{oldIndex:s,newIndex:r}=e,[n]=t.splice(s,1);t.splice(r,0,n),i.editor.store().execCommand("items",t)},onMove:function(e,t){e.dragged,e.draggedRect,e.related,e.relatedRect,e.willInsertAfter,t.clientY},onChange:function(e){e.newIndex}});d.appendChild(m);return s({name:e,id:i.id,template:d,draggable:{group:"element"},droppable:{group:"element"},render:()=>{for(i.props.items.forEach((e=>{if(!e.src){const t=(e=>{if(!e)return;const t=e.toLowerCase();if(t.startsWith("mailto:"))return"email";if(t.startsWith("tel:"))return"phone";try{const s=(t.startsWith("http")?new URL(e):new URL(`https://${e}`)).hostname.replace("www.",""),r=s.split(".")[0];return o.find((e=>{const t=e.type.toLowerCase();return s.includes(t)||t.includes(r)||r.includes(t)}))?.type}catch(e){return o.find((e=>{const s=e.type.toLowerCase();return t.includes(s)||s.includes(t)}))?.type}})(e.url);t&&(e.src=o.find((e=>e.type===t))?.src)}}));m.firstChild;)m.removeChild(m.firstChild);n.mergeDiff(m,{style:i.props.style});const e=c();i.props.items.forEach((t=>{const s=document.createElement("img");e?.id===t.id&&s.classList.add(A.selected),s.addEventListener("click",(()=>{a(t),Array.from(m.children).forEach((e=>{e.classList.remove(A.selected)})),s.classList.add(A.selected)})),s.classList.add("item"),t.id&&s.setAttribute("data-id",t.id),s.src=t.src,n.mergeDiff(s,{style:t.style}),m.append(s)}));const t=document.createElement("paper-button");t.style.minWidth="0",t.style.padding=0,t.innerHTML="<cdtr-icon icon='add'></cdtr-icon>",m.append(t),t.addEventListener("click",(()=>{setTimeout((()=>{const e=i.props.items[i.props.items.length-1],t={id:(0,r.Z)(),fgColor:"",bgColor:"",style:e.style,url:"",src:"https://render.creaditor.ai/media/social-icons/broken-link-black-circle.png"},s=[...i.props.items];s.push(t),a(t),i.editor.store().execCommand("items",s)}),200)}))},handleBar:!0,defaultProps:{},validator:p(),schema:i.schema,onSelect:e=>{const t=c();if(t){const s=document.querySelector(`[data-id="${t.id}"]`);s?(window.___social_cdtr_item=s,s.classList.add("selected_underlined")):d.classList.add(e)}},onDeselect:e=>{c();window.___social_cdtr_item&&window.___social_cdtr_item.classList.remove("selected_underlined"),d?.classList?.remove(e)},elementProps:i,remove:()=>{d.remove()},createEditor:l})}}}},12089:(e,t,s)=>{s.d(t,{Z:()=>c});var r=s(40272),i=s.n(r),n=s(82609),a=s.n(n)()(i());a.push([e.id,".kfYL5P8k1NoeIcHkTLa_{\n display: flex;\n}\n.qVA_0R0VNI45kslNcUpm{\n border:1px solid var(--primary);\n}","",{version:3,sources:["webpack://./../social-editor-component-newsletter/lib/style.module.css"],names:[],mappings:"AAAA;IACI,aAAa;AACjB;AACA;IACI,+BAA+B;AACnC",sourcesContent:[".root{\n display: flex;\n}\n.selected{\n border:1px solid var(--primary);\n}"],sourceRoot:""}]),a.locals={root:"kfYL5P8k1NoeIcHkTLa_",selected:"qVA_0R0VNI45kslNcUpm"};const c=a}}]);
Binary file
@@ -1,4 +1,4 @@
1
- "use strict";(("undefined"!=typeof self?self:this).webpackChunkCreaditor=("undefined"!=typeof self?self:this).webpackChunkCreaditor||[]).push([[901],{20901:(e,t,r)=>{r.r(t),r.d(t,{PexelsGallery:()=>n});var o=r(56666),a=r(8427),s=(r(70235),r(9085)),l=(r(36351),r(61828),r(59051));const i="jUU57RHRVmWvXd22MBjQkDhcf9Prkbufc6KXUChhrEIOr6IqNeNvMOUl",c="https://api.pexels.com/v1/search",h=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:20;return fetch(`${c}?query=${encodeURIComponent(e)}&page=${t}&per_page=${r}`,{method:"GET",headers:{Authorization:i,"Content-Type":"application/json"}})};class n extends a.oi{constructor(){super(),this.images=[],this.loading=!1,this.searchQuery="",this.page=1,this.hasMore=!0,this.perPage=20,this.multi=!0,this.selectedColor="",this.defaultSearchTerms=["nature","landscape","city","people","technology","food","architecture","travel","business","art"],this.colorOptions=[{name:"Red",value:"red",hex:"#ff0000"},{name:"Orange",value:"orange",hex:"#ff8000"},{name:"Yellow",value:"yellow",hex:"#ffff00"},{name:"Green",value:"green",hex:"#00ff00"},{name:"Blue",value:"blue",hex:"#0000ff"},{name:"Purple",value:"purple",hex:"#8000ff"},{name:"Pink",value:"pink",hex:"#ff0080"},{name:"Brown",value:"brown",hex:"#8b4513"},{name:"Black",value:"black",hex:"#000000"},{name:"White",value:"white",hex:"#ffffff"},{name:"Gray",value:"gray",hex:"#808080"},{name:"Teal",value:"teal",hex:"#008080"},{name:"Navy",value:"navy",hex:"#000080"},{name:"Maroon",value:"maroon",hex:"#800000"},{name:"Olive",value:"olive",hex:"#808000"},{name:"Lime",value:"lime",hex:"#00ff00"},{name:"Aqua",value:"aqua",hex:"#00ffff"},{name:"Silver",value:"silver",hex:"#c0c0c0"},{name:"Fuchsia",value:"fuchsia",hex:"#ff00ff"},{name:"Coral",value:"coral",hex:"#ff7f50"},{name:"Gold",value:"gold",hex:"#ffd700"},{name:"Indigo",value:"indigo",hex:"#4b0082"},{name:"Violet",value:"violet",hex:"#ee82ee"},{name:"Cyan",value:"cyan",hex:"#00ffff"},{name:"Magenta",value:"magenta",hex:"#ff00ff"}],this.cacheKey="pexels-gallery-cache",this.cacheExpiry=864e5,this.isTyping=!1,this.lastSearchQuery="",this.searchTimeout=null}connectedCallback(){super.connectedCallback(),this.loadFromCache()}getCacheData(){try{const e=localStorage.getItem(this.cacheKey);if(!e)return null;const t=JSON.parse(e),r=Date.now();return t.timestamp&&r-t.timestamp>this.cacheExpiry?(localStorage.removeItem(this.cacheKey),null):t}catch(e){return console.error("Error reading cache:",e),null}}saveToCache(){if(!this.isTyping)try{const e={images:this.images,searchQuery:this.searchQuery,selectedColor:this.selectedColor,page:this.page,hasMore:this.hasMore,timestamp:Date.now()};localStorage.setItem(this.cacheKey,JSON.stringify(e))}catch(e){console.error("Error saving to cache:",e)}}loadFromCache(){const e=this.getCacheData();e?(this.images=e.images||[],this.searchQuery=e.searchQuery||"",this.selectedColor=e.selectedColor||"",this.page=e.page||1,this.hasMore=void 0===e.hasMore||e.hasMore,console.log("Gallery state restored from cache"),this.requestUpdate(),this.updateComplete.then((()=>{this.updateSearchInput()}))):this.loadRandomImages()}updateSearchInput(){const e=this.shadowRoot?.querySelector('cdtr-input[type="search"]');e&&(e.value=this.searchQuery)}async loadRandomImages(){this.loading=!0;try{const e=this.defaultSearchTerms[Math.floor(Math.random()*this.defaultSearchTerms.length)],t=await h(e,1,this.perPage);if(t.ok){const e=await t.json();this.images=e.photos||[],this.hasMore=e.photos&&e.photos.length===this.perPage,this.searchQuery="",this.selectedColor="",this.page=1,this.saveToCache()}else console.error("Failed to load images from Pexels"),this.images=[]}catch(e){console.error("Error loading images:",e),this.images=[]}finally{this.loading=!1}}async searchImages(e){if(!e.trim())return this.loadRandomImages();this.loading=!0,this.searchQuery=e,this.page=1;try{const t=await h(e,1,this.perPage);if(t.ok){const e=await t.json();this.images=e.photos||[],this.hasMore=e.photos&&e.photos.length===this.perPage,this.saveToCache()}else console.error("Failed to search images from Pexels"),this.images=[]}catch(e){console.error("Error searching images:",e),this.images=[]}finally{this.loading=!1}}async loadMoreImages(){if(!this.loading&&this.hasMore){this.loading=!0,this.page++;try{let e;if(this.selectedColor&&"all"!==this.selectedColor){let t=this.removeColorFilters(this.searchQuery);e=t.trim()?`${t} ${this.selectedColor}`:this.selectedColor}else{e=this.removeColorFilters(this.searchQuery)||this.defaultSearchTerms[Math.floor(Math.random()*this.defaultSearchTerms.length)]}const t=await h(e,this.page,this.perPage);if(t.ok){const e=(await t.json()).photos||[];this.images=[...this.images,...e],this.hasMore=e.length===this.perPage,this.saveToCache()}}catch(e){console.error("Error loading more images:",e)}finally{this.loading=!1}}}onSearch(e){const t=e.target.value;this.isTyping=!0,t!==this.lastSearchQuery&&(this.lastSearchQuery=t,this.searchTimeout&&clearTimeout(this.searchTimeout),this.searchTimeout=setTimeout((()=>{this.isTyping=!1,this.searchWithColor(t,this.selectedColor)}),500))}onSelectImage(e){const t=`Photo by ${e.photographer} on Pexels`,r=`Photo by <a href="${e.photographer_url}" target="_blank" rel="noopener noreferrer">${e.photographer}</a> on <a href="${e.url}" target="_blank" rel="noopener noreferrer">Pexels</a>`,o={detail:{id:e.id,src:e.src.medium||e.src.large||e.src.original,name:`Pexels Image ${e.id}`,size:`${e.width}x${e.height}`,photographer:e.photographer,photographerUrl:e.photographer_url,pexelsUrl:e.url,alt:e.alt||`Photo by ${e.photographer} on Pexels`,attributionText:t,attributionHtml:r},bubbles:!1,composed:!1};this.dispatchEvent(new CustomEvent("file",o))}sendSelectedImages(){const e={detail:this.images.filter((e=>e.selected)).map((e=>{const t=`Photo by ${e.photographer} on Pexels`,r=`Photo by <a href="${e.photographer_url}" target="_blank" rel="noopener noreferrer">${e.photographer}</a> on <a href="${e.url}" target="_blank" rel="noopener noreferrer">Pexels</a>`;return{id:e.id,src:e.src.medium||e.src.large||e.src.original,name:`Pexels Image ${e.id}`,size:`${e.width}x${e.height}`,photographer:e.photographer,photographerUrl:e.photographer_url,pexelsUrl:e.url,alt:e.alt||`Photo by ${e.photographer} on Pexels`,attributionText:t,attributionHtml:r}})),bubbles:!1,composed:!1};this.dispatchEvent(new CustomEvent("file",e))}onScroll(e){const t=e.target;t.scrollTop+t.offsetHeight>=t.scrollHeight-50&&this.loadMoreImages()}clearCache(){localStorage.removeItem(this.cacheKey),console.log("Gallery cache cleared")}onColorChange(e){console.log("Color change event:",e);const t=e.target.value;console.log("Selected color:",t),this.selectedColor="all"===t?"":t;const r=this.searchQuery||"";this.searchWithColor(r,this.selectedColor)}searchWithColor(e,t){if(t&&"all"!==t){let r=this.removeColorFilters(e),o=r.trim()?`${r} ${t}`:t;this.searchImages(o)}else{let t=this.removeColorFilters(e);this.searchImages(t)}}removeColorFilters(e){if(!e)return"";const t=this.colorOptions.map((e=>e.value));return e.split(" ").filter((e=>{const r=e.toLowerCase().trim();return!t.includes(r)})).join(" ").trim()}getSelectedColorName(){if(!this.selectedColor)return"Filter by color";const e=this.colorOptions.find((e=>e.value===this.selectedColor));return e?e.name:"Filter by color"}getSelectedColorHex(){if(!this.selectedColor)return"#666";const e=this.colorOptions.find((e=>e.value===this.selectedColor));return e?e.hex:"#666"}render(){return a.dy`
1
+ "use strict";(("undefined"!=typeof self?self:this).webpackChunkCreaditor=("undefined"!=typeof self?self:this).webpackChunkCreaditor||[]).push([[901],{20901:(e,t,r)=>{r.r(t),r.d(t,{PexelsGallery:()=>n});var o=r(56666),a=r(8427),s=(r(70235),r(9085)),l=(r(36351),r(61828),r(59051)),i=r(76828);function c(e){e||(e={query:"nature",per_page:1});const t=`${i.W7.agent_url}pexels/search/?query=${e.query||"marketing"}&per_page=${e.per_page||1}`;return fetch(t).then((e=>e.json())).then((e=>{if("success"===e.status&&e.data)return e.data;throw new Error("Invalid response from backend")})).catch((e=>{throw console.error("Error fetching images:",e),e}))}class n extends a.oi{constructor(){super(),this.images=[],this.loading=!1,this.searchQuery="",this.page=1,this.hasMore=!0,this.perPage=20,this.multi=!0,this.selectedColor="",this.defaultSearchTerms=["nature","landscape","city","people","technology","food","architecture","travel","business","art"],this.colorOptions=[{name:"Red",value:"red",hex:"#ff0000"},{name:"Orange",value:"orange",hex:"#ff8000"},{name:"Yellow",value:"yellow",hex:"#ffff00"},{name:"Green",value:"green",hex:"#00ff00"},{name:"Blue",value:"blue",hex:"#0000ff"},{name:"Purple",value:"purple",hex:"#8000ff"},{name:"Pink",value:"pink",hex:"#ff0080"},{name:"Brown",value:"brown",hex:"#8b4513"},{name:"Black",value:"black",hex:"#000000"},{name:"White",value:"white",hex:"#ffffff"},{name:"Gray",value:"gray",hex:"#808080"},{name:"Teal",value:"teal",hex:"#008080"},{name:"Navy",value:"navy",hex:"#000080"},{name:"Maroon",value:"maroon",hex:"#800000"},{name:"Olive",value:"olive",hex:"#808000"},{name:"Lime",value:"lime",hex:"#00ff00"},{name:"Aqua",value:"aqua",hex:"#00ffff"},{name:"Silver",value:"silver",hex:"#c0c0c0"},{name:"Fuchsia",value:"fuchsia",hex:"#ff00ff"},{name:"Coral",value:"coral",hex:"#ff7f50"},{name:"Gold",value:"gold",hex:"#ffd700"},{name:"Indigo",value:"indigo",hex:"#4b0082"},{name:"Violet",value:"violet",hex:"#ee82ee"},{name:"Cyan",value:"cyan",hex:"#00ffff"},{name:"Magenta",value:"magenta",hex:"#ff00ff"}],this.cacheKey="pexels-gallery-cache",this.cacheExpiry=864e5,this.isTyping=!1,this.lastSearchQuery="",this.searchTimeout=null}connectedCallback(){super.connectedCallback(),this.loadFromCache()}getCacheData(){try{const e=localStorage.getItem(this.cacheKey);if(!e)return null;const t=JSON.parse(e),r=Date.now();return t.timestamp&&r-t.timestamp>this.cacheExpiry?(localStorage.removeItem(this.cacheKey),null):t}catch(e){return console.error("Error reading cache:",e),null}}saveToCache(){if(!this.isTyping)try{const e={images:this.images,searchQuery:this.searchQuery,selectedColor:this.selectedColor,page:this.page,hasMore:this.hasMore,timestamp:Date.now()};localStorage.setItem(this.cacheKey,JSON.stringify(e))}catch(e){console.error("Error saving to cache:",e)}}loadFromCache(){const e=this.getCacheData();e?(this.images=e.images||[],this.searchQuery=e.searchQuery||"",this.selectedColor=e.selectedColor||"",this.page=e.page||1,this.hasMore=void 0===e.hasMore||e.hasMore,console.log("Gallery state restored from cache"),this.requestUpdate(),this.updateComplete.then((()=>{this.updateSearchInput()}))):this.loadRandomImages()}updateSearchInput(){const e=this.shadowRoot?.querySelector('cdtr-input[type="search"]');e&&(e.value=this.searchQuery)}async loadRandomImages(){this.loading=!0;try{const e=this.defaultSearchTerms[Math.floor(Math.random()*this.defaultSearchTerms.length)],t=await c(e,this.perPage);if(t.ok){const e=await t.json();this.images=e.photos||[],this.hasMore=e.photos&&e.photos.length===this.perPage,this.searchQuery="",this.selectedColor="",this.page=1,this.saveToCache()}else console.error("Failed to load images from Pexels"),this.images=[]}catch(e){console.error("Error loading images:",e),this.images=[]}finally{this.loading=!1}}async searchImages(e){if(!e.trim())return this.loadRandomImages();this.loading=!0,this.searchQuery=e,this.page=1;try{const t=await c(e,this.perPage);if(t.ok){const e=await t.json();this.images=e.photos||[],this.hasMore=e.photos&&e.photos.length===this.perPage,this.saveToCache()}else console.error("Failed to search images from Pexels"),this.images=[]}catch(e){console.error("Error searching images:",e),this.images=[]}finally{this.loading=!1}}async loadMoreImages(){if(!this.loading&&this.hasMore){this.loading=!0,this.page++;try{let e;if(this.selectedColor&&"all"!==this.selectedColor){let t=this.removeColorFilters(this.searchQuery);e=t.trim()?`${t} ${this.selectedColor}`:this.selectedColor}else{e=this.removeColorFilters(this.searchQuery)||this.defaultSearchTerms[Math.floor(Math.random()*this.defaultSearchTerms.length)]}const t=await c(e,this.page,this.perPage);if(t.ok){const e=(await t.json()).photos||[];this.images=[...this.images,...e],this.hasMore=e.length===this.perPage,this.saveToCache()}}catch(e){console.error("Error loading more images:",e)}finally{this.loading=!1}}}onSearch(e){const t=e.target.value;this.isTyping=!0,t!==this.lastSearchQuery&&(this.lastSearchQuery=t,this.searchTimeout&&clearTimeout(this.searchTimeout),this.searchTimeout=setTimeout((()=>{this.isTyping=!1,this.searchWithColor(t,this.selectedColor)}),500))}onSelectImage(e){const t=`Photo by ${e.photographer} on Pexels`,r=`Photo by <a href="${e.photographer_url}" target="_blank" rel="noopener noreferrer">${e.photographer}</a> on <a href="${e.url}" target="_blank" rel="noopener noreferrer">Pexels</a>`,o={detail:{id:e.id,src:e.src.medium||e.src.large||e.src.original,name:`Pexels Image ${e.id}`,size:`${e.width}x${e.height}`,photographer:e.photographer,photographerUrl:e.photographer_url,pexelsUrl:e.url,alt:e.alt||`Photo by ${e.photographer} on Pexels`,attributionText:t,attributionHtml:r},bubbles:!1,composed:!1};this.dispatchEvent(new CustomEvent("file",o))}sendSelectedImages(){const e={detail:this.images.filter((e=>e.selected)).map((e=>{const t=`Photo by ${e.photographer} on Pexels`,r=`Photo by <a href="${e.photographer_url}" target="_blank" rel="noopener noreferrer">${e.photographer}</a> on <a href="${e.url}" target="_blank" rel="noopener noreferrer">Pexels</a>`;return{id:e.id,src:e.src.medium||e.src.large||e.src.original,name:`Pexels Image ${e.id}`,size:`${e.width}x${e.height}`,photographer:e.photographer,photographerUrl:e.photographer_url,pexelsUrl:e.url,alt:e.alt||`Photo by ${e.photographer} on Pexels`,attributionText:t,attributionHtml:r}})),bubbles:!1,composed:!1};this.dispatchEvent(new CustomEvent("file",e))}onScroll(e){const t=e.target;t.scrollTop+t.offsetHeight>=t.scrollHeight-50&&this.loadMoreImages()}clearCache(){localStorage.removeItem(this.cacheKey),console.log("Gallery cache cleared")}onColorChange(e){console.log("Color change event:",e);const t=e.target.value;console.log("Selected color:",t),this.selectedColor="all"===t?"":t;const r=this.searchQuery||"";this.searchWithColor(r,this.selectedColor)}searchWithColor(e,t){if(t&&"all"!==t){let r=this.removeColorFilters(e),o=r.trim()?`${r} ${t}`:t;this.searchImages(o)}else{let t=this.removeColorFilters(e);this.searchImages(t)}}removeColorFilters(e){if(!e)return"";const t=this.colorOptions.map((e=>e.value));return e.split(" ").filter((e=>{const r=e.toLowerCase().trim();return!t.includes(r)})).join(" ").trim()}getSelectedColorName(){if(!this.selectedColor)return"Filter by color";const e=this.colorOptions.find((e=>e.value===this.selectedColor));return e?e.name:"Filter by color"}getSelectedColorHex(){if(!this.selectedColor)return"#666";const e=this.colorOptions.find((e=>e.value===this.selectedColor));return e?e.hex:"#666"}render(){return a.dy`
2
2
  <div class="gallery-container">
3
3
  <cdtr-row alignItems="center">
4
4
  <cdtr-input
Binary file