@creaditor/web-starterkit 1.0.63 → 1.0.65

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.
Files changed (40) hide show
  1. package/dist/1142.creaditor.bundle.js +1 -1
  2. package/dist/1142.creaditor.bundle.js.gz +0 -0
  3. package/dist/1728.creaditor.bundle.js +133 -0
  4. package/dist/1728.creaditor.bundle.js.gz +0 -0
  5. package/dist/2655.creaditor.bundle.js +16 -0
  6. package/dist/2655.creaditor.bundle.js.gz +0 -0
  7. package/dist/3521.creaditor.bundle.js +2 -11
  8. package/dist/3521.creaditor.bundle.js.gz +0 -0
  9. package/dist/3600.creaditor.bundle.js +1 -0
  10. package/dist/3600.creaditor.bundle.js.gz +0 -0
  11. package/dist/3847.creaditor.bundle.js +9 -9
  12. package/dist/3847.creaditor.bundle.js.gz +0 -0
  13. package/dist/4000.creaditor.bundle.js +1 -0
  14. package/dist/4000.creaditor.bundle.js.gz +0 -0
  15. package/dist/5884.creaditor.bundle.js +8 -8
  16. package/dist/5884.creaditor.bundle.js.gz +0 -0
  17. package/dist/5926.creaditor.bundle.js +1 -1
  18. package/dist/5926.creaditor.bundle.js.gz +0 -0
  19. package/dist/6442.creaditor.bundle.js +214 -155
  20. package/dist/6442.creaditor.bundle.js.gz +0 -0
  21. package/dist/{8547.creaditor.bundle.js → 7348.creaditor.bundle.js} +66 -131
  22. package/dist/7348.creaditor.bundle.js.gz +0 -0
  23. package/dist/7493.creaditor.bundle.js +48 -0
  24. package/dist/7493.creaditor.bundle.js.gz +0 -0
  25. package/dist/creaditor.bundle.js +800 -345
  26. package/dist/creaditor.bundle.js.LICENSE.txt +6 -0
  27. package/dist/creaditor.bundle.js.LICENSE.txt.gz +0 -0
  28. package/dist/creaditor.bundle.js.gz +0 -0
  29. package/dist/service-worker.js +1 -1
  30. package/dist/service-worker.js.gz +0 -0
  31. package/package.json +1 -1
  32. package/dist/1204.creaditor.bundle.js +0 -236
  33. package/dist/1204.creaditor.bundle.js.gz +0 -0
  34. package/dist/5119.creaditor.bundle.js +0 -48
  35. package/dist/5119.creaditor.bundle.js.gz +0 -0
  36. package/dist/6442.creaditor.bundle.js.LICENSE.txt +0 -23
  37. package/dist/6442.creaditor.bundle.js.LICENSE.txt.gz +0 -0
  38. package/dist/7937.creaditor.bundle.js +0 -51
  39. package/dist/7937.creaditor.bundle.js.gz +0 -0
  40. package/dist/8547.creaditor.bundle.js.gz +0 -0
