@creaditor/web-starterkit 1.0.68 → 1.0.70
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
"use strict";(("undefined"!=typeof self?self:this).webpackChunkCreaditor=("undefined"!=typeof self?self:this).webpackChunkCreaditor||[]).push([[6182],{96182(e,t,i){i.d(t,{default:()=>V});var o=i(59929);let n={};const s=new Set;function r(e){n.selected=e}function a(e){return n.selected}var d=i(23571),l=i(12106),c=i(43180),p=i(38206),h=i(19305);const u="https://img.creaditor.ai";function
|
|
1
|
+
"use strict";(("undefined"!=typeof self?self:this).webpackChunkCreaditor=("undefined"!=typeof self?self:this).webpackChunkCreaditor||[]).push([[6182],{96182(e,t,i){i.d(t,{default:()=>V});var o=i(59929);let n={};const s=new Set;function r(e){n.selected=e}function a(e){return n.selected}var d=i(23571),l=i(12106),c=i(43180),p=i(38206),h=i(19305);const u="https://img.creaditor.ai";function m(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const i=t.width??24,o=t.height??24;let n=t.color??"000000";n.startsWith("#")&&(n=n.slice(1));const s=`${u}/icons/serve/${encodeURIComponent(e.category)}/${encodeURIComponent(e.name)}.png?width=${i}&height=${o}`;return(0,h.tG)(s,n)}class f extends o.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"}),i=await fetch(`${u}/icons/search?${t.toString()}`);if(!i.ok)throw new Error(i.statusText);const o=await i.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(/^#/,""),i=Number(this.iconSize)||34,o=m(e,{width:i,height:i,color:t});this.dispatchEvent(new CustomEvent("icon-selected",{detail:{src:o,icon:e},bubbles:!0,composed:!0}))}render(){const e=(this.iconColor||"000000").replace(/^#/,""),t=this.searchQuery?.trim()&&!this._loading?this._icons:[];return o.qy`
|
|
2
2
|
${this._loading?o.qy`<div class="loading"><span class="spinner"></span>Loading icons…</div>`:null}
|
|
3
3
|
${this._error?o.qy`<div class="error">${this._error}</div>`:null}
|
|
4
4
|
<div class="grid">
|
|
5
|
-
${t.map(t=>{const i=
|
|
5
|
+
${t.map(t=>{const i=m(t,{width:24,height:24,color:e}),n=this.selectedSrc&&(this.selectedSrc.includes(t.name)||this.selectedSrc===i);return o.qy`
|
|
6
6
|
<button
|
|
7
7
|
type="button"
|
|
8
8
|
class="icon-wrap ${n?"selected":""}"
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
`})}
|
|
15
15
|
<slot></slot>
|
|
16
16
|
</div>
|
|
17
|
-
`}}
|
|
17
|
+
`}}f.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}},f.styles=o.AH`
|
|
18
18
|
:host {
|
|
19
19
|
display: block;
|
|
20
20
|
font-size: 12px;
|
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
.error {
|
|
81
81
|
color: var(--error-color, #c00);
|
|
82
82
|
}
|
|
83
|
-
`,customElements.define("social-icon-suggestions",
|
|
83
|
+
`,customElements.define("social-icon-suggestions",f);const g=o.AH`
|
|
84
84
|
:host {
|
|
85
85
|
display: grid;
|
|
86
86
|
grid-template-columns: minmax(0, 1fr);
|
|
@@ -345,4 +345,4 @@
|
|
|
345
345
|
.items=${t.props.items}
|
|
346
346
|
@items-change=${e=>i.execCommand("items",e.detail)}
|
|
347
347
|
></cdtr-social-icons-editor>
|
|
348
|
-
</cdtr-editor-container>`},{type:"slider",title:"size",active:"design"===s.text,value:parseInt(r?.style?.width),min:10,max:80,onInput:e=>{const o=e.target.value,n=[...t.props.items];n.forEach(e=>{e.style.width=o+"px",e.style.height=o+"px"}),i.execCommand("items",n)}},{type:"colorpicker",title:"icon_color",alpha:!1,active:()=>"design"===s.text&&!!r,value:r?.fgColor?r.fgColor.startsWith("#")?r.fgColor:"#"+r.fgColor:"#000000",onChange:e=>{const o=n();if(!o)return;let s=e.target.value;s=(0,$.A)(s).toHex(),s.startsWith("#")&&(s=s.slice(1)),8===s.length&&/^[0-9a-fA-F]+$/.test(s)&&(s=s.slice(0,6));const r=t.props,a=JSON.parse(JSON.stringify(r.items));if(!0===r.applyColorToAll)a.forEach(e=>{e.fgColor=s});else{const e=a.findIndex(e=>e.id===o.id);-1!==e&&(a[e].fgColor=s)}i.execCommand("items",a)}},{type:"checkbox",title:"color_them_all",checked:!!t.props.applyColorToAll,active:()=>"design"===s.text&&!!r,onChange:e=>{const t=!!e.target.checked;i.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;i.execCommand("style",{gap:t+"px"})}}];return a}}}};var S=i(69893);const E=()=>({set:(e,t,i)=>{switch(t){case"style":if("object"==typeof i)return e[t]=(0,S.A)(e[t],i),!0;break;case"items":if(e[t]=i,Array.isArray(i)){const e=a(),t=i.find(t=>t.id===e?.id);t&&r(t)}return!0;case"src":const o=a();if(o&&Array.isArray(e.items)){const t=[...e.items],n=t.findIndex(e=>e.id===o.id);if(-1!==n)return t[n].src=i,e.items=t,!0}break;case"applyColorToAll":return e[t]=i,!0}}});var L=i(72591),q=i.n(L),T=i(88639),W=i.n(T),F=i(88128),U=i.n(F),Q=i(30855),R=i.n(Q),N=i(93051),z=i.n(N),j=i(91041),D={};D.setAttributes=R(),D.insert=U().bind(null,"head"),D.domAPI=W(),D.insertStyleElement=z();q()(j.A,D);const J=j.A&&j.A.locals?j.A.locals:void 0;var P=i(18750);const V=()=>{const e="social";return{name:e,create:t=>{let{createElement:i,compose:o,helpers:l}=t;const c=(0,P.S)(),p=document.createElement("div"),u=document.createElement("div");u.classList.add(J.root);new d.Ay(u,{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(o.props.items)),{oldIndex:i,newIndex:n}=e,[s]=t.splice(i,1);t.splice(n,0,s),o.editor.store().
|
|
348
|
+
</cdtr-editor-container>`},{type:"slider",title:"size",active:"design"===s.text,value:parseInt(r?.style?.width),min:10,max:80,onInput:e=>{const o=e.target.value,n=[...t.props.items];n.forEach(e=>{e.style.width=o+"px",e.style.height=o+"px"}),i.execCommand("items",n)}},{type:"colorpicker",title:"icon_color",alpha:!1,active:()=>"design"===s.text&&!!r,value:r?.fgColor?r.fgColor.startsWith("#")?r.fgColor:"#"+r.fgColor:"#000000",onChange:e=>{const o=n();if(!o)return;let s=e.target.value;s=(0,$.A)(s).toHex(),s.startsWith("#")&&(s=s.slice(1)),8===s.length&&/^[0-9a-fA-F]+$/.test(s)&&(s=s.slice(0,6));const r=t.props,a=JSON.parse(JSON.stringify(r.items));if(!0===r.applyColorToAll)a.forEach(e=>{e.fgColor=s});else{const e=a.findIndex(e=>e.id===o.id);-1!==e&&(a[e].fgColor=s)}i.execCommand("items",a)}},{type:"checkbox",title:"color_them_all",checked:!!t.props.applyColorToAll,active:()=>"design"===s.text&&!!r,onChange:e=>{const t=!!e.target.checked;i.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;i.execCommand("style",{gap:t+"px"})}}];return a}}}};var S=i(69893);const E=()=>({set:(e,t,i)=>{switch(t){case"style":if("object"==typeof i)return e[t]=(0,S.A)(e[t],i),!0;break;case"items":if(e[t]=i,Array.isArray(i)){const e=a(),t=i.find(t=>t.id===e?.id);t&&r(t)}return!0;case"src":const o=a();if(o&&Array.isArray(e.items)){const t=[...e.items],n=t.findIndex(e=>e.id===o.id);if(-1!==n)return t[n].src=i,e.items=t,!0}break;case"applyColorToAll":return e[t]=i,!0}}});var L=i(72591),q=i.n(L),T=i(88639),W=i.n(T),F=i(88128),U=i.n(F),Q=i(30855),R=i.n(Q),N=i(93051),z=i.n(N),j=i(91041),D={};D.setAttributes=R(),D.insert=U().bind(null,"head"),D.domAPI=W(),D.insertStyleElement=z();q()(j.A,D);const J=j.A&&j.A.locals?j.A.locals:void 0;var P=i(18750);const V=()=>{const e="social";return{name:e,create:t=>{let{createElement:i,compose:o,helpers:l}=t;const c=(0,P.S)(),p=document.createElement("div"),u=document.createElement("div");u.classList.add(J.root);new d.Ay(u,{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(o.props.items)),{oldIndex:i,newIndex:n}=e,[s]=t.splice(i,1);t.splice(n,0,s),o.editor.store().execCommands({componentId:o.id,key:"items",value:t})},onMove:function(e,t){e.dragged,e.draggedRect,e.related,e.relatedRect,e.willInsertAfter,t.clientY},onChange:function(e){e.newIndex}});p.appendChild(u);const m=i({name:e,id:o.id,template:p,draggable:{group:"element"},droppable:{group:"element"},render:()=>{const e=o.props.items;let t=!1;const i=e.map(e=>{const i=e.url||e.link?.link||"";return!e.src&&i?(t=!0,{...e,src:(0,h.Vv)(i)}):e});t&&setTimeout(()=>o.editor.store().execCommands({componentId:o.id,key:"items",value:i}),0);const d=t?i:e;for(;u.firstChild;)u.removeChild(u.firstChild);l.mergeDiff(u,{style:o.props.style});const c=a();d.forEach(e=>{const t=document.createElement("img");c?.id===e.id&&t.classList.add(J.selected),t.addEventListener("click",()=>{r(e),Array.from(u.children).forEach(e=>{e.classList.remove(J.selected)}),t.classList.add(J.selected)}),t.classList.add("item"),e.id&&t.setAttribute("data-id",e.id);const i=(0,h.fm)(u);t.src=(0,h.Ff)(e,{color:e.fgColor||e.iconColor,bg:i})||h.Ww,l.mergeDiff(t,{style:e.style}),u.append(t)});const p=document.createElement("paper-button");p.classList.add(J.add),p.innerHTML="<cdtr-icon icon='add' width='18' height='18'></cdtr-icon>",u.append(p),p.addEventListener("click",()=>(n.addPending=!0,void s.forEach(e=>e())))},handleBar:!0,defaultProps:{},validator:E(),schema:o.schema,onSelect:e=>{p.classList.add(J.selectedRow);const t=a();if(t){const i=document.querySelector(`[data-id="${t.id}"]`);i?(window.___social_cdtr_item=i,i.classList.add("selected_underlined")):p.classList.add(e)}},onDeselect:e=>{a();window.___social_cdtr_item&&window.___social_cdtr_item.classList.remove("selected_underlined"),p?.classList?.remove(e,J.selectedRow)},elementProps:o,remove:()=>{p.remove()},createEditor:B});return m.app.on("update",()=>{c.run(()=>{const e=(0,h.fm)(u);if(!e)return;const t=u.querySelectorAll("img"),i=o.props.items;t.forEach((t,o)=>{const n=i[o];if(!n)return;const s=(0,h.Ff)(n,{color:n.fgColor||n.iconColor,bg:e});s&&(t.src=s)})})}),m}}}},91041(e,t,i){i.d(t,{A:()=>a});var o=i(82001),n=i.n(o),s=i(40935),r=i.n(s)()(n());r.push([e.id,'.Z7AEJu5h_9kumGVl3K4x{\n display: flex;\n position: relative;\n --add-gap: 6px;\n}\n.UA2xJ_pGYNrGNLfjkExO{\n border:1px solid var(--primary);\n}\n/* A white disc with a dark plus, a hairline border and a soft shadow: it reads\n on any background. It sits just past the row, outside it, so the icons are\n centred as they are in the sent email, and shows only on hover or selection. */\n.D_WaIFoLxhQQCNkeIkoP{\n position: absolute;\n left: 100%;\n top: 50%;\n transform: translateY(-50%);\n min-width: 0;\n padding: 0;\n margin-left: var(--add-gap);\n width: 28px;\n height: 28px;\n border-radius: 50%;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n background: #fff;\n color: #1f1b1d;\n border: 1px solid rgba(0,0,0,.18);\n box-shadow: 0 1px 3px rgba(0,0,0,.28);\n visibility: hidden;\n /* hide a beat late, so moving from the icons to the + doesn\'t lose it */\n transition: visibility 0s .3s;\n}\n/* covers the gap between the row and the +, so the row stays hovered on the way */\n.Z7AEJu5h_9kumGVl3K4x::after{\n content: "";\n position: absolute;\n left: 100%;\n top: 0;\n bottom: 0;\n width: var(--add-gap);\n}\n.Z7AEJu5h_9kumGVl3K4x:hover .D_WaIFoLxhQQCNkeIkoP,\n.hrRqnAUtaz06LTBYL5Pp .D_WaIFoLxhQQCNkeIkoP{\n visibility: visible;\n transition-delay: 0s;\n}\n',"",{version:3,sources:["webpack://./../newsletter-editors/social-editor-component-newsletter/lib/style.module.css"],names:[],mappings:"AAAA;IACI,aAAa;IACb,kBAAkB;IAClB,cAAc;AAClB;AACA;IACI,+BAA+B;AACnC;AACA;;iFAEiF;AACjF;IACI,kBAAkB;IAClB,UAAU;IACV,QAAQ;IACR,2BAA2B;IAC3B,YAAY;IACZ,UAAU;IACV,2BAA2B;IAC3B,WAAW;IACX,YAAY;IACZ,kBAAkB;IAClB,oBAAoB;IACpB,mBAAmB;IACnB,uBAAuB;IACvB,gBAAgB;IAChB,cAAc;IACd,iCAAiC;IACjC,qCAAqC;IACrC,kBAAkB;IAClB,wEAAwE;IACxE,6BAA6B;AACjC;AACA,kFAAkF;AAClF;IACI,WAAW;IACX,kBAAkB;IAClB,UAAU;IACV,MAAM;IACN,SAAS;IACT,qBAAqB;AACzB;AACA;;IAEI,mBAAmB;IACnB,oBAAoB;AACxB",sourcesContent:['.root{\n display: flex;\n position: relative;\n --add-gap: 6px;\n}\n.selected{\n border:1px solid var(--primary);\n}\n/* A white disc with a dark plus, a hairline border and a soft shadow: it reads\n on any background. It sits just past the row, outside it, so the icons are\n centred as they are in the sent email, and shows only on hover or selection. */\n.add{\n position: absolute;\n left: 100%;\n top: 50%;\n transform: translateY(-50%);\n min-width: 0;\n padding: 0;\n margin-left: var(--add-gap);\n width: 28px;\n height: 28px;\n border-radius: 50%;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n background: #fff;\n color: #1f1b1d;\n border: 1px solid rgba(0,0,0,.18);\n box-shadow: 0 1px 3px rgba(0,0,0,.28);\n visibility: hidden;\n /* hide a beat late, so moving from the icons to the + doesn\'t lose it */\n transition: visibility 0s .3s;\n}\n/* covers the gap between the row and the +, so the row stays hovered on the way */\n.root::after{\n content: "";\n position: absolute;\n left: 100%;\n top: 0;\n bottom: 0;\n width: var(--add-gap);\n}\n.root:hover .add,\n.selectedRow .add{\n visibility: visible;\n transition-delay: 0s;\n}\n'],sourceRoot:""}]),r.locals={root:"Z7AEJu5h_9kumGVl3K4x",selected:"UA2xJ_pGYNrGNLfjkExO",add:"D_WaIFoLxhQQCNkeIkoP",selectedRow:"hrRqnAUtaz06LTBYL5Pp"};const a=r}}]);
|
|
Binary file
|