@@ -1 +1 @@
1
- "use strict";(("undefined"!=typeof self?self:this).webpackChunkCreaditor=("undefined"!=typeof self?self:this).webpackChunkCreaditor||[]).push([[1142],{41142(e,t,n){n.d(t,{default:()=>b});const o=e=>{{const{component:t,commands:n,helpers:o}=e,a=t.parent("col"),l=e=>"style"===e.text,s=(e,n)=>t.props[e]??t.props.style?.[e]??n;return{select:e=>{let{changeTab:t,tab:n}=e;n.text||t("style")},tabs:e=>{const t=[{text:"style",selected:!0},{text:"animations"},{text:"settings"}];return e?(t.forEach(t=>t.selected=t.text===e),t):t},layout:e=>{let{tab:c,changeTab:i,tabs:r}=e;return[{type:"heading",level:6,text:"video",active:()=>l(c)},{type:"input",title:"add_urlAddress_from_media_site",active:()=>l(c),value:s("url",""),onChange:e=>{let t=e.target.value;if(-1!==t.indexOf("youtube.com/shorts/")){const e=t.split("/");e.length>0&&(t=`https://youtu.be/${e[e.length-1]}`)}n.execCommand("url",t)}},{type:"heading",level:6,text:"playback",active:()=>l(c)},{type:"checkbox",title:"autoplay",info:"autoplayMutedInfo",active:()=>l(c),checked:!!s("playing",!1),onChange:e=>{const t=e.target.checked;n.execCommand("playing",t),t&&!s("muted",!0)&&(n.execCommand("muted",!0),i("style"))}},{type:"checkbox",title:"playInLoop",active:()=>l(c),checked:!!s("loop",!1),onChange:e=>{n.execCommand("loop",e.target.checked)}},{type:"checkbox",title:"slientMode",active:()=>l(c),checked:!!s("muted",!0),onChange:e=>{n.execCommand("muted",e.target.checked)}},{type:"checkbox",title:"showControls",active:()=>l(c),checked:!1!==s("controls",!0),onChange:e=>{n.execCommand("controls",e.target.checked)}},{type:"checkbox",title:"showAsImage",active:()=>l(c),checked:!!s("light",!1),onChange:e=>{n.execCommand("light",e.target.checked)}},{type:"checkbox",title:"playInline",active:()=>l(c),checked:!!s("playsinline",!1),onChange:e=>{n.execCommand("playsinline",e.target.checked)}},{type:"slider",title:"volume",min:0,max:100,unit:"%",active:()=>l(c),value:Math.round(100*(s("volume",.8)??.8)),onInput:e=>{n.execCommand("volume",Number(e.target.value)/100)}},{type:"heading",level:6,text:"size",active:()=>l(c)},{type:"fontSize",title:"size",min:10,active:()=>l(c),max:a?.element?.offsetWidth,value:parseInt(t.props.style.width),device:e=>{if("phone"===e.target.device){const n=t.props?.breakpoints?.sm?.style?.width||t.props.style.width;e.target.value=parseInt(n)}else e.target.value=parseInt(t.props.style.width)},onInput:e=>{const t=e.target.value;"phone"===e.target.device?n.execCommand("breakpoints",e=>{const n=e.props.breakpoints?.sm||{};return{sm:o.deepMerge(n,{style:{width:t+"px",height:9*t/16+"px"}})}}):n.execCommand("style",{width:t+"px"})}}]}}}};var a=n(52144);const l=["playing","loop","muted","controls","light","playsinline"],s=()=>({set:(e,t,n)=>{if(l.includes(t))return e[t]=Boolean(n),!0;switch(t){case"url":return e[t]=n,!0;case"volume":{const o=parseFloat(n);return!Number.isNaN(o)&&(e[t]=Math.min(1,Math.max(0,o)),!0)}case"style":if("object"==typeof n)return n.width&&(n.height=9*parseFloat(n.width)/16+"px"),e[t]=(0,a.A)(e[t],n),!0}}});var c=n(72591),i=n.n(c),r=n(88639),d=n.n(r),p=n(88128),h=n.n(p),m=n(30855),u=n.n(m),y=n(93051),g=n.n(y),v=n(51115),A={};A.setAttributes=u(),A.insert=h().bind(null,"head"),A.domAPI=d(),A.insertStyleElement=g();i()(v.A,A);const C=v.A&&v.A.locals?v.A.locals:void 0;n(15284);const k="video";const b=()=>({name:k,create:e=>{const{createElement:t,compose:n,helpers:a}=e,{arrayToString:l,mergeDiff:c}=a,i=document.createElement("div");i.classList.add(C.root);const r=document.createElement("div");r.classList.add(C.cover);const d=document.createElement("cdtr-media-player");return i.append(d,r),i.addEventListener("click",()=>{d.playing=!1}),t({name:k,id:n.id,template:i,defaultProps:{url:"https://www.youtube.com/watch?v=04Or_U9OexU",playing:!1,loop:!1,muted:!0,controls:!0,light:!1,playsinline:!1,volume:.8,style:{width:"400px",height:"225px"}},draggable:{group:"element"},droppable:{group:"element"},render:e=>{const t=n.props,o=(e,n)=>t[e]??t.style?.[e]??n;d.url=o("url"),c(d,{style:t.style}),d.width=t.style.width,d.height=t.style.height,d.playing=!!o("playing",!1),d.loop=!!o("loop",!1),d.controls=!1!==o("controls",!0),d.light=!!o("light",!1),d.playsinline=!!o("playsinline",!1);const a=o("volume",.8);d.volume="number"==typeof a?a:.8,d.muted=!0},atomElement:d,resizeable:()=>i,handleBar:!0,validator:s(),schema:n.schema,onSelect:e=>{d.classList.add(e)},onDeselect:e=>{d.classList.remove(e)},elementProps:n,remove:()=>{i.remove()},createEditor:o})}})},51115(e,t,n){n.d(t,{A:()=>c});var o=n(82001),a=n.n(o),l=n(40935),s=n.n(l)()(a());s.push([e.id,".BaT92HY5C7Gxgg9C1_pc {\n position: relative;\n max-width: 100%;\n}\n.aybkK2AXl8f2XctkkRjJ {\n width: 100%;\n height: 100%;\n left: 0;\n top: 0;\n position: absolute;\n opacity: 0.6;\n}\n\n.BaT92HY5C7Gxgg9C1_pc:hover .aybkK2AXl8f2XctkkRjJ {\n display: block;\n background-color: var(--primary);\n}\n","",{version:3,sources:["webpack://./../web-editors/video-editor-component/lib/style.module.css"],names:[],mappings:"AAAA;EACE,kBAAkB;EAClB,eAAe;AACjB;AACA;EACE,WAAW;EACX,YAAY;EACZ,OAAO;EACP,MAAM;EACN,kBAAkB;EAClB,YAAY;AACd;;AAEA;EACE,cAAc;EACd,gCAAgC;AAClC",sourcesContent:[".root {\n position: relative;\n max-width: 100%;\n}\n.cover {\n width: 100%;\n height: 100%;\n left: 0;\n top: 0;\n position: absolute;\n opacity: 0.6;\n}\n\n.root:hover .cover {\n display: block;\n background-color: var(--primary);\n}\n"],sourceRoot:""}]),s.locals={root:"BaT92HY5C7Gxgg9C1_pc",cover:"aybkK2AXl8f2XctkkRjJ"};const c=s}}]);
1
+ "use strict";(("undefined"!=typeof self?self:this).webpackChunkCreaditor=("undefined"!=typeof self?self:this).webpackChunkCreaditor||[]).push([[1142],{41142(e,t,n){n.d(t,{default:()=>b});const o=e=>{{const{component:t,commands:n,helpers:o}=e,i=t.parent("col"),l=e=>"style"===e.text,a=(e,n)=>t.props[e]??t.props.style?.[e]??n;return{select:e=>{let{changeTab:t,tab:n}=e;n.text||t("style")},tabs:e=>{const t=[{text:"style",selected:!0},{text:"animations"},{text:"settings"}];return e?(t.forEach(t=>t.selected=t.text===e),t):t},layout:e=>{let{tab:s,changeTab:r,tabs:c}=e;return[{type:"heading",level:6,text:"video",active:()=>l(s)},{type:"input",title:"add_urlAddress_from_media_site",active:()=>l(s),value:a("url",""),onChange:e=>{let t=e.target.value;if(-1!==t.indexOf("youtube.com/shorts/")){const e=t.split("/");e.length>0&&(t=`https://youtu.be/${e[e.length-1]}`)}n.execCommand("url",t)}},{type:"heading",level:6,text:"playback",active:()=>l(s)},{type:"checkbox",title:"autoplay",info:"autoplayMutedInfo",active:()=>l(s),checked:!!a("playing",!1),onChange:e=>{const t=e.target.checked;n.execCommand("playing",t),t&&!a("muted",!0)&&(n.execCommand("muted",!0),r("style"))}},{type:"checkbox",title:"playInLoop",active:()=>l(s),checked:!!a("loop",!1),onChange:e=>{n.execCommand("loop",e.target.checked)}},{type:"checkbox",title:"slientMode",active:()=>l(s),checked:!!a("muted",!0),onChange:e=>{n.execCommand("muted",e.target.checked)}},{type:"checkbox",title:"showControls",active:()=>l(s),checked:!1!==a("controls",!0),onChange:e=>{n.execCommand("controls",e.target.checked)}},{type:"checkbox",title:"showAsImage",active:()=>l(s),checked:!!a("light",!1),onChange:e=>{n.execCommand("light",e.target.checked)}},{type:"checkbox",title:"playInline",active:()=>l(s),checked:!!a("playsinline",!1),onChange:e=>{n.execCommand("playsinline",e.target.checked)}},{type:"slider",title:"volume",min:0,max:100,unit:"%",active:()=>l(s),value:Math.round(100*(a("volume",.8)??.8)),onInput:e=>{n.execCommand("volume",Number(e.target.value)/100)}},{type:"heading",level:6,text:"size",active:()=>l(s)},{type:"fontSize",title:"size",min:10,active:()=>l(s),max:i?.element?.offsetWidth,value:parseInt(t.props.style.width),device:e=>{if("phone"===e.target.device){const n=t.props?.breakpoints?.sm?.style?.width||t.props.style.width;e.target.value=parseInt(n)}else e.target.value=parseInt(t.props.style.width)},onInput:e=>{const t=e.target.value;"phone"===e.target.device?n.execCommand("breakpoints",e=>{const n=e.props.breakpoints?.sm||{};return{sm:o.deepMerge(n,{style:{width:t+"px",height:9*t/16+"px"}})}}):n.execCommand("style",{width:t+"px"})}}]}}}};var i=n(52144);const l=["playing","loop","muted","controls","light","playsinline"],a=()=>({set:(e,t,n)=>{if(l.includes(t))return e[t]=Boolean(n),!0;switch(t){case"url":return e[t]=n,!0;case"volume":{const o=parseFloat(n);return!Number.isNaN(o)&&(e[t]=Math.min(1,Math.max(0,o)),!0)}case"style":if("object"==typeof n)return n.width&&(n.height=9*parseFloat(n.width)/16+"px"),e[t]=(0,i.A)(e[t],n),!0}}});var s=n(72591),r=n.n(s),c=n(88639),d=n.n(c),A=n(88128),p=n.n(A),h=n(30855),m=n.n(h),g=n(93051),u=n.n(g),C=n(51115),y={};y.setAttributes=m(),y.insert=p().bind(null,"head"),y.domAPI=d(),y.insertStyleElement=u();r()(C.A,y);const v=C.A&&C.A.locals?C.A.locals:void 0;n(15284);var x=n(86319);const k="video";const b=()=>({name:k,create:e=>{const{createElement:t,compose:n,helpers:i}=e,{arrayToString:l,mergeDiff:s}=i,r=document.createElement("div");r.classList.add(v.root);const c=document.createElement("div");c.classList.add(v.cover);const d=document.createElement("cdtr-media-player"),A=document.createElement("div");A.classList.add(v.empty),A.innerHTML='<svg viewBox="0 0 24 24" aria-hidden="true"><circle cx="12" cy="12" r="10"/><path d="M10 8.5l5 3.5-5 3.5z"/></svg>';const p=document.createElement("strong"),h=document.createElement("span");return A.append(p,h),r.append(d,A,c),r.addEventListener("click",()=>{d.playing=!1}),t({name:k,id:n.id,template:r,defaultProps:{url:"https://www.youtube.com/watch?v=04Or_U9OexU",playing:!1,loop:!1,muted:!0,controls:!0,light:!1,playsinline:!1,volume:.8,style:{width:"400px",height:"225px"}},draggable:{group:"element"},droppable:{group:"element"},render:e=>{const t=n.props,o=(e,n)=>t[e]??t.style?.[e]??n,i=o("url");d.url=i;const l=!String(i??"").trim();r.classList.toggle(v.blank,l),l&&(p.textContent=x.M.get("lang","video_paste_link")||"Paste a video link",h.textContent=x.M.get("lang","video_link_sources")||"YouTube, Vimeo or an MP4 file",Object.assign(A.style,{width:t.style.width,height:t.style.height})),s(d,{style:t.style}),d.width=t.style.width,d.height=t.style.height,d.playing=!!o("playing",!1),d.loop=!!o("loop",!1),d.controls=!1!==o("controls",!0),d.light=!!o("light",!1),d.playsinline=!!o("playsinline",!1);const a=o("volume",.8);d.volume="number"==typeof a?a:.8,d.muted=!0},atomElement:d,resizeable:()=>r,handleBar:!0,validator:a(),schema:n.schema,onSelect:e=>{d.classList.add(e)},onDeselect:e=>{d.classList.remove(e)},elementProps:n,remove:()=>{r.remove()},createEditor:o})}})},51115(e,t,n){n.d(t,{A:()=>s});var o=n(82001),i=n.n(o),l=n(40935),a=n.n(l)()(i());a.push([e.id,".BaT92HY5C7Gxgg9C1_pc {\n position: relative;\n max-width: 100%;\n}\n.aybkK2AXl8f2XctkkRjJ {\n width: 100%;\n height: 100%;\n left: 0;\n top: 0;\n position: absolute;\n opacity: 0.6;\n}\n\n.BaT92HY5C7Gxgg9C1_pc:hover .aybkK2AXl8f2XctkkRjJ {\n display: block;\n background-color: var(--primary);\n}\n\n/* no link yet: a quiet placeholder the size of the video */\n.meCvGtDIqeqhKAtynZ3d {\n display: none;\n box-sizing: border-box;\n max-width: 100%;\n min-height: 160px;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n gap: 6px;\n border: 1px solid #dcdde3;\n border-radius: 8px;\n background: #eeeff2;\n color: #6b6880;\n font-size: 13px;\n text-align: center;\n}\n.meCvGtDIqeqhKAtynZ3d svg {\n width: 40px;\n height: 40px;\n margin-bottom: 4px;\n fill: none;\n stroke: currentColor;\n stroke-width: 1.5;\n stroke-linejoin: round;\n}\n.meCvGtDIqeqhKAtynZ3d svg path {\n fill: currentColor;\n stroke: none;\n}\n.meCvGtDIqeqhKAtynZ3d strong {\n font-size: 15px;\n font-weight: 500;\n color: #1f1d2b;\n}\n.cUFSqapO5YVXlS_kCjQ_ .meCvGtDIqeqhKAtynZ3d {\n display: flex;\n}\n.cUFSqapO5YVXlS_kCjQ_ cdtr-media-player {\n display: none !important;\n}\n","",{version:3,sources:["webpack://./../web-editors/video-editor-component/lib/style.module.css"],names:[],mappings:"AAAA;EACE,kBAAkB;EAClB,eAAe;AACjB;AACA;EACE,WAAW;EACX,YAAY;EACZ,OAAO;EACP,MAAM;EACN,kBAAkB;EAClB,YAAY;AACd;;AAEA;EACE,cAAc;EACd,gCAAgC;AAClC;;AAEA,2DAA2D;AAC3D;EACE,aAAa;EACb,sBAAsB;EACtB,eAAe;EACf,iBAAiB;EACjB,sBAAsB;EACtB,mBAAmB;EACnB,uBAAuB;EACvB,QAAQ;EACR,yBAAyB;EACzB,kBAAkB;EAClB,mBAAmB;EACnB,cAAc;EACd,eAAe;EACf,kBAAkB;AACpB;AACA;EACE,WAAW;EACX,YAAY;EACZ,kBAAkB;EAClB,UAAU;EACV,oBAAoB;EACpB,iBAAiB;EACjB,sBAAsB;AACxB;AACA;EACE,kBAAkB;EAClB,YAAY;AACd;AACA;EACE,eAAe;EACf,gBAAgB;EAChB,cAAc;AAChB;AACA;EACE,aAAa;AACf;AACA;EACE,wBAAwB;AAC1B",sourcesContent:[".root {\n position: relative;\n max-width: 100%;\n}\n.cover {\n width: 100%;\n height: 100%;\n left: 0;\n top: 0;\n position: absolute;\n opacity: 0.6;\n}\n\n.root:hover .cover {\n display: block;\n background-color: var(--primary);\n}\n\n/* no link yet: a quiet placeholder the size of the video */\n.empty {\n display: none;\n box-sizing: border-box;\n max-width: 100%;\n min-height: 160px;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n gap: 6px;\n border: 1px solid #dcdde3;\n border-radius: 8px;\n background: #eeeff2;\n color: #6b6880;\n font-size: 13px;\n text-align: center;\n}\n.empty svg {\n width: 40px;\n height: 40px;\n margin-bottom: 4px;\n fill: none;\n stroke: currentColor;\n stroke-width: 1.5;\n stroke-linejoin: round;\n}\n.empty svg path {\n fill: currentColor;\n stroke: none;\n}\n.empty strong {\n font-size: 15px;\n font-weight: 500;\n color: #1f1d2b;\n}\n.blank .empty {\n display: flex;\n}\n.blank cdtr-media-player {\n display: none !important;\n}\n"],sourceRoot:""}]),a.locals={root:"BaT92HY5C7Gxgg9C1_pc",cover:"aybkK2AXl8f2XctkkRjJ",empty:"meCvGtDIqeqhKAtynZ3d",blank:"cUFSqapO5YVXlS_kCjQ_"};const s=a}}]);
Binary file
@@ -0,0 +1,133 @@
1
+ "use strict";(("undefined"!=typeof self?self:this).webpackChunkCreaditor=("undefined"!=typeof self?self:this).webpackChunkCreaditor||[]).push([[1728],{1728(e,t,n){n.d(t,{default:()=>S});var s=n(59929),r=n(86959);const i=new Map;var o=n(86319);const a={he:{siteLabel:"כתובת האתר",load:"טעינת פוסטים",loading:"טוען…",search:"חיפוש פוסטים",noPosts:"לא נמצאו פוסטים באתר הזה. בדקו שהכתובת נכונה ושזה אתר וורדפרס.",noTitle:"(ללא כותרת)",empty:"הוסיפו כתובת של אתר וורדפרס בפאנל ובחרו פוסטים כדי להציג אותם כאן.",readMore:"לקריאה",readMoreLabel:"טקסט הקישור לפוסט",loadMore:"טעינת פוסטים נוספים",noMatch:"אין פוסטים שמתאימים לחיפוש.",layout:"פריסה",list:"רשימה",grid:"רשת",columns:"עמודות"},en:{siteLabel:"Website address",load:"Load posts",loading:"Loading…",search:"Search posts",noPosts:"No posts found on this site. Check the address and that it's a WordPress site.",noTitle:"(No title)",empty:"Add a WordPress site in the side panel and pick posts to show them here.",readMore:"Read more",readMoreLabel:"Link text",loadMore:"Load more posts",noMatch:"No posts match this search.",layout:"Layout",list:"List",grid:"Grid",columns:"Columns"}};function l(e){return a["en"===o.M.get("config","language")?"en":"he"][e]}const d=e=>e.link||String(e.wpId);class c extends s.WF{constructor(){super(),this.siteUrl="",this.items=[],this._posts=null,this._search=""}_emit(e,t){this.dispatchEvent(new CustomEvent(e,{detail:t,bubbles:!0,composed:!0}))}async _load(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const t=(this.siteUrl||"").trim();if(!t)return;const n=this._request=(this._request||0)+1;this._loading=!0,this._error="";try{const s=await async function(e){let{offset:t=0,search:n=""}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const s=new URLSearchParams({site:e.trim(),offset:String(t),search:n}),o=s.toString().toLowerCase();if(i.has(o))return i.get(o);const a=await fetch(`${r.XW.endPoint}/v1/wordpress/posts?${s}`);if(!a.ok)throw new Error(`Request failed (${a.status})`);const l=await a.json();return i.set(o,l),l}(t,{offset:e?this._posts.length:0,search:this._search.trim()});if(n!==this._request)return;this._posts=e?[...this._posts,...s.posts]:s.posts,this._hasMore=s.hasMore,this._posts.length||(this._error=this._search.trim()?l("noMatch"):l("noPosts"))}catch{if(n!==this._request)return;e||(this._posts=null),this._error=l("noPosts")}this._loading=!1}_onSearch(e){this._search=e.target.value,clearTimeout(this._searchTimer),this._searchTimer=setTimeout(()=>this._load(),400)}_toggle(e){const t=d(e),n=this.items.some(e=>d(e)===t);this.items=n?this.items.filter(e=>d(e)!==t):[...this.items,e],this._emit("items-change",this.items)}render(){const e=new Set(this.items.map(d));return s.qy`
2
+ <label class="field" for="site">${l("siteLabel")}</label>
3
+ <input
4
+ id="site"
5
+ type="text"
6
+ dir="ltr"
7
+ placeholder="myblog.com"
8
+ .value=${this.siteUrl}
9
+ @change=${e=>this._emit("site-change",e.target.value.trim())}
10
+ @input=${e=>this.siteUrl=e.target.value}
11
+ @keydown=${e=>"Enter"===e.key&&this._load()}
12
+ />
13
+ <button type="button" ?disabled=${this._loading||!this.siteUrl.trim()} @click=${()=>this._load()}>
14
+ ${this._loading&&!this._posts?l("loading"):l("load")}
15
+ </button>
16
+ ${this._posts?s.qy`<input
17
+ class="search"
18
+ type="search"
19
+ aria-label=${l("search")}
20
+ placeholder=${l("search")}
21
+ .value=${this._search}
22
+ @input=${this._onSearch}
23
+ />`:null}
24
+ ${this._error?s.qy`<div class="msg">${this._error}</div>`:null}
25
+ ${this._posts?.length?s.qy`
26
+ <div class="list">
27
+ ${this._posts.map(t=>s.qy`<label class="row">
28
+ <input
29
+ type="checkbox"
30
+ .checked=${e.has(d(t))}
31
+ @change=${()=>this._toggle(t)}
32
+ />
33
+ ${t.imageSrc?s.qy`<img class="thumb" src=${t.imageSrc} alt="" loading="lazy" />`:s.qy`<span class="thumb"></span>`}
34
+ <span class="title">${t.title||l("noTitle")}</span>
35
+ </label>`)}
36
+ </div>
37
+ ${this._hasMore?s.qy`<button class="more" type="button" ?disabled=${this._loading} @click=${()=>this._load(!0)}>
38
+ ${this._loading?l("loading"):l("loadMore")}
39
+ </button>`:null}
40
+ `:null}
41
+ `}}c.properties={siteUrl:{type:String},items:{type:Array},_posts:{state:!0},_hasMore:{state:!0},_error:{state:!0},_loading:{state:!0}},c.styles=s.AH`
42
+ :host {
43
+ display: block;
44
+ font-size: 13px;
45
+ line-height: 1.4;
46
+ color: #1a1a1a;
47
+ }
48
+ label.field {
49
+ display: block;
50
+ margin-bottom: 4px;
51
+ font-size: 12px;
52
+ font-weight: 600;
53
+ }
54
+ input[type="text"],
55
+ input[type="search"] {
56
+ width: 100%;
57
+ box-sizing: border-box;
58
+ height: 36px;
59
+ padding: 0 10px;
60
+ border: 1px solid #a7adbb;
61
+ border-radius: 8px;
62
+ font: inherit;
63
+ }
64
+ button {
65
+ width: 100%;
66
+ height: 36px;
67
+ margin-top: 10px;
68
+ border: none;
69
+ border-radius: 8px;
70
+ background: #1d1b26;
71
+ color: #fff;
72
+ font: inherit;
73
+ font-weight: 600;
74
+ cursor: pointer;
75
+ }
76
+ button.more {
77
+ background: none;
78
+ border: 1px solid #c9c5d6;
79
+ color: #1d1b26;
80
+ }
81
+ button:disabled {
82
+ opacity: 0.55;
83
+ cursor: default;
84
+ }
85
+ .search {
86
+ margin: 12px 0 8px;
87
+ }
88
+ .list {
89
+ max-height: 320px;
90
+ overflow: auto;
91
+ border: 1px solid #e3e1ea;
92
+ border-radius: 8px;
93
+ }
94
+ .row {
95
+ display: flex;
96
+ align-items: center;
97
+ gap: 10px;
98
+ padding: 8px 10px;
99
+ border-bottom: 1px solid #eeedf2;
100
+ cursor: pointer;
101
+ }
102
+ .row:last-child {
103
+ border-bottom: none;
104
+ }
105
+ .thumb {
106
+ width: 44px;
107
+ height: 44px;
108
+ flex-shrink: 0;
109
+ border-radius: 6px;
110
+ object-fit: cover;
111
+ background: #eee;
112
+ }
113
+ .title {
114
+ flex: 1;
115
+ min-width: 0;
116
+ display: -webkit-box;
117
+ -webkit-line-clamp: 2;
118
+ -webkit-box-orient: vertical;
119
+ overflow: hidden;
120
+ }
121
+ .msg {
122
+ margin-top: 10px;
123
+ color: #b42318;
124
+ font-size: 12px;
125
+ }
126
+ `,customElements.get("cdtr-wp-posts-picker")||customElements.define("cdtr-wp-posts-picker",c);const p=e=>{let{component:t,commands:n}=e;const r=()=>t.props.layout||"list",i=()=>[{value:"list",label:l("list")},{value:"grid",label:l("grid")}],o=()=>String(t.props.columns||3);return{select:e=>{let{changeTab:t,tab:n}=e;"wordpress"!==n?.text&&t("wordpress")},tabs:e=>[{text:"wordpress"}].map(t=>({...t,selected:t.text===e})),layout:()=>[{type:"custom",node:()=>s.qy`<cdtr-editor-container
127
+ ><cdtr-wp-posts-picker
128
+ .siteUrl=${t.props.siteUrl||""}
129
+ .items=${t.props.items||[]}
130
+ @site-change=${e=>n.execCommand("siteUrl",e.detail)}
131
+ @items-change=${e=>n.execCommand("items",e.detail)}
132
+ ></cdtr-wp-posts-picker
133
+ ></cdtr-editor-container>`},{type:"input",title:l("readMoreLabel"),value:t.props.readMore??l("readMore"),onInput:e=>{let{target:t}=e;return n.execCommand("readMore",t.value)}},{type:"dropdown",title:l("layout"),value:i().find(e=>e.value===r()).label,selected:r(),items:i(),onChange:e=>{let{target:t}=e;return n.execCommand("layout",t.value)}},{type:"dropdown",title:l("columns"),active:()=>"grid"===r(),value:o(),selected:o(),items:[{value:"2"},{value:"3"}],onChange:e=>{let{target:t}=e;return n.execCommand("columns",Number(t.value))}},{type:"slider",title:"spacing",unit:"px",value:parseFloat(t.props.style?.gap)||16,min:0,max:48,onInput:e=>n.execCommand("style",{gap:e.target.value+"px"})}]}};function A(e){let{helpers:t}=e;return{set:(e,n,s)=>{switch(n){case"style":return e[n]=t.deepMerge(e[n]||{},s),!0;case"siteUrl":case"readMore":case"layout":case"columns":return e[n]=s,!0;case"items":return!!Array.isArray(s)&&(e[n]=s,!0);default:return!1}}}}var h=n(72591),m=n.n(h),g=n(88639),u=n.n(g),x=n(88128),b=n.n(x),f=n(30855),E=n.n(f),C=n(93051),y=n.n(C),w=n(17745),B={};B.setAttributes=E(),B.insert=b().bind(null,"head"),B.domAPI=u(),B.insertStyleElement=y();m()(w.A,B);const _=w.A&&w.A.locals?w.A.locals:void 0,v="wordpress-posts",k=e=>/^https?:\/\//i.test(e||"");const S=()=>({name:v,create:e=>{let{createElement:t,compose:n,helpers:s}=e;const r=document.createElement("div"),i=document.createElement("div");i.className=_.root,r.appendChild(i);return t({name:v,id:n.id,template:r,handleBar:!0,draggable:{group:"element"},droppable:{group:"element"},defaultProps:{},validator:A({helpers:s}),schema:n.schema,render:()=>{const{items:e=[],style:t={},readMore:s,layout:r,columns:o}=n.props;if(i.style.gap=t.gap||"16px",i.classList.toggle(_.grid,"grid"===r),i.style.setProperty("--wp-columns",o||3),!e.length){const e=document.createElement("div");return e.className=_.empty,e.textContent=l("empty"),void i.replaceChildren(e)}i.replaceChildren(...e.map(e=>function(e,t){const n=document.createElement("article");if(n.className=_.card,k(e.imageSrc)){const t=document.createElement("img");t.className=_.cardImage,t.src=e.imageSrc,t.alt="",t.loading="lazy",n.appendChild(t)}const s=document.createElement("div");s.className=_.cardBody;const r=document.createElement("h3");if(r.className=_.cardTitle,r.textContent=e.title||"",s.appendChild(r),e.excerpt){const t=document.createElement("p");t.className=_.cardExcerpt,t.textContent=e.excerpt,s.appendChild(t)}if(k(e.link)){const n=document.createElement("a");n.className=_.cardLink,n.href=e.link,n.target="_blank",n.rel="noopener noreferrer",n.textContent=t,s.appendChild(n)}return n.appendChild(s),n}(e,s||l("readMore"))))},onSelect:e=>r.classList.add(e),onDeselect:e=>r.classList.remove(e),elementProps:n,remove:()=>r.remove(),createEditor:p})}})},17745(e,t,n){n.d(t,{A:()=>a});var s=n(82001),r=n.n(s),i=n(40935),o=n.n(i)()(r());o.push([e.id,".QMM0Ne0SSshuEoPSpnxG {\n display: flex;\n flex-direction: column;\n width: 100%;\n box-sizing: border-box;\n}\n\n.RRwLCuhZ68SyVSMlO3N4 {\n display: grid;\n grid-template-columns: repeat(3, minmax(0, 1fr));\n grid-template-columns: repeat(var(--wp-columns, 3), minmax(0, 1fr));\n}\n\n.RRwLCuhZ68SyVSMlO3N4 .tZf8qOpD_KSZFAh_YwKG {\n flex-direction: column;\n}\n\n.RRwLCuhZ68SyVSMlO3N4 .CsD9adYwQVlhzkifY6xg {\n width: 100%;\n min-width: 0;\n height: 160px;\n}\n\n@media (max-width: 767px) {\n .RRwLCuhZ68SyVSMlO3N4 {\n grid-template-columns: 1fr;\n }\n}\n\n.sZGGqRAlOWV6JBJoj_jZ {\n padding: 16px;\n font-size: 13px;\n line-height: 1.5;\n color: rgba(0, 0, 0, 0.55);\n border: 1px dashed rgba(0, 0, 0, 0.15);\n border-radius: 8px;\n text-align: center;\n}\n\n.tZf8qOpD_KSZFAh_YwKG {\n display: flex;\n gap: 12px;\n padding: 12px;\n border-radius: 8px;\n background: #fff;\n box-shadow: rgba(0, 0, 0, 0.06) 0 1px 3px, rgba(0, 0, 0, 0.08) 0 0 0 1px;\n box-sizing: border-box;\n}\n\n.CsD9adYwQVlhzkifY6xg {\n width: 96px;\n min-width: 96px;\n height: 72px;\n -o-object-fit: cover;\n object-fit: cover;\n border-radius: 6px;\n background: #eee;\n}\n\n.iLhTgf0FxVs9Z1AeQ6_3 {\n flex: 1;\n min-width: 0;\n display: flex;\n flex-direction: column;\n gap: 6px;\n}\n\n.dyVYKRqoQJ7RazcFf51n {\n margin: 0;\n font-size: 15px;\n font-weight: 600;\n line-height: 1.3;\n}\n\n.jtXLUEN_humrzK8BYCJA {\n margin: 0;\n font-size: 13px;\n line-height: 1.45;\n color: rgba(0, 0, 0, 0.65);\n}\n\n.HiXS6dcHAvAeJwaGFM8O {\n align-self: flex-start;\n font-size: 13px;\n font-weight: 600;\n color: inherit;\n text-decoration: underline;\n}\n","",{version:3,sources:["webpack://./../web-editors/wordpress-posts-editor-component/lib/style.module.css"],names:[],mappings:"AAAA;EACE,aAAa;EACb,sBAAsB;EACtB,WAAW;EACX,sBAAsB;AACxB;;AAEA;EACE,aAAa;EACb,gDAAmE;EAAnE,mEAAmE;AACrE;;AAEA;EACE,sBAAsB;AACxB;;AAEA;EACE,WAAW;EACX,YAAY;EACZ,aAAa;AACf;;AAEA;EACE;IACE,0BAA0B;EAC5B;AACF;;AAEA;EACE,aAAa;EACb,eAAe;EACf,gBAAgB;EAChB,0BAA0B;EAC1B,sCAAsC;EACtC,kBAAkB;EAClB,kBAAkB;AACpB;;AAEA;EACE,aAAa;EACb,SAAS;EACT,aAAa;EACb,kBAAkB;EAClB,gBAAgB;EAChB,wEAAwE;EACxE,sBAAsB;AACxB;;AAEA;EACE,WAAW;EACX,eAAe;EACf,YAAY;EACZ,oBAAiB;KAAjB,iBAAiB;EACjB,kBAAkB;EAClB,gBAAgB;AAClB;;AAEA;EACE,OAAO;EACP,YAAY;EACZ,aAAa;EACb,sBAAsB;EACtB,QAAQ;AACV;;AAEA;EACE,SAAS;EACT,eAAe;EACf,gBAAgB;EAChB,gBAAgB;AAClB;;AAEA;EACE,SAAS;EACT,eAAe;EACf,iBAAiB;EACjB,0BAA0B;AAC5B;;AAEA;EACE,sBAAsB;EACtB,eAAe;EACf,gBAAgB;EAChB,cAAc;EACd,0BAA0B;AAC5B",sourcesContent:[".root {\n display: flex;\n flex-direction: column;\n width: 100%;\n box-sizing: border-box;\n}\n\n.grid {\n display: grid;\n grid-template-columns: repeat(var(--wp-columns, 3), minmax(0, 1fr));\n}\n\n.grid .card {\n flex-direction: column;\n}\n\n.grid .cardImage {\n width: 100%;\n min-width: 0;\n height: 160px;\n}\n\n@media (max-width: 767px) {\n .grid {\n grid-template-columns: 1fr;\n }\n}\n\n.empty {\n padding: 16px;\n font-size: 13px;\n line-height: 1.5;\n color: rgba(0, 0, 0, 0.55);\n border: 1px dashed rgba(0, 0, 0, 0.15);\n border-radius: 8px;\n text-align: center;\n}\n\n.card {\n display: flex;\n gap: 12px;\n padding: 12px;\n border-radius: 8px;\n background: #fff;\n box-shadow: rgba(0, 0, 0, 0.06) 0 1px 3px, rgba(0, 0, 0, 0.08) 0 0 0 1px;\n box-sizing: border-box;\n}\n\n.cardImage {\n width: 96px;\n min-width: 96px;\n height: 72px;\n object-fit: cover;\n border-radius: 6px;\n background: #eee;\n}\n\n.cardBody {\n flex: 1;\n min-width: 0;\n display: flex;\n flex-direction: column;\n gap: 6px;\n}\n\n.cardTitle {\n margin: 0;\n font-size: 15px;\n font-weight: 600;\n line-height: 1.3;\n}\n\n.cardExcerpt {\n margin: 0;\n font-size: 13px;\n line-height: 1.45;\n color: rgba(0, 0, 0, 0.65);\n}\n\n.cardLink {\n align-self: flex-start;\n font-size: 13px;\n font-weight: 600;\n color: inherit;\n text-decoration: underline;\n}\n"],sourceRoot:""}]),o.locals={root:"QMM0Ne0SSshuEoPSpnxG",grid:"RRwLCuhZ68SyVSMlO3N4",card:"tZf8qOpD_KSZFAh_YwKG",cardImage:"CsD9adYwQVlhzkifY6xg",empty:"sZGGqRAlOWV6JBJoj_jZ",cardBody:"iLhTgf0FxVs9Z1AeQ6_3",cardTitle:"dyVYKRqoQJ7RazcFf51n",cardExcerpt:"jtXLUEN_humrzK8BYCJA",cardLink:"HiXS6dcHAvAeJwaGFM8O"};const a=o}}]);
Binary file
@@ -789,6 +789,22 @@
789
789
  overflow: hidden;
790
790
  }
791
791
 
792
+ /* In the light main toolbar rather than the dark bar. */
793
+ :host([compact]) {
794
+ margin-inline: 8px 10px;
795
+ }
796
+ :host([compact]) .next-button {
797
+ height: 34px;
798
+ width: auto;
799
+ /* Keeps its width while the spinner replaces the label. */
800
+ min-width: 90px;
801
+ padding: 0 18px;
802
+ margin: 0;
803
+ border-radius: 8px;
804
+ transform: none;
805
+ font-weight: 600;
806
+ }
807
+
792
808
  .next-button:disabled {
793
809
  opacity: 0.6;
794
810
  cursor: not-allowed;
Binary file
@@ -1,14 +1,5 @@
1
- "use strict";(("undefined"!=typeof self?self:this).webpackChunkCreaditor=("undefined"!=typeof self?self:this).webpackChunkCreaditor||[]).push([[3521],{83521(t,e,i){i.r(e),i.d(e,{DesignFactory:()=>l});var o=i(5441),n=i(59929),r=i(54804),s=i(18057),d=i(86319);i.e(8315).then(i.bind(i,68315));class l extends n.WF{constructor(){super(),this.lastEditor=null,this._selectedComponentId=null,this._injectedForId=null,d.M.set({injectEditor:t=>{this.injected=!0,this._injectedForId=this._selectedComponentId,this.lastEditor=this.editor,this.backToEditor=this.editor,this.editor=t}}),this.editor=n.qy`<cdtr-ilustration-preference
1
+ "use strict";(("undefined"!=typeof self?self:this).webpackChunkCreaditor=("undefined"!=typeof self?self:this).webpackChunkCreaditor||[]).push([[3521],{83521(t,e,i){i.r(e),i.d(e,{DesignFactory:()=>l});var o=i(5441),s=i(59929),n=i(54804),r=i(18057),d=i(86319),c=i(57327);i.e(8315).then(i.bind(i,68315));class l extends s.WF{constructor(){super(),this.lastEditor=null,this._selectedComponentId=null,this._injectedForId=null,d.M.set({injectEditor:t=>{this.injected=!0,this._injectedForId=this._selectedComponentId,this.lastEditor=this.editor,this.backToEditor=this.editor,this.editor=t}}),this.editor=s.qy`<cdtr-ilustration-preference
2
2
  width="200px"
3
3
  height="200px"
4
- ></cdtr-ilustration-preference>`,this.delayer=new s.A,this.connect=this.connect.bind(this),this.editors={block:{selector:"block-editor",load:()=>i.e(8299).then(i.bind(i,68299)),component:null},no_editor:{selector:"cdtr-no-component",load:()=>i.e(8854).then(i.bind(i,68854)),component:null,attrs:{style:"margin:auto;display:block;max-width:150px;margin-top:30px;"}}},this.type=null,r.Ay.on("select",this.connect)}connect(t){let{editor:e,component:i}=t;if(!e)return;let n=e.type;if("string"!=typeof n)return;const r=i?.id??null;if(this.injected){if(null==r||r===this._injectedForId)return;this.injected=!1,this._injectedForId=null}if(this._selectedComponentId=r,this.editor?.type===n)return;if(!this.editors[n]){const t=d.M.get("config","editor","configure","plugins");if(Array.isArray(t)){const e=t.find(t=>t.name===n);if(e&&"function"==typeof e.createEditor){this.editor=document.createElement("cdtr-editor-builder"),this.editor.type=n;const t=e.createEditor();return void(t&&(this.editor.editors=t.layout,t!==this.backToEditor&&this.lastEditor&&(this.lastEditor=null)))}}n="no_editor"}this.type=n;const s=(0,o.A)("div",null,(0,o.A)("cdtr-block-loader",null),(0,o.A)("cdtr-title",{style:"text-align:center;"},(0,o.A)("lang-text",{text:"please_wait_downloading_new_version"})));this.editors[n]&&!this.editors[n].component&&(this.editors[n].load().then(()=>{if(s.remove(),this.editors[n].attrs)for(const t in this.editors[n].attrs)if(Object.hasOwnProperty.call(this.editors[n].attrs,t)){const e=this.editors[n].attrs[t];this.editors[n].component[t]=e}}),this.editors[n].component=document.createElement(this.editors[n].selector),this.editors[n].component.appendChild(s)),this.editors[n].component&&(this.editor=this.editors[n].component)}goBack(){this.lastEditor&&(this.editor=this.lastEditor,this.lastEditor=null,this.injected=!1,this._injectedForId=null)}createRenderRoot(){return this}render(){const t="rtl"===getComputedStyle(document.documentElement).getPropertyValue("--direction-locale").trim();return n.qy` ${this.lastEditor?n.qy`<div style="display:flex;justify-content:flex-start;padding:12px 16px 4px;direction:var(--direction-locale);">
5
- <span
6
- @click=${this.goBack}
7
- style="display:inline-flex;align-items:center;gap:3px;font-size:12px;color:#555;cursor:pointer;font-family:inherit;"
8
- @mouseover=${t=>{t.currentTarget.style.color="#333",t.currentTarget.style.textDecoration="underline"}}
9
- @mouseout=${t=>{t.currentTarget.style.color="#555",t.currentTarget.style.textDecoration="none"}}
10
- ><svg width="12" height="12" viewBox="0 0 24 24" style=${t?"transform:scaleX(-1)":""} fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="15 18 9 12 15 6"></polyline></svg
11
- ><lang-text text="go_back"></lang-text
12
- ></span>
13
- </div>`:""}
4
+ ></cdtr-ilustration-preference>`,this.delayer=new r.A,this.connect=this.connect.bind(this),this.editors={block:{selector:"block-editor",load:()=>i.e(8299).then(i.bind(i,68299)),component:null},no_editor:{selector:"cdtr-no-component",load:()=>i.e(8854).then(i.bind(i,68854)),component:null,attrs:{style:"margin:auto;display:block;max-width:150px;margin-top:30px;"}}},this.type=null,n.Ay.on("select",this.connect)}connect(t){let{editor:e,component:i}=t;if(!e)return;let s=e.type;if("string"!=typeof s)return;const n=i?.id??null;if(this.injected){if(null==n||n===this._injectedForId)return;this.injected=!1,this._injectedForId=null}if(this._selectedComponentId=n,this.editor?.type===s)return;if(!this.editors[s]){const t=d.M.get("config","editor","configure","plugins");if(Array.isArray(t)){const e=t.find(t=>t.name===s);if(e&&"function"==typeof e.createEditor){this.editor=document.createElement("cdtr-editor-builder"),this.editor.type=s;const t=e.createEditor();return void(t&&(this.editor.editors=t.layout,t!==this.backToEditor&&this.lastEditor&&(this.lastEditor=null)))}}s="no_editor"}this.type=s;const r=(0,o.A)("div",null,(0,o.A)("cdtr-block-loader",null),(0,o.A)("cdtr-title",{style:"text-align:center;"},(0,o.A)("lang-text",{text:"please_wait_downloading_new_version"})));this.editors[s]&&!this.editors[s].component&&(this.editors[s].load().then(()=>{if(r.remove(),this.editors[s].attrs)for(const t in this.editors[s].attrs)if(Object.hasOwnProperty.call(this.editors[s].attrs,t)){const e=this.editors[s].attrs[t];this.editors[s].component[t]=e}}),this.editors[s].component=document.createElement(this.editors[s].selector),this.editors[s].component.appendChild(r)),this.editors[s].component&&(this.editor=this.editors[s].component)}goBack(){this.lastEditor&&(this.editor=this.lastEditor,this.lastEditor=null,this.injected=!1,this._injectedForId=null)}createRenderRoot(){return this}render(){return s.qy` ${this.lastEditor?(0,c.T)(this.goBack):""}
14
5
  ${this.editor}`}}l.properties={type:{type:String},editor:{type:Object},injected:{type:Boolean}},customElements.define("design-factory",l)}}]);
Binary file
@@ -0,0 +1 @@
1
+ "use strict";(("undefined"!=typeof self?self:this).webpackChunkCreaditor=("undefined"!=typeof self?self:this).webpackChunkCreaditor||[]).push([[3600],{93600(t,e,n){var o=n(87348),i=n(47493),s=n(92384);const r=["animations","settings"],a=["presets","open_modal","icons"];function l(t){const e=String(t.weightValue||400);return{type:"dropdown",active:t.active,title:"fontWeight",value:e,selected:e,items:s.FONT_WEIGHTS.map(t=>({value:String(t.value)})),onChange:e=>t.onWeightChange({detail:{value:parseInt(e.target.value,10)}})}}function u(t){return e=>{const n=(0,i.A)(e);return{select:n.select,tabs:e=>n.tabs(e).filter(e=>!(r.includes(e.text)||"submit"===t&&"interactions"===e.text)),layout:e=>function(t,e){const n=[];let o=null;for(const i of t)i&&"heading"===i.type&&(o=i.text),a.includes(o)||(i&&"fontFamily"===i.type?n.push(l(i)):"submit"===e&&"text"===o&&i&&"custom"===i.type||n.push(i));return n}(n.layout(e),t)}}}const p=["300","400","500","600","700","800","900"],c=["left","center","right"];function d(t){let{component:e,commands:n}=t;const o=()=>e.props.style,i=t=>n.execCommand("style",t);return{select:()=>{},tabs:()=>[{text:"style",selected:!0}],layout:()=>[{type:"colorpicker",title:"font_color",value:o().color,onChange:t=>i({color:t.target.value})},{type:"slider",title:"fontSize",min:8,max:120,step:1,value:parseInt(o().fontSize)||16,onInput:t=>i({fontSize:t.target.value+"px"})},{type:"dropdown",title:"fontWeight",value:String(o().fontWeight||""),selected:String(o().fontWeight||""),items:p.map(t=>({value:t})),onChange:t=>i({fontWeight:t.target.value})},{type:"dropdown",title:"alignment",value:o().textAlign,selected:o().textAlign,items:c.map(t=>({value:t})),onChange:t=>i({textAlign:t.target.value})}]}}class h extends o.EditorBuilder{connectWith(){const{commands:t,helpers:e}=this.commandsBuilder();var n;this.type=this.target.type,this.component=this.target,this.props=this.target.props,this.editor=("text"===(n=this.target.kind)?d:u(n))({component:this.target,props:this.target.props,commands:t,helpers:e})}execCommandWrapper(t,e){this.target.execCommand(t,e)}shouldShowDesignControls(){return!1}getColElementData(){return null}updated(t){super.updated(t),t.has("target")&&this.connectWith()}}h.properties={...o.EditorBuilder.properties,target:{attribute:!1}},customElements.define("cdtr-ai-editor-builder",h)}}]);
Binary file
@@ -665,7 +665,7 @@
665
665
  .value="${b}"
666
666
  ></cdtr-input>
667
667
  </cdtr-row>
668
- `}function L(t,e,i,s,o,n){if(!t)return null;const a="string"==typeof t?new r.A({href:t,protocol:e,params:i}):new r.A(t);return t?"whatsapp:"===e||"whatsapp:"===a.protocol?function(t,e,i,s,o){const n="string"==typeof t?new r.A({href:t,protocol:e,params:i}):new r.A(t);let a=n.params&&(n.params.phone||function(t){try{const e=/whatsapp:([^?]+)/,i=t.match(e);return i?i[1]:""}catch(t){return""}}(n.fullHref))||g("phone",n.href||"")||n.url||"";try{a=decodeURIComponent(a)}catch(t){}const l=a.replace(/\D+/g,"");if(!l)return null;const c=s||n.params&&(n.params.text||n.params.body)||"",h=c?encodeURIComponent(c):"";let d=`https://wa.me/${l}`;h&&(d+=`?text=${h}`);const p=new r.A(d);return p.target=o||p.target||"_blank",{url:p,params:p.params,protocol:"whatsapp:"}}(t,e,i,s,n):(a.isEmail?function(t,e,i){let s=!1;e?t.addParam("subject",e):t.params&&"subject"in t.params&&(delete t.params.subject,s=!0),i?t.addParam("body",i):t.params&&"body"in t.params&&(delete t.params.body,s=!0),s&&(t.href=t.getUrlWithParams())}(a,o,s):s?a.addParam("body",s):a.params&&"body"in a.params&&(delete a.params.body,a.href=a.getUrlWithParams()),a.target=n||a.target||"_blank",{url:a,params:a.params,protocol:a.protocol}):null}function R(t,e,i){if(!t)return{href:{},protocol:null,body:"",subject:""};if(t.startsWith("http")&&!t.startsWith("http://")&&!t.startsWith("https://"))return null;const s=r.A.getProtocol(t);let o=e;s&&(o=s+":");const n=new r.A({href:t,protocol:o||null});console.log("output",n);const a=(i instanceof r.A?i:new r.A(i)).url!==n.url;return{href:n,protocol:n.protocol,shouldBlur:n.isValid,clearParams:a}}function C(){const t=o.M.get("components"),e=Array.isArray(t)?t:t&&"object"==typeof t?Object.values(t):[],i=function(t){const e=new Map;t.forEach(t=>{const i=t&&(t.id||t._id);i&&e.set(i,t)});const i=t.find(t=>t&&"root"===t.type),s=i&&(i.id||i._id);if(!s)return null;const o=new Set,r=t=>{if(!t||o.has(t))return;o.add(t);const i=e.get(t);i&&[].concat(Array.isArray(i.children)?i.children:[]).concat(Array.isArray(i.elements)?i.elements:[]).forEach(t=>r((t=>t?"string"==typeof t?t:t.id||t.dataset&&t.dataset.id||null:null)(t)))};return r(s),o}(e),s=i?e.filter(t=>t&&i.has(t.id||t._id)):e,r=new Set,n=[],a=(t,e,i)=>{e&&!r.has(e)&&(r.add(e),n.push({id:t,name:e,label:i||e}))};return s.forEach(t=>{const e=t&&t.props;e&&(e.anchor&&e.anchor.name?a(t.id,e.anchor.name,e.anchor.label):"anchor"===t.type&&e.name?a(t.id,e.name):e.element_ID&&a(t.id,e.element_ID))}),n}const M="automation:";function U(t,e,i){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[];return s.qy`
668
+ `}function L(t,e,i,s,o,n){if(!t)return null;const a="string"==typeof t?new r.A({href:t,protocol:e,params:i}):new r.A(t);return t?"whatsapp:"===e||"whatsapp:"===a.protocol?function(t,e,i,s,o){const n="string"==typeof t?new r.A({href:t,protocol:e,params:i}):new r.A(t);let a=n.params&&(n.params.phone||function(t){try{const e=/whatsapp:([^?]+)/,i=t.match(e);return i?i[1]:""}catch(t){return""}}(n.fullHref))||g("phone",n.href||"")||n.url||"";try{a=decodeURIComponent(a)}catch(t){}const l=a.replace(/\D+/g,"");if(!l)return null;const c=s||n.params&&(n.params.text||n.params.body)||"",h=c?encodeURIComponent(c):"";let d=`https://wa.me/${l}`;h&&(d+=`?text=${h}`);const p=new r.A(d);return p.target=o||p.target||"_blank",{url:p,params:p.params,protocol:"whatsapp:"}}(t,e,i,s,n):(a.isEmail?function(t,e,i){let s=!1;e?t.addParam("subject",e):t.params&&"subject"in t.params&&(delete t.params.subject,s=!0),i?t.addParam("body",i):t.params&&"body"in t.params&&(delete t.params.body,s=!0),s&&(t.href=t.getUrlWithParams())}(a,o,s):s?a.addParam("body",s):a.params&&"body"in a.params&&(delete a.params.body,a.href=a.getUrlWithParams()),a.target=n||a.target||"_blank",{url:a,params:a.params,protocol:a.protocol}):null}function R(t,e,i){if(!t)return{href:{},protocol:null,body:"",subject:""};if(t.startsWith("http")&&!t.startsWith("http://")&&!t.startsWith("https://"))return null;const s=r.A.getProtocol(t);let o=e;s&&(o=s+":");const n=new r.A({href:t,protocol:o||null});console.log("output",n);const a=(i instanceof r.A?i:new r.A(i)).url!==n.url;return{href:n,protocol:n.protocol,shouldBlur:n.isValid,clearParams:a}}function U(){const t=o.M.get("components"),e=Array.isArray(t)?t:t&&"object"==typeof t?Object.values(t):[],i=function(t){const e=new Map;t.forEach(t=>{const i=t&&(t.id||t._id);i&&e.set(i,t)});const i=t.find(t=>t&&"root"===t.type),s=i&&(i.id||i._id);if(!s)return null;const o=new Set,r=t=>{if(!t||o.has(t))return;o.add(t);const i=e.get(t);i&&[].concat(Array.isArray(i.children)?i.children:[]).concat(Array.isArray(i.elements)?i.elements:[]).forEach(t=>r((t=>t?"string"==typeof t?t:t.id||t.dataset&&t.dataset.id||null:null)(t)))};return r(s),o}(e),s=i?e.filter(t=>t&&i.has(t.id||t._id)):e,r=new Set,n=[],a=(t,e,i)=>{e&&!r.has(e)&&(r.add(e),n.push({id:t,name:e,label:i||e}))};return s.forEach(t=>{const e=t&&t.props;e&&(e.anchor&&e.anchor.name?a(t.id,e.anchor.name,e.anchor.label):"anchor"===t.type&&e.name?a(t.id,e.name):e.element_ID&&a(t.id,e.element_ID))}),n}const C="automation:";function M(t,e,i){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[];return s.qy`
669
669
  <cdtr-dropdown @change=${t=>i(t.target.value)}>
670
670
  <cdtr-dropdown-button
671
671
  minWidth=${100}
@@ -682,7 +682,7 @@
682
682
  value="${t.type}"
683
683
  ><lang-text text="${t.text}"></lang-text>
684
684
  </cdtr-dropdown-item>`)}
685
- ${o.length?s.qy`<cdtr-dropdown-item value="${M}" class="special-links-item">
685
+ ${o.length?s.qy`<cdtr-dropdown-item value="${C}" class="special-links-item">
686
686
  <span class="special-links-label">
687
687
  <span class="special-links-title">
688
688
  <svg viewBox="0 0 24 24" aria-hidden="true">
@@ -1078,9 +1078,9 @@
1078
1078
  </cdtr-row>
1079
1079
  </div>
1080
1080
  </div>
1081
- `}}}(s.WF)){constructor(){super(),this.inputRef=(0,a._)(),this.onBlur=this.onBlur.bind(this),this.onKeyDown=this.onKeyDown.bind(this),this.urlInputFocused=!1,this._urlInputRawValue="",this._lastSyncedMyHref=void 0,this._lastBodySyncHref=void 0,this.lastUrl=void 0,this.target="_blank",this.anchors=[],this.event=new UIEvent("change",{view:window,bubbles:!0,cancelable:!0}),this.options=c,this.body="",this.subject="",this.name=o.M.get("lang",c[0].text),this.initAutomations()}onDispatch(){const t=function(t){const{href:e,protocol:i,params:s,body:o,subject:r,target:n,dispatchEvent:a,event:l}=t;if(!e)return a(l),{dispatched:!0};const c=L(e,i,s,o,r,n);return c?{dispatched:!0,href:c.url,protocol:c.protocol,params:c.params,value:c.url,link:c.url,lastUrl:c.url}:{dispatched:!1}}({href:this.href,protocol:this.protocol,params:this.params,body:this.body,subject:this.subject,target:this.target,dispatchEvent:this.dispatchEvent.bind(this),event:this.event});if(t.dispatched){if(t.href){this.href=t.href,this.protocol=t.protocol,this.params=t.params?{...t.params}:{},this.value=t.value,this.link=t.link,this.lastUrl=t.lastUrl;const e="string"==typeof t.href?t.href:t.href?.href;this._urlInputRawValue=null!=e&&""!==e?String(e):""}this.dispatchEvent(this.event)}}onChangeLink(t){const e=t.target.value;this._urlInputRawValue=e;const i=R(e,this.protocol,this.href);null!==i?(this.href=i.href,this.protocol=i.protocol,i.clearParams&&(this.body="",this.subject=""),void 0!==i.body&&(this.body=i.body),void 0!==i.subject&&(this.subject=i.subject),i.shouldBlur&&this.onBlur()):this.href=e}onKeyDown(t){if("submit"===t.type){const t=this.inputRef?.value;void 0!==t?.value&&this.onChangeLink({target:{value:t.value}}),t&&"function"==typeof t.success&&t.success(),this.onDispatch()}}onUrlInputFocus(){const t=this.inputRef?.value?.value;null!=t&&(this._urlInputRawValue=t),this.urlInputFocused=!0}onUrlInputBlur(){this.urlInputFocused=!1,this.hasButton||this.onDispatch()}onBlur(){this.hasButton||this.onDispatch()}onClickOk(){this.onDispatch()}onChangeTarget(t){const e={target:t.target.value};this.target=e.target,t.stopPropagation(),!this.hasButton&&this.href&&this.onBlur()}resolveAnchors(){this.anchors=C()}onChangeType(t){if(t===M)return void this.onAutomationsClick();const e=function(t,e,i,s){const o=e.find(e=>e.type===t);if(!o)return{forceProtocolChange:!1};const r="anchor"===o.text,n=s!==o.type;return setTimeout(()=>{i&&i.value&&i.value.focus()},500),{protocol:o.type,forceProtocolChange:!0,shouldResolveAnchors:r,clearParams:n}}(t,this.options,this.inputRef,this.protocol);if(e.shouldResolveAnchors&&this.resolveAnchors(),this.protocol=e.protocol,this.forceProtocolChange=e.forceProtocolChange,e.clearParams&&(this.body="",this.subject=""),this.compact&&e.clearParams)return this.href="",this.params={},void(this._urlInputRawValue="");if(e.forceProtocolChange){const t=new r.A(this.href,{protocol:this.protocol});t.protocol=this.protocol,this.href=t,this.onBlur()}}connectedCallback(){super.connectedCallback(),this.href=new r.A(this.href);const t=String(this.href?.href||""),e=(0,m.r_)(t),i=this.href&&this.href.params&&this.href.params[p];(e||i)&&this.parseAutomationLink(this.href)}render(){const t=o.M.get("config","editor","configure","editorProps","linkPicker","savedVariables");this.resolveAnchors();const e=this.lastUrl!==this.href,i=new r.A(this.href,{protocol:e?null:this.protocol});this.protocol&&!e?i.protocol=this.protocol:i.protocol&&(this.protocol=i.protocol);const n=String(this.href?.href||this.href||"");if(this._lastBodySyncHref!==n){const t=void 0===this._lastBodySyncHref;this._lastBodySyncHref=n,i.params?(this.body=i.params.text||i.params.body||"",this.subject=i.params.subject||""):(this.body="",this.subject="");(0,m.r_)(n)||i.params&&i.params[p]?(this.selectedAutomation=null,this.activeAutomationId=null,this.selectedMailingLists=[],this.selectedMailingListsForAdd=[],this.selectedMailingListsForRemove=[],this.automationAction=null,this.showAutomations=!0,this.parseAutomationLink(this.href)):(this.showAutomations=!1,this.selectedAutomation=null,this.activeAutomationId=null,this.selectedMailingLists=[],this.selectedMailingListsForAdd=[],this.selectedMailingListsForRemove=[],this.automationAction=null,t&&this.openAutomations&&B().length&&this.onAutomationsClick())}const l=function(t,e,i){let s=[];return t.isEmail?s=[]:t.isPhone?s=i.filter(t=>("tel:"===t.type||"sms:"===t.type||"whatsapp:"===t.type)&&t.type!==e):-1!==t.href.indexOf("http://")&&"https:"!==e&&(s=[{type:"https:",text:o.M.get("lang","is_user_wants_https"),reccomanded:!0}]),"anchor:"===e&&(s=[]),s}(i,this.protocol,this.options);let c=i.href;const h=String(i.href||""),d=(0,m.r_)(h),g=i.params&&i.params[p];if(d)c=h;else if(g){const t=u,e=[];i.params&&Object.keys(i.params).forEach(s=>{if(!t.includes(s)){const t=i.params[s];e.push(`${s}=${encodeURIComponent(t).replace(/%24/g,"$")}`)}});const s=i.url||"";c=i.protocol?"http:"===i.protocol||"https:"===i.protocol?`${i.protocol}//${s}`:`${i.protocol}${s}`:s,e.length>0&&(c+=`?${e.join("&")}`)}const f=function(t){switch(t){case"mailto:":return"what_the_email_address";case"tel:":return"what_the_phone_number";case"sms:":case"whatsapp:":return"what_the_phone_number_to_send_msg";case"anchor:":return"what_the_anchor_name";case"file:":return"what_the_file_name";default:return"what_the_url_address"}}(this.protocol),b=[...this.options],y=b.findIndex(t=>"http:"===t.type);y>-1&&b.splice(y,1);const x=B(),v={url:i,href:this.href,protocol:this.protocol,anchors:this.anchors,body:this.body,subject:this.subject,onChangeLink:this.onChangeLink.bind(this),onBlur:this.onBlur.bind(this),onRequest:this.onRequest,updateBody:t=>{this.body=t},updateSubject:t=>{this.subject=t}},w=null!=c&&""!==c?String(c):"",$=this._urlInputRawValue!==w,k=void 0!==this._lastSyncedMyHref&&w!==this._lastSyncedMyHref,A=this.urlInputFocused&&this._urlInputRawValue&&w&&!k;$&&!A?(this._urlInputRawValue=w,this._lastSyncedMyHref=w):$||(this._lastSyncedMyHref=w);const L=this.urlInputFocused&&void 0!==this._urlInputRawValue?this._urlInputRawValue:c,R={protocol:this.protocol,url:i,autofocus:this.autofocus,inputRef:(0,a.K)(this.inputRef),onChangeLink:this.onChangeLink.bind(this),onBlur:this.onUrlInputBlur.bind(this),onFocus:this.onUrlInputFocus.bind(this),onKeyDown:this.onKeyDown.bind(this),myHref:L},C="rtl"===getComputedStyle(this).getPropertyValue("--direction-locale").trim();if(this.showAutomations)return s.qy` <div class="root ${C?"rtl":""}">${this.renderAutomationsView()}</div>`;if(this.compact){const t=!this.protocol||"https:"===this.protocol||"http:"===this.protocol;return s.qy`<div class="compact">
1081
+ `}}}(s.WF)){constructor(){super(),this.inputRef=(0,a._)(),this.onBlur=this.onBlur.bind(this),this.onKeyDown=this.onKeyDown.bind(this),this.urlInputFocused=!1,this._urlInputRawValue="",this._lastSyncedMyHref=void 0,this._lastBodySyncHref=void 0,this.lastUrl=void 0,this.target="_blank",this.anchors=[],this.event=new UIEvent("change",{view:window,bubbles:!0,cancelable:!0}),this.options=c,this.body="",this.subject="",this.name=o.M.get("lang",c[0].text),this.initAutomations()}onDispatch(){this.event=new UIEvent("change",{view:window,bubbles:!0,cancelable:!0});const t=function(t){const{href:e,protocol:i,params:s,body:o,subject:r,target:n,dispatchEvent:a,event:l}=t;if(!e)return a(l),{dispatched:!0};const c=L(e,i,s,o,r,n);return c?{dispatched:!0,href:c.url,protocol:c.protocol,params:c.params,value:c.url,link:c.url,lastUrl:c.url}:{dispatched:!1}}({href:this.href,protocol:this.protocol,params:this.params,body:this.body,subject:this.subject,target:this.target,dispatchEvent:this.dispatchEvent.bind(this),event:this.event});if(t.dispatched){if(t.href){this.href=t.href,this.protocol=t.protocol,this.params=t.params?{...t.params}:{},this.value=t.value,this.link=t.link,this.lastUrl=t.lastUrl;const e="string"==typeof t.href?t.href:t.href?.href;this._urlInputRawValue=null!=e&&""!==e?String(e):""}this.dispatchEvent(this.event)}}onChangeLink(t){const e=t.target.value;this._urlInputRawValue=e;const i=R(e,this.protocol,this.href);null!==i?(this.href=i.href,this.protocol=i.protocol,i.clearParams&&(this.body="",this.subject=""),void 0!==i.body&&(this.body=i.body),void 0!==i.subject&&(this.subject=i.subject),i.shouldBlur&&this.onBlur()):this.href=e}onKeyDown(t){if("submit"===t.type){const t=this.inputRef?.value;void 0!==t?.value&&this.onChangeLink({target:{value:t.value}}),t&&"function"==typeof t.success&&t.success(),this.onDispatch()}}onUrlInputFocus(){const t=this.inputRef?.value?.value;null!=t&&(this._urlInputRawValue=t),this.urlInputFocused=!0}onUrlInputBlur(){this.urlInputFocused=!1,this.hasButton||this.onDispatch()}onBlur(){this.hasButton||this.onDispatch()}onClickOk(){this.onDispatch()}onChangeTarget(t){const e={target:t.target.value};this.target=e.target,t.stopPropagation(),!this.hasButton&&this.href&&this.onBlur()}resolveAnchors(){this.anchors=U()}onChangeType(t){if(t===C)return void this.onAutomationsClick();const e=function(t,e,i,s){const o=e.find(e=>e.type===t);if(!o)return{forceProtocolChange:!1};const r="anchor"===o.text,n=s!==o.type;return setTimeout(()=>{i&&i.value&&i.value.focus()},500),{protocol:o.type,forceProtocolChange:!0,shouldResolveAnchors:r,clearParams:n}}(t,this.options,this.inputRef,this.protocol);if(e.shouldResolveAnchors&&this.resolveAnchors(),this.protocol=e.protocol,this.forceProtocolChange=e.forceProtocolChange,e.clearParams&&(this.body="",this.subject=""),this.compact&&e.clearParams)return this.href="",this.params={},void(this._urlInputRawValue="");if(e.forceProtocolChange){const t=new r.A(this.href,{protocol:this.protocol});t.protocol=this.protocol,this.href=t,this.onBlur()}}connectedCallback(){super.connectedCallback(),this.href=new r.A(this.href);const t=String(this.href?.href||""),e=(0,m.r_)(t),i=this.href&&this.href.params&&this.href.params[p];(e||i)&&this.parseAutomationLink(this.href)}render(){const t=o.M.get("config","editor","configure","editorProps","linkPicker","savedVariables");this.resolveAnchors();const e=this.lastUrl!==this.href,i=new r.A(this.href,{protocol:e?null:this.protocol});this.protocol&&!e?i.protocol=this.protocol:i.protocol&&(this.protocol=i.protocol);const n=String(this.href?.href||this.href||"");if(this._lastBodySyncHref!==n){const t=void 0===this._lastBodySyncHref;this._lastBodySyncHref=n,i.params?(this.body=i.params.text||i.params.body||"",this.subject=i.params.subject||""):(this.body="",this.subject="");(0,m.r_)(n)||i.params&&i.params[p]?(this.selectedAutomation=null,this.activeAutomationId=null,this.selectedMailingLists=[],this.selectedMailingListsForAdd=[],this.selectedMailingListsForRemove=[],this.automationAction=null,this.showAutomations=!0,this.parseAutomationLink(this.href)):(this.showAutomations=!1,this.selectedAutomation=null,this.activeAutomationId=null,this.selectedMailingLists=[],this.selectedMailingListsForAdd=[],this.selectedMailingListsForRemove=[],this.automationAction=null,t&&this.openAutomations&&B().length&&this.onAutomationsClick())}const l=function(t,e,i){let s=[];return t.isEmail?s=[]:t.isPhone?s=i.filter(t=>("tel:"===t.type||"sms:"===t.type||"whatsapp:"===t.type)&&t.type!==e):-1!==t.href.indexOf("http://")&&"https:"!==e&&(s=[{type:"https:",text:o.M.get("lang","is_user_wants_https"),reccomanded:!0}]),"anchor:"===e&&(s=[]),s}(i,this.protocol,this.options);let c=i.href;const h=String(i.href||""),d=(0,m.r_)(h),g=i.params&&i.params[p];if(d)c=h;else if(g){const t=u,e=[];i.params&&Object.keys(i.params).forEach(s=>{if(!t.includes(s)){const t=i.params[s];e.push(`${s}=${encodeURIComponent(t).replace(/%24/g,"$")}`)}});const s=i.url||"";c=i.protocol?"http:"===i.protocol||"https:"===i.protocol?`${i.protocol}//${s}`:`${i.protocol}${s}`:s,e.length>0&&(c+=`?${e.join("&")}`)}const f=function(t){switch(t){case"mailto:":return"what_the_email_address";case"tel:":return"what_the_phone_number";case"sms:":case"whatsapp:":return"what_the_phone_number_to_send_msg";case"anchor:":return"what_the_anchor_name";case"file:":return"what_the_file_name";default:return"what_the_url_address"}}(this.protocol),b=[...this.options],y=b.findIndex(t=>"http:"===t.type);y>-1&&b.splice(y,1);const x=B(),v={url:i,href:this.href,protocol:this.protocol,anchors:this.anchors,body:this.body,subject:this.subject,onChangeLink:this.onChangeLink.bind(this),onBlur:this.onBlur.bind(this),onRequest:this.onRequest,updateBody:t=>{this.body=t},updateSubject:t=>{this.subject=t}},w=null!=c&&""!==c?String(c):"",$=this._urlInputRawValue!==w,k=void 0!==this._lastSyncedMyHref&&w!==this._lastSyncedMyHref,A=this.urlInputFocused&&this._urlInputRawValue&&w&&!k;$&&!A?(this._urlInputRawValue=w,this._lastSyncedMyHref=w):$||(this._lastSyncedMyHref=w);const L=this.urlInputFocused&&void 0!==this._urlInputRawValue?this._urlInputRawValue:c,R={protocol:this.protocol,url:i,autofocus:this.autofocus,inputRef:(0,a.K)(this.inputRef),onChangeLink:this.onChangeLink.bind(this),onBlur:this.onUrlInputBlur.bind(this),onFocus:this.onUrlInputFocus.bind(this),onKeyDown:this.onKeyDown.bind(this),myHref:L},U="rtl"===getComputedStyle(this).getPropertyValue("--direction-locale").trim();if(this.showAutomations)return s.qy` <div class="root ${U?"rtl":""}">${this.renderAutomationsView()}</div>`;if(this.compact){const t=!this.protocol||"https:"===this.protocol||"http:"===this.protocol;return s.qy`<div class="compact">
1082
1082
  <div class="compact-row">
1083
- ${U(b,this.protocol,this.onChangeType.bind(this),x)}
1083
+ ${M(b,this.protocol,this.onChangeType.bind(this),x)}
1084
1084
  ${"anchor:"===this.protocol?null:S({...R,value:L,onChange:R.onChangeLink,placeholder:o.M.get("lang",f)||"",style:"width:100%;--cdtr-input-height:32px;",width:"100%",coach:!1})}
1085
1085
  </div>
1086
1086
  ${_(this.protocol,v)}
@@ -1096,16 +1096,16 @@
1096
1096
  <lang-text text="open_in_new_tab"></lang-text>
1097
1097
  </div>`:null}
1098
1098
  </div>`}return s.qy` <div class="root">
1099
- ${z=this.label,z?s.qy`<cdtr-title
1099
+ ${E=this.label,E?s.qy`<cdtr-title
1100
1100
  style="font-weight: 700;
1101
1101
  font-size: 14.4px;
1102
1102
  margin-bottom: 0.6rem;
1103
1103
  color: #000000b0;"
1104
- ><lang-text text=${z}></lang-text
1104
+ ><lang-text text=${E}></lang-text
1105
1105
  ><cdtr-divider></cdtr-divider
1106
1106
  ></cdtr-title>`:null}
1107
1107
  <cdtr-row alignItems="center" justify="space-between" spacing="10">
1108
- ${U(this.options,this.protocol,this.onChangeType.bind(this),x)}
1108
+ ${M(this.options,this.protocol,this.onChangeType.bind(this),x)}
1109
1109
  ${F=this.target,T=this.onChangeTarget.bind(this),s.qy`
1110
1110
  <cdtr-dropdown @change=${t=>T(t)} style="min-width: 120px;">
1111
1111
  <cdtr-dropdown-button minWidth=${120} class="dropdown-button" slot="trigger">
@@ -1150,10 +1150,10 @@
1150
1150
  ></cdtr-list-picker>`:null}(t,c,this.onChangeLink.bind(this),this.onBlur.bind(this))}
1151
1151
  </div>
1152
1152
 
1153
- ${M=this.hasButton,q=this.onClickOk.bind(this),M?s.qy`<hr style="margin: 1rem 0; border: none; border-top: 1px solid #e0e0e0;">
1153
+ ${C=this.hasButton,q=this.onClickOk.bind(this),C?s.qy`<hr style="margin: 1rem 0; border: none; border-top: 1px solid #e0e0e0;">
1154
1154
  <cdtr-row justify="flex-end" mt="1">
1155
1155
  <paper-button fullWidth @click=${q} raised class="add-button">
1156
1156
  <lang-text text="add_now"></lang-text>
1157
1157
  </paper-button>
1158
1158
  </cdtr-row>`:null}
1159
- </div>`;var M,q,I,j,F,T,z}}F.styles=n,F.properties={href:{type:String,reflect:!0},value:{type:Object},protocol:{type:String},name:{type:String},label:{type:String},target:{type:String},hasButton:{type:Boolean},params:{type:Object},explain:{type:String},anchors:{type:Array},link:{},body:{type:String},subject:{type:String},autofocus:{type:Boolean},onRequest:{type:Function},openAutomations:{type:Boolean},compact:{type:Boolean}},customElements.get("cdtr-link-element")||customElements.define("cdtr-link-element",F)},88385(t,e,i){i.d(e,{A:()=>a});const s=t=>!(!t||!t.match(/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/)),o=t=>!(!t||!t.replace("-","").match(/^[+]*[(]{0,1}[0-9]{9,9}[)]{0,1}[-\s\./0-9]*$/g)&&!t.match(/[0-9]{3}-[0-9]{3}-[0-9]{4}/));function r(t){const e={},i=/([^&=]+)=?([^&]*)/g,s=t=>{try{return decodeURIComponent(t.replace(/\+/g," "))}catch(e){return t.replace(/\+/g," ")}},o=t.indexOf("?");let r,n=-1!==o?t.substring(o+1):"";for(;null!==(r=i.exec(n));){const t=s(r[1]),i=s(r[2]);t&&(e[t]=i)}return e}function n(t){if(!t)return"";let e=t.replace(/^[^:]+:(?:\/\/)?/,"");return e=e.replace(/^\/+/,""),e=e.split("?")[0],encodeURIComponent(e).replace(/%24/g,"$")}class a{static getProtocol(t){if(!t)return"";const e=t.indexOf(":");return e>0?t.slice(0,e):""}constructor(t,e){if(this.protocol="",this.href="",this.fullHref="",this.target="_self",this.isEmail=!1,this.isPhone=!1,this.isAnchor=!1,this.url="",this.isValid=!0,this.params={},"string"==typeof t?this.href=t:t&&"object"==typeof t&&Object.assign(this,t),/^\[\[[^\]]+\]\](?:\?|$)/.test(this.href)){const t=this.href;this.isValid=!1,this.protocol=e?.protocol??"",this.isEmail=!1,this.isPhone=!1,this.isAnchor=!1,this.params={...this.params,...e?.params,...r(t)};const i=t.indexOf("?");return this.url=i>-1?t.slice(0,i):t,this.href=t,void(this.fullHref=t)}this.isValid=this.isValidUrl(this.href),this.protocol=e?.protocol||this.protocol||a.getProtocol(this.href);const i=function(t){if(!t)return"";let e=t.replace(/^[^:]+:(?:\/\/)?/,"");return e=e.replace(/^\/+/,""),e=e.split("?")[0],e}(this.href);if(this.isEmail=s(i),this.isPhone=o(i),this.protocol||(this.isEmail?this.protocol="mailto:":this.isPhone?this.protocol="tel:":this.isValid&&(this.protocol="https:")),this.isAnchor=this.href.startsWith("#"),e?.target){if(!["_blank","_self","_parent","_top"].includes(e.target))throw new Error(`Url: invalid target "${e.target}"`);this.target=e.target}this.params={...this.params,...e?.params,...r(this.href)},this.url=n(this.href),this.protocol&&!this.protocol.endsWith(":")&&(this.protocol+=":");const l="http:"===this.protocol||"https:"===this.protocol;this.href=l?`${this.protocol}//${this.url}`:this.protocol+this.url,this.fullHref=this.getUrlWithParams(),this.href=this.getUrlWithParams(),this.isAnchor="anchor:"===this.protocol||this.href.startsWith("#")}addParam(t,e){this.params[t]=e,this.href=this.getUrlWithParams()}getUrlWithParams(){let t,e="";try{t=decodeURIComponent(this.url)}catch(e){t=this.url}if(Object.keys(this.params).length>0){t+="?",e="?";for(const i in this.params){const s=this.params[i],o=encodeURIComponent(i).replace(/%24/g,"$");if(s){const i=encodeURIComponent(s).replace(/%24/g,"$");t+=`${o}=${i}&`,e+=`${o}=${i}&`}else t+=`${o}&`,e+=`${o}&`}t=t.slice(0,-1)}const i=t=>{try{return decodeURIComponent(t)}catch{return t}};if(this.protocol&&("http:"===this.protocol||"https:"===this.protocol))return i(this.protocol+"//"+t);if(this.isAnchor||"anchor:"===this.protocol)return t?i(t.startsWith("#")?t:`#${t}`):"";if("whatsapp:"===this.protocol){const s=this.extractPhoneFromTextUsingRegex(t);return s.length>0?i("https://wa.me/"+s[0]+e):i("https://wa.me/"+e)}return i(this.protocol+t)}extractPhoneFromTextUsingRegex(t){if(!t)return[];const e=[...t.matchAll(/(?:whatsapp:([^?\s]+)|\+?[\d\s\-\(\)\.]{7,20})/g)];return Array.from(new Set(e.map(t=>t[1]||t[0]).filter(t=>{const e=t.replace(/\D/g,"");return e.length>=7&&e.length<=15}).map(t=>t.trim())))}isValidUrl(t){if(!t)return!1;return/^(https?:\/\/)?([a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}(\/.*)?$/.test(t)}}a.resetURL=n}}]);
1159
+ </div>`;var C,q,I,j,F,T,E}}F.styles=n,F.properties={href:{type:String,reflect:!0},value:{type:Object},protocol:{type:String},name:{type:String},label:{type:String},target:{type:String},hasButton:{type:Boolean},params:{type:Object},explain:{type:String},anchors:{type:Array},link:{},body:{type:String},subject:{type:String},autofocus:{type:Boolean},onRequest:{type:Function},openAutomations:{type:Boolean},compact:{type:Boolean}},customElements.get("cdtr-link-element")||customElements.define("cdtr-link-element",F)},88385(t,e,i){i.d(e,{A:()=>a});const s=t=>!(!t||!t.match(/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/)),o=t=>!(!t||!t.replace("-","").match(/^[+]*[(]{0,1}[0-9]{9,9}[)]{0,1}[-\s\./0-9]*$/g)&&!t.match(/[0-9]{3}-[0-9]{3}-[0-9]{4}/));function r(t){const e={},i=/([^&=]+)=?([^&]*)/g,s=t=>{try{return decodeURIComponent(t.replace(/\+/g," "))}catch(e){return t.replace(/\+/g," ")}},o=t.indexOf("?");let r,n=-1!==o?t.substring(o+1):"";for(;null!==(r=i.exec(n));){const t=s(r[1]),i=s(r[2]);t&&(e[t]=i)}return e}function n(t){if(!t)return"";let e=t.replace(/^[^:]+:(?:\/\/)?/,"");return e=e.replace(/^\/+/,""),e=e.split("?")[0],encodeURIComponent(e).replace(/%24/g,"$")}class a{static getProtocol(t){if(!t)return"";const e=t.indexOf(":");return e>0?t.slice(0,e):""}constructor(t,e){if(this.protocol="",this.href="",this.fullHref="",this.target="_self",this.isEmail=!1,this.isPhone=!1,this.isAnchor=!1,this.url="",this.isValid=!0,this.params={},"string"==typeof t?this.href=t:t&&"object"==typeof t&&Object.assign(this,t),/^\[\[[^\]]+\]\](?:\?|$)/.test(this.href)){const t=this.href;this.isValid=!1,this.protocol=e?.protocol??"",this.isEmail=!1,this.isPhone=!1,this.isAnchor=!1,this.params={...this.params,...e?.params,...r(t)};const i=t.indexOf("?");return this.url=i>-1?t.slice(0,i):t,this.href=t,void(this.fullHref=t)}this.isValid=this.isValidUrl(this.href),this.protocol=e?.protocol||this.protocol||a.getProtocol(this.href);const i=function(t){if(!t)return"";let e=t.replace(/^[^:]+:(?:\/\/)?/,"");return e=e.replace(/^\/+/,""),e=e.split("?")[0],e}(this.href);if(this.isEmail=s(i),this.isPhone=o(i),this.protocol||(this.isEmail?this.protocol="mailto:":this.isPhone?this.protocol="tel:":this.isValid&&(this.protocol="https:")),this.isAnchor=this.href.startsWith("#"),e?.target){if(!["_blank","_self","_parent","_top"].includes(e.target))throw new Error(`Url: invalid target "${e.target}"`);this.target=e.target}this.params={...this.params,...e?.params,...r(this.href)},this.url=n(this.href),this.protocol&&!this.protocol.endsWith(":")&&(this.protocol+=":");const l="http:"===this.protocol||"https:"===this.protocol;this.href=l?`${this.protocol}//${this.url}`:this.protocol+this.url,this.fullHref=this.getUrlWithParams(),this.href=this.getUrlWithParams(),this.isAnchor="anchor:"===this.protocol||this.href.startsWith("#")}addParam(t,e){this.params[t]=e,this.href=this.getUrlWithParams()}getUrlWithParams(){let t,e="";try{t=decodeURIComponent(this.url)}catch(e){t=this.url}if(Object.keys(this.params).length>0){t+="?",e="?";for(const i in this.params){const s=this.params[i],o=encodeURIComponent(i).replace(/%24/g,"$");if(s){const i=encodeURIComponent(s).replace(/%24/g,"$");t+=`${o}=${i}&`,e+=`${o}=${i}&`}else t+=`${o}&`,e+=`${o}&`}t=t.slice(0,-1)}const i=t=>{try{return decodeURIComponent(t)}catch{return t}};if(this.protocol&&("http:"===this.protocol||"https:"===this.protocol))return i(this.protocol+"//"+t);if(this.isAnchor||"anchor:"===this.protocol)return t?i(t.startsWith("#")?t:`#${t}`):"";if("whatsapp:"===this.protocol){const s=this.extractPhoneFromTextUsingRegex(t);return s.length>0?i("https://wa.me/"+s[0]+e):i("https://wa.me/"+e)}return i(this.protocol+t)}extractPhoneFromTextUsingRegex(t){if(!t)return[];const e=[...t.matchAll(/(?:whatsapp:([^?\s]+)|\+?[\d\s\-\(\)\.]{7,20})/g)];return Array.from(new Set(e.map(t=>t[1]||t[0]).filter(t=>{const e=t.replace(/\D/g,"");return e.length>=7&&e.length<=15}).map(t=>t.trim())))}isValidUrl(t){if(!t)return!1;return/^(https?:\/\/)?([a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}(\/.*)?$/.test(t)}}a.resetURL=n}}]);
Binary file
@@ -0,0 +1 @@
1
+ "use strict";(("undefined"!=typeof self?self:this).webpackChunkCreaditor=("undefined"!=typeof self?self:this).webpackChunkCreaditor||[]).push([[4e3],{84e3(e,n,t){t.d(n,{default:()=>F});var r=t(47493);const o=e=>{let{helpers:n,editor:t,getFocused:r}=e;return{set:(e,o,i)=>{switch(o){case"style":return e[o]=n.deepMerge(e[o],i),!0;case"text":return e.text=i,r()||t.chain().setContent(i).run(),!0;case"ripple":case"rippleColor":case"scaleOnHover":case"hasIcon":case"iconUrl":case"iconSize":case"iconDirection":case"modalBlockId":return e[o]=i,!0;case"onClick":if(i.link)return e[o]=i,!0}}}};var i=t(72591),s=t.n(i),a=t(88639),l=t.n(a),c=t(88128),A=t.n(c),d=t(30855),u=t.n(d),p=t(93051),m=t.n(p),h=t(49536),E={};E.setAttributes=u(),E.insert=A().bind(null,"head"),E.domAPI=l(),E.insertStyleElement=m();s()(h.A,E);const C=h.A&&h.A.locals?h.A.locals:void 0;var b=t(81318),g=t(1366),f=t(67291),y=t(85194),B=t(28396);const x=b.YY.create({addKeyboardShortcuts:()=>({Enter:()=>!0})});const F=()=>{const e="button";return{name:e,create:n=>{const{createElement:t,compose:i,helpers:s}=n,{arrayToString:a,mergeDiff:l}=s;let c=!1;const A=document.createElement("div"),d=document.createElement("div"),{editor:u}=function(e){let{content:n,element:t}=e;return{element:t,editor:new b.KE({element:t,extensions:[g.A,f.A,B.A,y.Ay,x],content:n})}}({content:i.props.text,element:d});A.appendChild(d);u.view.dom.setAttribute("dir","auto");const p=()=>{let e="";try{e=u.getText()||""}catch(n){e=""}A.setAttribute("dir",function(e){if(!e)return null;for(const n of String(e)){if(/[\u0590-\u05FF\u0600-\u07BF\u0860-\u08FF\uFB1D-\uFDFF\uFE70-\uFEFF]/.test(n))return"rtl";if(/\p{L}/u.test(n))return"ltr"}return null}(e)||"ltr")};return p(),u.on("update",e=>{let{editor:n}=e;const t=n.getText();p(),i.editor.store().updateComponent(i,"text",t)}),u.on("focus",e=>{let{event:n,editor:t}=e;c=!0}),u.on("blur",e=>{let{event:n,editor:t}=e;c=!1}),A.className=C.button,t({name:e,id:i.id,template:A,commands:{insertContent:e=>{u.commands.insertContent(e),u.chain().focus()}},defaultProps:{style:{height:"auto",width:"200px",padding:"10px",borderRadius:"5px",fontFamily:"Arial",fontSize:"16px"},text:"button"},render:()=>{try{i.props.style.display="",i.props.style.direction=""}catch(e){console.error(e)}l(A,{style:i.props.style});const e=i.props.hasIcon,n=i.props.iconUrl,t=i.props.iconDirection,r=i.props.iconSize,o="icon_in_button";p();let s=A.querySelector(`.${o}`)||document.createElement("img");e&&n?(s.className=o,s.src=n,s.style.width=(r||16)+"px",s.style.height=(r||16)+"px",s.style.marginRight="8px",s.style.marginLeft="8px","right"===t?A.appendChild(s):A.insertBefore(s,A.firstChild)):s.remove()},draggable:{group:"element"},droppable:{group:"element"},resizeable:()=>A,resizeAxis:"xy",handleBar:!0,validator:o({template:A,helpers:s,editor:u,getFocused:function(){return c}}),schema:i.schema,onSelect:e=>{A.classList.add(e)},onDeselect:e=>{A.classList.remove(e)},elementProps:i,destroy:()=>{u.destroy()},remove:()=>{A.remove()},createEditor:r.A})}}}},49536(e,n,t){t.d(n,{A:()=>a});var r=t(82001),o=t.n(r),i=t(40935),s=t.n(i)()(o());s.push([e.id,".BEr8unIfy4OEGYhlHclN {\n cursor: text !important;\n}\n.BEr8unIfy4OEGYhlHclN {\n min-width: 30px;\n display: flex;\n justify-content: center;\n align-items: center;\n text-align: center;\n padding:10px;\n}\n.BEr8unIfy4OEGYhlHclN p {\n margin: 0;\n line-height: 1;\n}\n.cI3RTMAdk9qoZ8mu9Sm9 {\n width: 100%;\n}\n.VSumPf0Ui7b1pl8cMATP {\n position: absolute;\n z-index: 9;\n width: 3px;\n height: 90%;\n background: var(--resizer-color);\n border-radius: 20px;\n}\n.Vo2Ewnq6ekWFdNMjxBIB {\n left: -8px;\n cursor: w-resize;\n}\n.WLZC84sb1rfaRnHCDyj8 {\n left: calc(100% + 5px);\n cursor: e-resize;\n}\n\n.BEr8unIfy4OEGYhlHclN .VSumPf0Ui7b1pl8cMATP {\n display: none;\n}\n.BEr8unIfy4OEGYhlHclN.Qh20ei1Fa8QUbGinFFbw .VSumPf0Ui7b1pl8cMATP {\n display: block;\n}\n/* .handle{\n display: none;\n}\n.button.selected .handle{\n display: block;\n} */\n","",{version:3,sources:["webpack://./../web-editors/button-editor-component/lib/style.module.css"],names:[],mappings:"AAAA;EACE,uBAAuB;AAOzB;AARA;EAEE,eAAe;EACf,aAAa;EACb,uBAAuB;EACvB,mBAAmB;EACnB,kBAAkB;EAClB,YAAY;AACd;AACA;EACE,SAAS;EACT,cAAc;AAChB;AACA;EACE,WAAW;AACb;AACA;EACE,kBAAkB;EAClB,UAAU;EACV,UAAU;EACV,WAAW;EACX,gCAAgC;EAChC,mBAAmB;AACrB;AACA;EACE,UAAU;EACV,gBAAgB;AAClB;AACA;EACE,sBAAsB;EACtB,gBAAgB;AAClB;;AAEA;EACE,aAAa;AACf;AACA;EACE,cAAc;AAChB;AACA;;;;;GAKG",sourcesContent:[".button {\n cursor: text !important;\n min-width: 30px;\n display: flex;\n justify-content: center;\n align-items: center;\n text-align: center;\n padding:10px;\n}\n.button p {\n margin: 0;\n line-height: 1;\n}\n.contentEditable {\n width: 100%;\n}\n.margin {\n position: absolute;\n z-index: 9;\n width: 3px;\n height: 90%;\n background: var(--resizer-color);\n border-radius: 20px;\n}\n.marginLeft {\n left: -8px;\n cursor: w-resize;\n}\n.marginRight {\n left: calc(100% + 5px);\n cursor: e-resize;\n}\n\n.button .margin {\n display: none;\n}\n.button.selected .margin {\n display: block;\n}\n/* .handle{\n display: none;\n}\n.button.selected .handle{\n display: block;\n} */\n"],sourceRoot:""}]),s.locals={button:"BEr8unIfy4OEGYhlHclN",contentEditable:"cI3RTMAdk9qoZ8mu9Sm9",margin:"VSumPf0Ui7b1pl8cMATP",marginLeft:"Vo2Ewnq6ekWFdNMjxBIB",marginRight:"WLZC84sb1rfaRnHCDyj8",selected:"Qh20ei1Fa8QUbGinFFbw"};const a=s},67291(e,n,t){t.d(n,{A:()=>o});var r=t(81318);const o=r.bP.create({name:"paragraph",priority:1e3,addOptions:()=>({HTMLAttributes:{}}),group:"block",content:"inline*",parseHTML:()=>[{tag:"p"}],renderHTML({HTMLAttributes:e}){return["p",(0,r.KV)(this.options.HTMLAttributes,e),0]},addCommands(){return{setParagraph:()=>({commands:e})=>e.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}})}}]);
Binary file
@@ -1,7 +1,7 @@
1
- "use strict";(("undefined"!=typeof self?self:this).webpackChunkCreaditor=("undefined"!=typeof self?self:this).webpackChunkCreaditor||[]).push([[5884],{55884(e,t,r){r.d(t,{default:()=>L});var o=r(12106),s=r(59929);let i={};function n(e){i.selected=e}function c(e){return i.selected}var a=r(83423),l=r(81444);const d="https://img.creaditor.ai";function p(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const r=t.width??24,o=t.height??24;let s=t.color??"000000";s.startsWith("#")&&(s=s.slice(1));const i=`${d}/icons/serve/${encodeURIComponent(e.category)}/${encodeURIComponent(e.name)}.png?width=${r}&height=${o}`;return(0,l.tG)(i,s)}class h extends s.WF{constructor(){super(),this.searchQuery="",this.iconColor="000000",this.iconSize=34,this.selectedSrc="",this._icons=[],this._loading=!1,this._error=""}willUpdate(e){e.has("searchQuery")&&this.searchQuery?this._fetchIcons():e.has("searchQuery")&&!this.searchQuery&&(this._icons=[],this._error="")}async _fetchIcons(){const e=(this.searchQuery||"").trim();if(e){this._loading=!0,this._error="";try{const t=new URLSearchParams({q:e,limit:"20"}),r=await fetch(`${d}/icons/search?${t.toString()}`);if(!r.ok)throw new Error(r.statusText);const o=await r.json();this._icons=o.icons||[]}catch(e){this._icons=[],this._error=e.message||"Failed to load icons"}finally{this._loading=!1}}else this._icons=[]}_onSelect(e){const t=(this.iconColor||"000000").replace(/^#/,""),r=Number(this.iconSize)||34,o=p(e,{width:r,height:r,color:t});this.dispatchEvent(new CustomEvent("icon-selected",{detail:{src:o,icon:e},bubbles:!0,composed:!0}))}render(){if(!this.searchQuery?.trim())return s.qy``;if(this._loading)return s.qy`<div class="loading"><span class="spinner"></span>Loading icons…</div>`;if(this._error)return s.qy`<div class="error">${this._error}</div>`;if(!this._icons.length)return s.qy``;const e=(this.iconColor||"000000").replace(/^#/,"");return s.qy`
1
+ "use strict";(("undefined"!=typeof self?self:this).webpackChunkCreaditor=("undefined"!=typeof self?self:this).webpackChunkCreaditor||[]).push([[5884],{55884(e,t,r){r.d(t,{default:()=>L});var o=r(12106),i=r(59929);let s={};function n(e){s.selected=e}function c(e){return s.selected}var a=r(83423),l=r(81444);const d="https://img.creaditor.ai";function p(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const r=t.width??24,o=t.height??24;let i=t.color??"000000";i.startsWith("#")&&(i=i.slice(1));const s=`${d}/icons/serve/${encodeURIComponent(e.category)}/${encodeURIComponent(e.name)}.png?width=${r}&height=${o}`;return(0,l.tG)(s,i)}class h extends i.WF{constructor(){super(),this.searchQuery="",this.iconColor="000000",this.iconSize=34,this.selectedSrc="",this._icons=[],this._loading=!1,this._error=""}willUpdate(e){e.has("searchQuery")&&this.searchQuery?this._fetchIcons():e.has("searchQuery")&&!this.searchQuery&&(this._icons=[],this._error="")}async _fetchIcons(){const e=(this.searchQuery||"").trim();if(e){this._loading=!0,this._error="";try{const t=new URLSearchParams({q:e,limit:"20"}),r=await fetch(`${d}/icons/search?${t.toString()}`);if(!r.ok)throw new Error(r.statusText);const o=await r.json();this._icons=o.icons||[]}catch(e){this._icons=[],this._error=e.message||"Failed to load icons"}finally{this._loading=!1}}else this._icons=[]}_onSelect(e){const t=(this.iconColor||"000000").replace(/^#/,""),r=Number(this.iconSize)||34,o=p(e,{width:r,height:r,color:t});this.dispatchEvent(new CustomEvent("icon-selected",{detail:{src:o,icon:e},bubbles:!0,composed:!0}))}render(){if(!this.searchQuery?.trim())return i.qy``;if(this._loading)return i.qy`<div class="loading"><span class="spinner"></span>Loading icons…</div>`;if(this._error)return i.qy`<div class="error">${this._error}</div>`;if(!this._icons.length)return i.qy``;const e=(this.iconColor||"000000").replace(/^#/,"");return i.qy`
2
2
 
3
3
  <div class="grid">
4
- ${this._icons.map(t=>{const r=p(t,{width:24,height:24,color:e}),o=this.selectedSrc&&(this.selectedSrc.includes(t.name)||this.selectedSrc===r);return s.qy`
4
+ ${this._icons.map(t=>{const r=p(t,{width:24,height:24,color:e}),o=this.selectedSrc&&(this.selectedSrc.includes(t.name)||this.selectedSrc===r);return i.qy`
5
5
  <button
6
6
  type="button"
7
7
  class="icon-wrap ${o?"selected":""}"
@@ -12,7 +12,7 @@
12
12
  </button>
13
13
  `})}
14
14
  </div>
15
- `}}h.properties={searchQuery:{type:String},iconColor:{type:String},iconSize:{type:Number},selectedSrc:{type:String},_icons:{type:Array,state:!0},_loading:{type:Boolean,state:!0},_error:{type:String,state:!0}},h.styles=s.AH`
15
+ `}}h.properties={searchQuery:{type:String},iconColor:{type:String},iconSize:{type:Number},selectedSrc:{type:String},_icons:{type:Array,state:!0},_loading:{type:Boolean,state:!0},_error:{type:String,state:!0}},h.styles=i.AH`
16
16
  :host {
17
17
  display: block;
18
18
  font-size: 12px;
@@ -77,15 +77,15 @@
77
77
  .error {
78
78
  color: var(--error-color, #c00);
79
79
  }
80
- `,customElements.define("social-icon-suggestions",h);var m=r(61919);const f=e=>{{const{component:t,commands:r}=e,o=()=>{let e=c();if(e||(e=t.props.items.find(e=>!e.link),!e&&t.props.items.length>0&&(e=t.props.items[0])),e){!t.props.items.find(t=>t.id===e.id)&&t.props.items.length>0&&(e=t.props.items[0])}return e};return{select:e=>{let{changeTab:t,tab:r}=e;"link"!==r&&t("link")},tabs:e=>{e||(e="link");const t=[{text:"image"},{text:"design"},{text:"link",selected:!0}];return t.forEach(t=>t.selected=t.selected=t.text===e),t},layout:e=>{let{tab:i,changeTab:n,tabs:c}=e;const d=o(),p=[{type:"node",node:()=>s.qy`<img
80
+ `,customElements.define("social-icon-suggestions",h);var m=r(61919);const f=e=>{{const{component:t,commands:r}=e,o=()=>{let e=c();if(e||(e=t.props.items.find(e=>!e.link),!e&&t.props.items.length>0&&(e=t.props.items[0])),e){!t.props.items.find(t=>t.id===e.id)&&t.props.items.length>0&&(e=t.props.items[0])}return e};return{select:e=>{let{changeTab:t,tab:r}=e;"link"!==r&&t("link")},tabs:e=>{e||(e="link");const t=[{text:"image"},{text:"design"},{text:"link",selected:!0}];return t.forEach(t=>t.selected=t.selected=t.text===e),t},layout:e=>{let{tab:s,changeTab:n,tabs:c}=e;const d=o(),p=[{type:"node",node:()=>i.qy`<img
81
81
  style="padding:10px;display:block;margin:auto"
82
82
  width="52"
83
83
  height="52"
84
84
  src=${d?.src?(0,l.tG)(d.src,d.fgColor||d.iconColor):""}
85
- />`},{type:"button",text:"delete",bgColor:"#df381d",color:"#fff",icon:"deleteBin",active:!0,onClick:e=>{const s=o();if(!s)return;const i=[...t.props.items];if(i.length<2)return;const n=i.findIndex(e=>e.id===s.id);-1!==n&&(i.splice(n,1),r.execCommand("items",i))}},{type:"divider"},{type:"gallery",active:"image"===i.text,src:d?.src,hasPreview:!0,text:"open_gallery",justify:"flex-start",onChange:e=>{const s=o();if(!s)return;let i=e.detail;Array.isArray(i)&&(i=i[0]);const n=t.props,c=JSON.parse(JSON.stringify(n.items)),a=c.findIndex(e=>e.id===s.id);-1!==a&&(c[a].src=i.src,r.execCommand("items",c))}},{type:"custom",active:()=>{const e=d?.link?.href||d?.url,t=e?(0,l.IE)(a.A,e):null;return("link"===i.text||"image"===i.text)&&!!t},node:()=>{const e=d?.link?.href||d?.url,i=e&&(0,l.IE)(a.A,e)||"";return s.qy`<cdtr-editor-container><social-icon-suggestions
86
- .searchQuery=${i}
85
+ />`},{type:"button",text:"delete",bgColor:"#df381d",color:"#fff",icon:"deleteBin",active:!0,onClick:e=>{const i=o();if(!i)return;const s=[...t.props.items];if(s.length<2)return;const n=s.findIndex(e=>e.id===i.id);-1!==n&&(s.splice(n,1),r.execCommand("items",s))}},{type:"divider"},{type:"gallery",active:"image"===s.text,src:d?.src,hasPreview:!0,text:"open_gallery",justify:"flex-start",onChange:e=>{const i=o();if(!i)return;let s=e.detail;Array.isArray(s)&&(s=s[0]);const n=t.props,c=JSON.parse(JSON.stringify(n.items)),a=c.findIndex(e=>e.id===i.id);-1!==a&&(c[a].src=s.src,r.execCommand("items",c))}},{type:"custom",active:()=>{const e=d?.link?.href||d?.url,t=e?(0,l.IE)(a.A,e):null;return("link"===s.text||"image"===s.text)&&!!t},node:()=>{const e=d?.link?.href||d?.url,s=e&&(0,l.IE)(a.A,e)||"";return i.qy`<cdtr-editor-container><social-icon-suggestions
86
+ .searchQuery=${s}
87
87
  .iconColor=${d?.fgColor||d?.iconColor||"000000"}
88
88
  .iconSize=${parseInt(d?.style?.width,10)||34}
89
89
  .selectedSrc=${d?.src||""}
90
- @icon-selected=${e=>{const s=o();if(!s)return;const i=t.props,n=JSON.parse(JSON.stringify(i.items)),c=n.findIndex(e=>e.id===s.id);-1!==c&&(n[c].src=e.detail.src,r.execCommand("items",n))}}
91
- ></social-icon-suggestions></cdtr-editor-container>`}},{type:"divider"},{type:"linkpicker",href:d?.link||d?.url,active:()=>"link"===i.text&&!!d,onChange:e=>{const s=o();if(!s)return;const i=e.target.value,n=t.props,c=JSON.parse(JSON.stringify(n.items)),d=c.findIndex(e=>e.id===s.id);if(-1!==d){const e=c[d].fgColor||c[d].iconColor,t=function(e,t){const r=(0,l.IE)(a.A,e),o=r?a.A.find(e=>e.type===r):null,s=o?o.src:null;return s?(0,l.tG)(s,t):null}(i.href,e);t&&(c[d].src=t),c[d].url=i.href,c[d].link=i,r.execCommand("items",c)}}},{type:"slider",title:"size",active:"design"===i.text,value:parseInt(d?.style?.width),min:10,max:80,onInput:e=>{const o=e.target.value,s=[...t.props.items];s.forEach(e=>{e.style.width=o+"px",e.style.height=o+"px"}),r.execCommand("items",s)}},{type:"colorpicker",title:"icon_color",alpha:!1,active:()=>"design"===i.text&&!!d,value:d?.fgColor?d.fgColor.startsWith("#")?d.fgColor:"#"+d.fgColor:"#000000",onChange:e=>{const s=o();if(!s)return;let i=e.target.value;i=(0,m.A)(i).toHex(),i.startsWith("#")&&(i=i.slice(1)),8===i.length&&/^[0-9a-fA-F]+$/.test(i)&&(i=i.slice(0,6));const n=t.props,c=JSON.parse(JSON.stringify(n.items));if(!0===n.applyColorToAll)c.forEach(e=>{e.fgColor=i});else{const e=c.findIndex(e=>e.id===s.id);-1!==e&&(c[e].fgColor=i)}r.execCommand("items",c)}},{type:"checkbox",title:"color_them_all",checked:!!t.props.applyColorToAll,active:()=>"design"===i.text&&!!d,onChange:e=>{const t=!!e.target.checked;r.execCommand("applyColorToAll",t)}},{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 p}}}};var u=r(52144);const g=()=>({set:(e,t,r)=>{switch(t){case"style":if("object"==typeof r)return e[t]=(0,u.A)(e[t],r),!0;break;case"items":if(e[t]=r,Array.isArray(r)){const e=c(),t=r.find(t=>t.id===e?.id);t&&n(t)}return!0;case"src":const o=c();if(o&&Array.isArray(e.items)){const t=[...e.items],s=t.findIndex(e=>e.id===o.id);if(-1!==s)return t[s].src=r,e.items=t,!0}break;case"applyColorToAll":return e[t]=r,!0}}});var y=r(72591),x=r.n(y),b=r(88639),C=r.n(b),v=r(88128),A=r.n(v),k=r(30855),_=r.n(k),w=r(93051),S=r.n(w),I=r(89820),E={};E.setAttributes=_(),E.insert=A().bind(null,"head"),E.domAPI=C(),E.insertStyleElement=S();x()(I.A,E);const $=I.A&&I.A.locals?I.A.locals:void 0;var O=r(23571),T=r(91597);const L=()=>{const e="social";return{name:e,create:t=>{let{createElement:r,compose:s,helpers:i}=t;const d=(0,T.S)(),p=document.createElement("div"),h=document.createElement("div");h.classList.add($.root);new O.Ay(h,{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:o}=e,[i]=t.splice(r,1);t.splice(o,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}});p.appendChild(h);const m=r({name:e,id:s.id,template:p,draggable:{group:"element"},droppable:{group:"element"},render:()=>{const e=s.props.items;let t=!1;const r=e.map(e=>{const r=e.url||e.link?.link||"";if(!e.src&&r){const o=(0,l.IE)(a.A,r),s=o?a.A.find(e=>e.type===o):null;if(s)return t=!0,{...e,src:s.src}}return e});t&&setTimeout(()=>s.editor.store().execCommand("items",r),0);const d=t?r:e;for(;h.firstChild;)h.removeChild(h.firstChild);i.mergeDiff(h,{style:s.props.style});const p=c();d.forEach(e=>{const t=document.createElement("img");p?.id===e.id&&t.classList.add($.selected),t.addEventListener("click",()=>{n(e),Array.from(h.children).forEach(e=>{e.classList.remove($.selected)}),t.classList.add($.selected)}),t.classList.add("item"),e.id&&t.setAttribute("data-id",e.id);const r=(0,l.fm)(h);t.src=(0,l.Ff)(e,{color:e.fgColor||e.iconColor,bg:r})||"https://render.creaditor.ai/media/social-icons/broken-link-black-circle.png",i.mergeDiff(t,{style:e.style}),h.append(t)});const m=document.createElement("paper-button");m.style.minWidth="0",m.style.padding=0,m.innerHTML="<cdtr-icon icon='add'></cdtr-icon>",h.append(m),m.addEventListener("click",()=>{setTimeout(()=>{const e=s.props.items[s.props.items.length-1],t={id:(0,o.A)(),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),n(t),s.editor.store().execCommand("items",r)},200)})},handleBar:!0,defaultProps:{},validator:g(),schema:s.schema,onSelect:e=>{const t=c();if(t){const r=document.querySelector(`[data-id="${t.id}"]`);r?(window.___social_cdtr_item=r,r.classList.add("selected_underlined")):p.classList.add(e)}},onDeselect:e=>{c();window.___social_cdtr_item&&window.___social_cdtr_item.classList.remove("selected_underlined"),p?.classList?.remove(e)},elementProps:s,remove:()=>{p.remove()},createEditor:f});return m.app.on("update",()=>{d.run(()=>{const e=(0,l.fm)(h);if(!e)return;const t=h.querySelectorAll("img"),r=s.props.items;t.forEach((t,o)=>{const s=r[o];if(!s)return;const i=(0,l.Ff)(s,{color:s.fgColor||s.iconColor,bg:e});i&&(t.src=i)})})}),m}}}},89820(e,t,r){r.d(t,{A:()=>c});var o=r(82001),s=r.n(o),i=r(40935),n=r.n(i)()(s());n.push([e.id,".Z7AEJu5h_9kumGVl3K4x{\n display: flex;\n}\n.UA2xJ_pGYNrGNLfjkExO{\n border:1px solid var(--primary);\n}","",{version:3,sources:["webpack://./../newsletter-editors/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:""}]),n.locals={root:"Z7AEJu5h_9kumGVl3K4x",selected:"UA2xJ_pGYNrGNLfjkExO"};const c=n}}]);
90
+ @icon-selected=${e=>{const i=o();if(!i)return;const s=t.props,n=JSON.parse(JSON.stringify(s.items)),c=n.findIndex(e=>e.id===i.id);-1!==c&&(n[c].src=e.detail.src,r.execCommand("items",n))}}
91
+ ></social-icon-suggestions></cdtr-editor-container>`}},{type:"divider"},{type:"linkpicker",href:d?.link||d?.url,active:()=>"link"===s.text&&!!d,onChange:e=>{const i=o();if(!i)return;const s=e.target.value,n=t.props,c=JSON.parse(JSON.stringify(n.items)),d=c.findIndex(e=>e.id===i.id);if(-1!==d){const e=c[d].fgColor||c[d].iconColor,t=function(e,t){const r=(0,l.IE)(a.A,e),o=r?a.A.find(e=>e.type===r):null,i=o?o.src:null;return i?(0,l.tG)(i,t):null}(s.href,e);t&&(c[d].src=t),c[d].url=s.href,c[d].link=s,r.execCommand("items",c)}}},{type:"slider",title:"size",active:"design"===s.text,value:parseInt(d?.style?.width),min:10,max:80,onInput:e=>{const o=e.target.value,i=[...t.props.items];i.forEach(e=>{e.style.width=o+"px",e.style.height=o+"px"}),r.execCommand("items",i)}},{type:"colorpicker",title:"icon_color",alpha:!1,active:()=>"design"===s.text&&!!d,value:d?.fgColor?d.fgColor.startsWith("#")?d.fgColor:"#"+d.fgColor:"#000000",onChange:e=>{const i=o();if(!i)return;let s=e.target.value;s=(0,m.A)(s).toHex(),s.startsWith("#")&&(s=s.slice(1)),8===s.length&&/^[0-9a-fA-F]+$/.test(s)&&(s=s.slice(0,6));const n=t.props,c=JSON.parse(JSON.stringify(n.items));if(!0===n.applyColorToAll)c.forEach(e=>{e.fgColor=s});else{const e=c.findIndex(e=>e.id===i.id);-1!==e&&(c[e].fgColor=s)}r.execCommand("items",c)}},{type:"checkbox",title:"color_them_all",checked:!!t.props.applyColorToAll,active:()=>"design"===s.text&&!!d,onChange:e=>{const t=!!e.target.checked;r.execCommand("applyColorToAll",t)}},{type:"divider"},{type:"slider",title:"spacing",active:"design"===s.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 p}}}};var u=r(52144);const g=()=>({set:(e,t,r)=>{switch(t){case"style":if("object"==typeof r)return e[t]=(0,u.A)(e[t],r),!0;break;case"items":if(e[t]=r,Array.isArray(r)){const e=c(),t=r.find(t=>t.id===e?.id);t&&n(t)}return!0;case"src":const o=c();if(o&&Array.isArray(e.items)){const t=[...e.items],i=t.findIndex(e=>e.id===o.id);if(-1!==i)return t[i].src=r,e.items=t,!0}break;case"applyColorToAll":return e[t]=r,!0}}});var y=r(72591),x=r.n(y),b=r(88639),C=r.n(b),v=r(88128),A=r.n(v),k=r(30855),w=r.n(k),_=r(93051),S=r.n(_),I=r(89820),E={};E.setAttributes=w(),E.insert=A().bind(null,"head"),E.domAPI=C(),E.insertStyleElement=S();x()(I.A,E);const $=I.A&&I.A.locals?I.A.locals:void 0;var T=r(23571),O=r(91597);const L=()=>{const e="social";return{name:e,create:t=>{let{createElement:r,compose:i,helpers:s}=t;const d=(0,O.S)(),p=document.createElement("div"),h=document.createElement("div");h.classList.add($.root);new T.Ay(h,{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:r,newIndex:o}=e,[s]=t.splice(r,1);t.splice(o,0,s),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}});p.appendChild(h);const m=r({name:e,id:i.id,template:p,draggable:{group:"element"},droppable:{group:"element"},render:()=>{const e=i.props.items;let t=!1;const r=e.map(e=>{const r=e.url||e.link?.link||"";if(!e.src&&r){const o=(0,l.IE)(a.A,r),i=o?a.A.find(e=>e.type===o):null;if(i)return t=!0,{...e,src:i.src}}return e});t&&setTimeout(()=>i.editor.store().execCommand("items",r),0);const d=t?r:e;for(;h.firstChild;)h.removeChild(h.firstChild);s.mergeDiff(h,{style:i.props.style});const p=c();d.forEach(e=>{const t=document.createElement("img");p?.id===e.id&&t.classList.add($.selected),t.addEventListener("click",()=>{n(e),Array.from(h.children).forEach(e=>{e.classList.remove($.selected)}),t.classList.add($.selected)}),t.classList.add("item"),e.id&&t.setAttribute("data-id",e.id);const r=(0,l.fm)(h);t.src=(0,l.Ff)(e,{color:e.fgColor||e.iconColor,bg:r})||"https://render.creaditor.ai/media/social-icons/broken-link-black-circle.png",s.mergeDiff(t,{style:e.style}),h.append(t)});const m=document.createElement("paper-button");m.style.cssText=["min-width:0","padding:0","margin:0 4px","width:28px","height:28px","border-radius:50%","display:inline-flex","align-items:center","justify-content:center","vertical-align:middle","flex:none","background:#fff","color:#1f1b1d","border:1px solid rgba(0,0,0,.18)","box-shadow:0 1px 3px rgba(0,0,0,.28)"].join(";"),m.innerHTML="<cdtr-icon icon='add' width='18' height='18'></cdtr-icon>",h.append(m),m.addEventListener("click",()=>{setTimeout(()=>{const e=i.props.items[i.props.items.length-1],t={id:(0,o.A)(),fgColor:"",bgColor:"",style:e.style,url:"",src:"https://render.creaditor.ai/media/social-icons/broken-link-black-circle.png"},r=[...i.props.items];r.push(t),n(t),i.editor.store().execCommand("items",r)},200)})},handleBar:!0,defaultProps:{},validator:g(),schema:i.schema,onSelect:e=>{const t=c();if(t){const r=document.querySelector(`[data-id="${t.id}"]`);r?(window.___social_cdtr_item=r,r.classList.add("selected_underlined")):p.classList.add(e)}},onDeselect:e=>{c();window.___social_cdtr_item&&window.___social_cdtr_item.classList.remove("selected_underlined"),p?.classList?.remove(e)},elementProps:i,remove:()=>{p.remove()},createEditor:f});return m.app.on("update",()=>{d.run(()=>{const e=(0,l.fm)(h);if(!e)return;const t=h.querySelectorAll("img"),r=i.props.items;t.forEach((t,o)=>{const i=r[o];if(!i)return;const s=(0,l.Ff)(i,{color:i.fgColor||i.iconColor,bg:e});s&&(t.src=s)})})}),m}}}},89820(e,t,r){r.d(t,{A:()=>c});var o=r(82001),i=r.n(o),s=r(40935),n=r.n(s)()(i());n.push([e.id,".Z7AEJu5h_9kumGVl3K4x{\n display: flex;\n}\n.UA2xJ_pGYNrGNLfjkExO{\n border:1px solid var(--primary);\n}","",{version:3,sources:["webpack://./../newsletter-editors/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:""}]),n.locals={root:"Z7AEJu5h_9kumGVl3K4x",selected:"UA2xJ_pGYNrGNLfjkExO"};const c=n}}]);
Binary file
@@ -1,4 +1,4 @@
1
- "use strict";(("undefined"!=typeof self?self:this).webpackChunkCreaditor=("undefined"!=typeof self?self:this).webpackChunkCreaditor||[]).push([[5926],{83545(t,e,n){n.r(e),n.d(e,{EditorTabs:()=>l});var o=n(59929),s=n(54804),i=n(86319),a=n(40648);n.e(7937).then(n.bind(n,67937));const r="cdtr-editor-tabs-hint-seen";class l extends o.WF{constructor(){super(),this.onConnected=this.onConnected.bind(this),this.onArrowNavigation=this.onArrowNavigation.bind(this),this.dismissHint=this.dismissHint.bind(this),this.scheduleSync=this.scheduleSync.bind(this),this.observeContent=this.observeContent.bind(this),this.toggleAllSections=this.toggleAllSections.bind(this),this.tabs=[],this.showHint=!1,this._sectionCount=0,this._allExpanded=!1}sectionElements(){const t=this.shadowRoot?.querySelector('slot[name="content"]');if(!t)return[];const e=[];for(const n of t.assignedElements({flatten:!0})){"CDTR-EDITOR-SECTION"===n.tagName&&e.push(n);for(const t of n.children)"CDTR-EDITOR-SECTION"===t.tagName&&e.push(t)}return e}syncSections(){const t=this.sectionElements();this._sectionCount=t.length,this._allExpanded=t.length>0&&t.every(t=>t.open)}observeContent(){this._contentObserver||(this._contentObserver=new MutationObserver(this.scheduleSync)),this._contentObserver.disconnect();const t=this.shadowRoot?.querySelector('slot[name="content"]');if(t){for(const e of t.assignedElements({flatten:!0}))this._contentObserver.observe(e,{childList:!0});this.scheduleSync()}}scheduleSync(){this._syncPending||(this._syncPending=!0,setTimeout(()=>{this._syncPending=!1,this.isConnected&&this.syncSections()},0))}toggleAllSections(){const t=!this._allExpanded;for(const e of this.sectionElements())e.open=t,(0,a.Q)(e.persistKey,t);this._allExpanded=t}hintAlreadySeen(){try{return"1"===localStorage.getItem(r)}catch(t){return!0}}dismissHint(){this.showHint=!1;try{localStorage.setItem(r,"1")}catch(t){}}onClickItem(t){let{target:e}=t;const n=this.value=e.value,o=[...this.tabs],s=o.findIndex(t=>t.text===n);-1!==s&&(o.forEach(t=>{t.selected=!1}),o[s].selected=!0),this.tabs=o,this.scheduleSync(),this.showHint&&this.dismissHint();const i=new UIEvent("tabChanged",{view:window,bubbles:!0,cancelable:!0});this.dispatchEvent(i)}firstUpdated(){super.firstUpdated()}maybeShowHint(){this._hintChecked||this.tabs.length<=1||this.hintAlreadySeen()||(this._hintChecked=!0,setTimeout(()=>{this.isConnected&&!this.hintAlreadySeen()&&(this.showHint=!0)},700))}updated(){this.setAttribute("data-active-tab",this.value||""),this.maybeShowHint(),this.observeContent()}onConnected(t){let{name:e}=t;this.onClickItem({target:{value:e}})}onArrowNavigation(t){const{key:e,currentIcon:n}=t.detail,o=this.tabs.findIndex(t=>t.text===n);if(-1===o)return;let s=o;switch(e){case"ArrowUp":case"ArrowLeft":s=o>0?o-1:this.tabs.length-1;break;case"ArrowDown":case"ArrowRight":s=o<this.tabs.length-1?o+1:0;break;default:return}const i=this.tabs[s];i&&(this.onClickItem({target:{value:i.text}}),this.updateComplete.then(()=>{const t=this.shadowRoot.querySelector(`cdtr-editor-tab-item[icon="${i.text}"]`);t&&t.focus()}))}connectedCallback(){super.connectedCallback(),s.Ay.on("editor-tabs",this.onConnected),s.Ay.on("update",this.scheduleSync),s.Ay.on("select",this.scheduleSync)}disconnectedCallback(){super.disconnectedCallback(),s.Ay.off("editor-tabs",this.onConnected),s.Ay.off("update",this.scheduleSync),s.Ay.off("select",this.scheduleSync),this._contentObserver?.disconnect()}renderContent(){switch(this.value){case"animations":return n.e(3553).then(n.bind(n,3553)),o.qy`<cdtr-animations-editor>
1
+ "use strict";(("undefined"!=typeof self?self:this).webpackChunkCreaditor=("undefined"!=typeof self?self:this).webpackChunkCreaditor||[]).push([[5926],{83545(t,e,n){n.r(e),n.d(e,{EditorTabs:()=>l});var o=n(59929),s=n(54804),i=n(86319),a=n(40648);Promise.resolve().then(n.bind(n,67937));const r="cdtr-editor-tabs-hint-seen";class l extends o.WF{constructor(){super(),this.onConnected=this.onConnected.bind(this),this.onArrowNavigation=this.onArrowNavigation.bind(this),this.dismissHint=this.dismissHint.bind(this),this.scheduleSync=this.scheduleSync.bind(this),this.observeContent=this.observeContent.bind(this),this.toggleAllSections=this.toggleAllSections.bind(this),this.tabs=[],this.showHint=!1,this._sectionCount=0,this._allExpanded=!1}sectionElements(){const t=this.shadowRoot?.querySelector('slot[name="content"]');if(!t)return[];const e=[];for(const n of t.assignedElements({flatten:!0})){"CDTR-EDITOR-SECTION"===n.tagName&&e.push(n);for(const t of n.children)"CDTR-EDITOR-SECTION"===t.tagName&&e.push(t)}return e}syncSections(){const t=this.sectionElements();this._sectionCount=t.length,this._allExpanded=t.length>0&&t.every(t=>t.open)}observeContent(){this._contentObserver||(this._contentObserver=new MutationObserver(this.scheduleSync)),this._contentObserver.disconnect();const t=this.shadowRoot?.querySelector('slot[name="content"]');if(t){for(const e of t.assignedElements({flatten:!0}))this._contentObserver.observe(e,{childList:!0});this.scheduleSync()}}scheduleSync(){this._syncPending||(this._syncPending=!0,setTimeout(()=>{this._syncPending=!1,this.isConnected&&this.syncSections()},0))}toggleAllSections(){const t=!this._allExpanded;for(const e of this.sectionElements())e.open=t,(0,a.Q)(e.persistKey,t);this._allExpanded=t}hintAlreadySeen(){try{return"1"===localStorage.getItem(r)}catch(t){return!0}}dismissHint(){this.showHint=!1;try{localStorage.setItem(r,"1")}catch(t){}}onClickItem(t){let{target:e}=t;const n=this.value=e.value,o=[...this.tabs],s=o.findIndex(t=>t.text===n);-1!==s&&(o.forEach(t=>{t.selected=!1}),o[s].selected=!0),this.tabs=o,this.scheduleSync(),this.showHint&&this.dismissHint();const i=new UIEvent("tabChanged",{view:window,bubbles:!0,cancelable:!0});this.dispatchEvent(i)}firstUpdated(){super.firstUpdated()}maybeShowHint(){this._hintChecked||this.tabs.length<=1||this.hintAlreadySeen()||(this._hintChecked=!0,setTimeout(()=>{this.isConnected&&!this.hintAlreadySeen()&&(this.showHint=!0)},700))}updated(){this.setAttribute("data-active-tab",this.value||""),this.maybeShowHint(),this.observeContent()}onConnected(t){let{name:e}=t;this.onClickItem({target:{value:e}})}onArrowNavigation(t){const{key:e,currentIcon:n}=t.detail,o=this.tabs.findIndex(t=>t.text===n);if(-1===o)return;let s=o;switch(e){case"ArrowUp":case"ArrowLeft":s=o>0?o-1:this.tabs.length-1;break;case"ArrowDown":case"ArrowRight":s=o<this.tabs.length-1?o+1:0;break;default:return}const i=this.tabs[s];i&&(this.onClickItem({target:{value:i.text}}),this.updateComplete.then(()=>{const t=this.shadowRoot.querySelector(`cdtr-editor-tab-item[icon="${i.text}"]`);t&&t.focus()}))}connectedCallback(){super.connectedCallback(),s.Ay.on("editor-tabs",this.onConnected),s.Ay.on("update",this.scheduleSync),s.Ay.on("select",this.scheduleSync)}disconnectedCallback(){super.disconnectedCallback(),s.Ay.off("editor-tabs",this.onConnected),s.Ay.off("update",this.scheduleSync),s.Ay.off("select",this.scheduleSync),this._contentObserver?.disconnect()}renderContent(){switch(this.value){case"animations":return n.e(3553).then(n.bind(n,3553)),o.qy`<cdtr-animations-editor>
2
2
  <cdtr-block-loader></cdtr-block-loader
3
3
  ></cdtr-animations-editor>`;case"settings":case"setting":return n.e(7654).then(n.bind(n,37654)),o.qy`<cdtr-setting-editor>
4
4
  <cdtr-block-loader></cdtr-block-loader
Binary file