@creaditor/web-starterkit 1.0.44 → 1.0.45
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/1271.creaditor.bundle.js +1 -1
- package/dist/1271.creaditor.bundle.js.gz +0 -0
- package/dist/2655.creaditor.bundle.js +54 -53
- package/dist/2655.creaditor.bundle.js.gz +0 -0
- package/dist/6151.creaditor.bundle.js +1 -0
- package/dist/6151.creaditor.bundle.js.gz +0 -0
- package/dist/7209.creaditor.bundle.js +5 -5
- package/dist/7209.creaditor.bundle.js.gz +0 -0
- package/dist/8547.creaditor.bundle.js +32 -32
- package/dist/8547.creaditor.bundle.js.gz +0 -0
- package/dist/9535.creaditor.bundle.js +171 -0
- package/dist/9535.creaditor.bundle.js.gz +0 -0
- package/dist/creaditor.bundle.js +1075 -491
- package/dist/creaditor.bundle.js.gz +0 -0
- package/dist/service-worker.js +1 -1
- package/dist/service-worker.js.gz +0 -0
- package/package.json +1 -1
- package/dist/4987.creaditor.bundle.js +0 -171
- package/dist/4987.creaditor.bundle.js.gz +0 -0
- package/dist/7918.creaditor.bundle.js +0 -1
- package/dist/7918.creaditor.bundle.js.gz +0 -0
- /package/dist/{4987.creaditor.bundle.js.LICENSE.txt → 9535.creaditor.bundle.js.LICENSE.txt} +0 -0
- /package/dist/{4987.creaditor.bundle.js.LICENSE.txt.gz → 9535.creaditor.bundle.js.LICENSE.txt.gz} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";(("undefined"!=typeof self?self:this).webpackChunkCreaditor=("undefined"!=typeof self?self:this).webpackChunkCreaditor||[]).push([[2384,8547],{58691(t,e,a){a.r(e),a.d(e,{ImagePromptEditor:()=>l});var r,o,
|
|
1
|
+
"use strict";(("undefined"!=typeof self?self:this).webpackChunkCreaditor=("undefined"!=typeof self?self:this).webpackChunkCreaditor||[]).push([[2384,8547],{58691(t,e,a){a.r(e),a.d(e,{ImagePromptEditor:()=>l});var r,o,s=a(59929),i=a(49410);const n=new Set;let l=(0,i.EM)("cdtr-image-prompt-editor")(((o=class extends s.WF{constructor(){super(),this.prompt="",this.generatedImage="",this.isLoading=!1,this.addEventListener("keydown",this._handleKeyDown.bind(this))}_handleKeyDown(t){"Enter"===t.key&&t.ctrlKey&&this._submitPrompt()}_handlePromptChange(t){this.prompt=t.target.value}_submitPrompt(){this.prompt.trim()&&!this.isLoading&&(this.isLoading=!0,this.dispatchEvent(new CustomEvent("generate-image",{detail:{prompt:this.prompt,options:{size:"1024x1024",quality:"standard",style:"natural"}}})))}_handleInsertImage(){const t=(e=this.generatedImage).length<100?e:e.slice(0,50)+e.slice(-50);var e;n.has(t)||(n.add(t),this.dispatchEvent(new CustomEvent("insert-image",{detail:{imageUrl:this.generatedImage}})))}setGeneratedImage(t){this.isLoading=!1,this.generatedImage=t,this.requestUpdate()}copyToClipboard(){navigator.clipboard.writeText(this.generatedImage),window.snackbar&&window.snackbar({message:"copied_to_clipboard",type:"success"})}render(){return s.qy`
|
|
2
2
|
<div class="container">
|
|
3
3
|
<h6>
|
|
4
4
|
<lang-text
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
text="image_prompt_editor_description"
|
|
7
7
|
></lang-text>
|
|
8
8
|
</h6>
|
|
9
|
-
${this.generatedImage?
|
|
9
|
+
${this.generatedImage?s.qy`
|
|
10
10
|
<cdtr-input
|
|
11
11
|
@click="${this.copyToClipboard}"
|
|
12
12
|
fullWidth
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
/>
|
|
21
21
|
</div>
|
|
22
22
|
`:null}
|
|
23
|
-
${this.generatedImage?
|
|
23
|
+
${this.generatedImage?s.qy`
|
|
24
24
|
<paper-button
|
|
25
25
|
class="insert-button"
|
|
26
26
|
@click="${this._handleInsertImage}"
|
|
@@ -43,8 +43,8 @@
|
|
|
43
43
|
?disabled="${!this.prompt.trim()||this.isLoading}"
|
|
44
44
|
@click="${this._submitPrompt}"
|
|
45
45
|
>
|
|
46
|
-
${this.isLoading?
|
|
47
|
-
<lang-text text="generating"></lang-text>`:
|
|
46
|
+
${this.isLoading?s.qy`<div class="spinner"></div>
|
|
47
|
+
<lang-text text="generating"></lang-text>`:s.qy`<lang-text text="generate_image"></lang-text>`}
|
|
48
48
|
</paper-button>
|
|
49
49
|
|
|
50
50
|
<div class="loading ${this.isLoading?"active":""}">
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
</div>
|
|
54
54
|
</div>
|
|
55
55
|
</div>
|
|
56
|
-
`}}).properties={prompt:{type:String},generatedImage:{type:String},isLoading:{type:Boolean}},o.styles=
|
|
56
|
+
`}}).properties={prompt:{type:String},generatedImage:{type:String},isLoading:{type:Boolean}},o.styles=s.AH`
|
|
57
57
|
* {
|
|
58
58
|
box-sizing: border-box;
|
|
59
59
|
}
|
|
@@ -169,7 +169,7 @@
|
|
|
169
169
|
margin-bottom: 0.5rem;
|
|
170
170
|
color: #495057;
|
|
171
171
|
}
|
|
172
|
-
`,r=o))||r},15155(t,e,a){a.d(e,{A:()=>
|
|
172
|
+
`,r=o))||r},15155(t,e,a){a.d(e,{A:()=>i});var r=a(59929),o=a(57176);class s extends r.WF{constructor(){super(),this.items=[],this.columns=2}async openPicker(t){const e=this.shadowRoot.querySelector(`#picker-${t}`);if(!e)return;await e.updateComplete;const a=e.shadowRoot?.querySelector("color-playground");if(a)if(await a.updateComplete,"function"==typeof a.openColorpicker)a.openColorpicker();else{(a.shadowRoot?.querySelector('[role="button"]')||a.shadowRoot?.querySelector("div")||a).click()}}render(){const t=1===this.columns?"grid single-col":"grid";return r.qy`
|
|
173
173
|
<div class="${t}">
|
|
174
174
|
${(this.items||[]).map((t,e)=>r.qy`
|
|
175
175
|
<div class="swatch-item" @click=${()=>this.openPicker(e)}>
|
|
@@ -193,7 +193,7 @@
|
|
|
193
193
|
</div>
|
|
194
194
|
`)}
|
|
195
195
|
</div>
|
|
196
|
-
`}}
|
|
196
|
+
`}}s.styles=[o.L,r.AH`
|
|
197
197
|
:host {
|
|
198
198
|
display: block;
|
|
199
199
|
direction: var(--direction-locale, ltr);
|
|
@@ -241,12 +241,12 @@
|
|
|
241
241
|
clip: rect(0,0,0,0);
|
|
242
242
|
pointer-events: none;
|
|
243
243
|
}
|
|
244
|
-
`],
|
|
244
|
+
`],s.properties={items:{type:Array},columns:{type:Number}},customElements.define("cdtr-color-swatch-group",s);const i=t=>r.qy`
|
|
245
245
|
<cdtr-color-swatch-group
|
|
246
246
|
.items=${t.items}
|
|
247
247
|
.columns=${t.columns||2}
|
|
248
248
|
></cdtr-color-swatch-group>
|
|
249
|
-
`},12258(t,e,a){a.d(e,{A:()=>
|
|
249
|
+
`},12258(t,e,a){a.d(e,{A:()=>i});var r=a(59929),o=a(40648);class s extends r.WF{constructor(){super(),this.label="",this.open=!0,this.persistKey=""}toggle(){this.open=!this.open,(0,o.Q)(this.persistKey,this.open)}render(){return r.qy`
|
|
250
250
|
<div class="section">
|
|
251
251
|
<div class="header" @click=${this.toggle}>
|
|
252
252
|
<span class="title"><lang-text text="${this.label}"></lang-text></span>
|
|
@@ -260,7 +260,7 @@
|
|
|
260
260
|
</div>
|
|
261
261
|
</div>
|
|
262
262
|
</div>
|
|
263
|
-
`}}
|
|
263
|
+
`}}s.styles=r.AH`
|
|
264
264
|
:host {
|
|
265
265
|
display: block;
|
|
266
266
|
direction: var(--direction-locale, ltr);
|
|
@@ -331,7 +331,7 @@
|
|
|
331
331
|
/* Light on top: the controls inside bring their own leading pad. */
|
|
332
332
|
padding: var(--space-1) var(--space-4) var(--space-3) var(--space-4);
|
|
333
333
|
}
|
|
334
|
-
`,
|
|
334
|
+
`,s.properties={label:{type:String,reflect:!0,attribute:"data-label"},open:{type:Boolean,reflect:!0},persistKey:{type:String}},customElements.define("cdtr-editor-section",s);const i=(t,e)=>r.qy`
|
|
335
335
|
<cdtr-editor-section
|
|
336
336
|
.label=${t.label}
|
|
337
337
|
.open=${!1!==t.open}
|
|
@@ -339,7 +339,7 @@
|
|
|
339
339
|
>
|
|
340
340
|
${e}
|
|
341
341
|
</cdtr-editor-section>
|
|
342
|
-
`},88547(t,e,a){a.r(e),a.d(e,{EditorBuilder:()=>lt});var r=a(59929),o=a(86319),
|
|
342
|
+
`},88547(t,e,a){a.r(e),a.d(e,{EditorBuilder:()=>lt});var r=a(59929),o=a(86319),s=a(32325),i=a(50220),n=a(15604);a(92384);const l=t=>r.qy`<cdtr-font-family-editor
|
|
343
343
|
.name=${t.value}
|
|
344
344
|
.showWeight=${!0===t.weight}
|
|
345
345
|
.weight=${t.weightValue}
|
|
@@ -376,7 +376,7 @@
|
|
|
376
376
|
@change=${t.onChange}
|
|
377
377
|
.sizes=${t.sizes||[]}
|
|
378
378
|
></cdtr-width-editor>
|
|
379
|
-
</cdtr-editor-container>`;var h=a(25879);const g=/#[0-9a-fA-F]{3,8}|rgba?\([^)]*\)/,m=t=>{if("string"!=typeof t||!t.trim()||"none"===t)return{x:0,y:0,blur:0,spread:0,color:"#000000",inset:!1};const e=/\binset\b/.test(t),a=t.match(g),r=a?a[0]:"#000000",o=(t.replace(g,"").match(/-?\d+(?:\.\d+)?/g)||[]).map(Number);return{x:o[0]??0,y:o[1]??0,blur:o[2]??0,spread:o[3]??0,color:r,inset:e}};class u extends r.WF{constructor(){super(),this.value="",this.title="",this._parts=m(""),this._lastEmitted=null}createRenderRoot(){return this}willUpdate(t){t.has("value")&&this.value!==this._lastEmitted&&(this._parts=m(this.value))}_emit(t){this._parts={...this._parts,...t},this.value=(t=>{let{x:e,y:a,blur:r,spread:o,color:
|
|
379
|
+
</cdtr-editor-container>`;var h=a(25879);const g=/#[0-9a-fA-F]{3,8}|rgba?\([^)]*\)/,m=t=>{if("string"!=typeof t||!t.trim()||"none"===t)return{x:0,y:0,blur:0,spread:0,color:"#000000",inset:!1};const e=/\binset\b/.test(t),a=t.match(g),r=a?a[0]:"#000000",o=(t.replace(g,"").match(/-?\d+(?:\.\d+)?/g)||[]).map(Number);return{x:o[0]??0,y:o[1]??0,blur:o[2]??0,spread:o[3]??0,color:r,inset:e}};class u extends r.WF{constructor(){super(),this.value="",this.title="",this._parts=m(""),this._lastEmitted=null}createRenderRoot(){return this}willUpdate(t){t.has("value")&&this.value!==this._lastEmitted&&(this._parts=m(this.value))}_emit(t){this._parts={...this._parts,...t},this.value=(t=>{let{x:e,y:a,blur:r,spread:o,color:s,inset:i}=t;return`${i?"inset ":""}${e}px ${a}px ${r}px ${o}px ${s}`})(this._parts),this._lastEmitted=this.value,this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{value:this.value}}))}render(){const t=this._parts,e=t=>e=>{e.stopPropagation(),this._emit(t(e))};return r.qy`
|
|
380
380
|
<div @input=${t=>t.stopPropagation()}>
|
|
381
381
|
${this.title?(0,h.A)({level:6,text:this.title}):""}
|
|
382
382
|
${d({title:"shadow_color",value:t.color,alpha:!0,onChange:e(t=>({color:t.target.value}))})}
|
|
@@ -461,7 +461,7 @@
|
|
|
461
461
|
<cdtr-chips-input
|
|
462
462
|
.removeable=${!!t.removeable}
|
|
463
463
|
@remove=${t.onRemove}
|
|
464
|
-
@click=${()=>function(t){let{items:e,title:a,onChange:o,onCreate:
|
|
464
|
+
@click=${()=>function(t){let{items:e,title:a,onChange:o,onCreate:s}=t;const i=document.createElement("cdtr-drawer");i.width="500px",i.headerText=a,i.opened=!0;const n=document.createElement("div");i.appendChild(n),document.body.appendChild(i);const l=t=>{let{target:a}=t;const i=a.value,c=e.filter(t=>{const e={...t};return e.name||(e.name=""),e.label||(e.label=""),-1!==e.name.indexOf(i)||-1!==e.label.indexOf(i)});(0,r.XX)((0,w.A)({items:c,onChange:o,debounce:l,onCreate:s}),n)};(0,r.XX)((0,w.A)({items:e,onChange:o,debounce:l,onCreate:s}),n)}({items:t.list||[],title:t.title,onChange:t.onChange,onCreate:t.onCreate})}
|
|
465
465
|
.items=${t.items}
|
|
466
466
|
.freeSolo=${!!t.freeSolo}
|
|
467
467
|
>
|
|
@@ -564,15 +564,15 @@
|
|
|
564
564
|
<tbody>
|
|
565
565
|
${e.map((a,o)=>r.qy`
|
|
566
566
|
<tr style="color: ${a.color}">
|
|
567
|
-
${a.items.map((i
|
|
567
|
+
${a.items.map((s,i)=>r.qy`<td
|
|
568
568
|
style=" border: 1px solid #dddddd;
|
|
569
569
|
padding: 8px;"
|
|
570
570
|
>
|
|
571
571
|
<cdtr-input
|
|
572
572
|
inputStyle="border:none;"
|
|
573
|
-
.disabled=${0!==
|
|
574
|
-
@change=${a=>((a,r)=>{let{groupIndex:o,itemIndex:
|
|
575
|
-
value=${
|
|
573
|
+
.disabled=${0!==i&&""===a.items[0].value}
|
|
574
|
+
@change=${a=>((a,r)=>{let{groupIndex:o,itemIndex:s}=r;t.onChangeValue&&(e[o].items[s].value=a,T(e),t.onChangeValue(e,{groupIndex:o,itemIndex:s,value:a}))})(a.target.value,{itemIndex:i,groupIndex:o})}
|
|
575
|
+
value=${s.value}
|
|
576
576
|
></cdtr-input>
|
|
577
577
|
</td>`)}
|
|
578
578
|
</tr>
|
|
@@ -609,7 +609,7 @@
|
|
|
609
609
|
.target=${t.target}
|
|
610
610
|
@change=${t.onChange}
|
|
611
611
|
></cdtr-link-element
|
|
612
|
-
></cdtr-editor-container>`,
|
|
612
|
+
></cdtr-editor-container>`,B=[{name:"solid",value:"solid"},{name:"dashed",value:"dashed"},{name:"dotted",value:"dotted"},{name:"outset",value:"outset"},{name:"groove",value:"groove"},{name:"double",value:"double"},{name:"ridge",value:"ridge"}],E=t=>r.qy`<cdtr-editor-container>
|
|
613
613
|
<cdtr-row alignItems="center" jusitfyContent="space-between">
|
|
614
614
|
<cdtr-col>
|
|
615
615
|
<cdtr-title><lang-text text="type"></lang-text></cdtr-title>
|
|
@@ -623,7 +623,7 @@
|
|
|
623
623
|
><lang-text text="${t.borderType||t.value}"></lang-text>
|
|
624
624
|
</cdtr-dropdown-button>
|
|
625
625
|
<div slot="content">
|
|
626
|
-
${
|
|
626
|
+
${B.map(e=>r.qy`<cdtr-dropdown-item
|
|
627
627
|
.focused=${e.value===t.borderStyle||e.value===t.value}
|
|
628
628
|
.selected=${e.value===t.borderStyle||e.value===t.value}
|
|
629
629
|
value="${e.value}"
|
|
@@ -721,7 +721,7 @@
|
|
|
721
721
|
</cdtr-editor-container>`},U=t=>r.qy` <cdtr-editor-container>
|
|
722
722
|
<cdtr-title><lang-text text="${t.title}"></lang-text></cdtr-title>
|
|
723
723
|
<cdtr-merge-tags></cdtr-merge-tags>
|
|
724
|
-
</cdtr-editor-container>`;a(58691);var D=a(86959);const
|
|
724
|
+
</cdtr-editor-container>`;a(58691);var D=a(86959);const G=async function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};try{const a=await fetch((0,D.Ay)()?"http://localhost:8000/api/v1/prompt/image":"https://agent.creaditor.ai/api/v1/prompt/image",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt:t,options:{size:e.size||"1024x1024",quality:e.quality||"standard",style:e.style||"vivid",context:e.context||""}})});if(!a.ok)throw new Error(`HTTP error! status: ${a.status}`);const r=await a.json();return{status:r.status||"complete",image:r.image,metadata:{prompt:r.metadata?.prompt||t,size:r.metadata?.size||e.size||"1024x1024",quality:r.metadata?.quality||e.quality||"standard",style:r.metadata?.style||e.style||"vivid",fal_ai_result:r.metadata?.fal_ai_result||r}}}catch(t){throw console.error("Error generating image:",t),t}};var O=a(13681);class K extends r.WF{constructor(){super(),this.generatedImage=localStorage.getItem("lastGeneratedImage")||"",this.isGenerating=!1}handleInsertImage(t){const e=t.startsWith("data:")||!t.startsWith("http");O.vP.dispatch("on:upload-file",{image:t,type:e?"base64":"url"})}async handleGenerateImage(t,e){try{this.isGenerating=!0,this.requestUpdate();const a=n.Ay.getSelectedComponent(),r=a[0].closest("section"),o=r?.element,s=o?o.innerText:"",i=s.length>500?s.slice(-500):s;e.context=i;const l=await G(t,e);return this.generatedImage=l.image,localStorage.setItem("lastGeneratedImage",l.image),this.isGenerating=!1,this.requestUpdate(),l}catch(t){throw this.isGenerating=!1,this.requestUpdate(),console.error("Failed to generate image:",t),t}}render(){return r.qy` <cdtr-editor-container>
|
|
725
725
|
<cdtr-image-prompt-editor
|
|
726
726
|
@insert-image=${t=>this.handleInsertImage(t.detail.imageUrl)}
|
|
727
727
|
.generatedImage=${this.generatedImage}
|
|
@@ -790,7 +790,7 @@
|
|
|
790
790
|
@error=${this._handleImageError}
|
|
791
791
|
/>
|
|
792
792
|
</button>
|
|
793
|
-
`)}_handleSearch(t){this.searchTerm=t.target.value;const e=this.searchTerm.trim().toLowerCase();if("api"===this._tab)return this._apiSearchDebounce&&clearTimeout(this._apiSearchDebounce),e?void(this._apiSearchDebounce=setTimeout(()=>this._fetchApiIcons(e),550)):(this.searchTerm="",this._setLastSearch(""),void this._fetchCategories());this.filteredImages=J.filter(t=>(t.name||"").toLowerCase().includes(e))}_getLastSearch(){try{return localStorage.getItem(X)||""}catch{return""}}_setLastSearch(t){try{t?localStorage.setItem(X,t):localStorage.removeItem(X)}catch{}}async _fetchCategories(){const t=++this._apiRequestId;this._apiLoading=!0,this._apiIcons=[];try{const e=await fetch("https://img.creaditor.ai/icons/categories");if(!e.ok)throw new Error(e.statusText);const a=await e.json();if(t!==this._apiRequestId)return;const r=(a.categories||[]).flatMap(t=>t.icons||[]);this._apiIcons=r}catch(e){if(t!==this._apiRequestId)return;this._apiIcons=[],console.warn("Icons categories fetch failed:",e)}finally{t===this._apiRequestId&&(this._apiLoading=!1)}}async _fetchApiIcons(t){const e=++this._apiRequestId;this._apiLoading=!0,this._apiIcons=[];const a=(t||"").trim();try{const t=new URLSearchParams({q:a,format:"png",limit:"50",width:String(this.iconSize||24),height:String(this.iconSize||24)}),r=(this.iconColor||"000000").replace(/^#/,"");t.set("color",r);const o=await fetch(`${Z}/icons/search?${t.toString()}`);if(!o.ok)throw new Error(o.statusText);const
|
|
793
|
+
`)}_handleSearch(t){this.searchTerm=t.target.value;const e=this.searchTerm.trim().toLowerCase();if("api"===this._tab)return this._apiSearchDebounce&&clearTimeout(this._apiSearchDebounce),e?void(this._apiSearchDebounce=setTimeout(()=>this._fetchApiIcons(e),550)):(this.searchTerm="",this._setLastSearch(""),void this._fetchCategories());this.filteredImages=J.filter(t=>(t.name||"").toLowerCase().includes(e))}_getLastSearch(){try{return localStorage.getItem(X)||""}catch{return""}}_setLastSearch(t){try{t?localStorage.setItem(X,t):localStorage.removeItem(X)}catch{}}async _fetchCategories(){const t=++this._apiRequestId;this._apiLoading=!0,this._apiIcons=[];try{const e=await fetch("https://img.creaditor.ai/icons/categories");if(!e.ok)throw new Error(e.statusText);const a=await e.json();if(t!==this._apiRequestId)return;const r=(a.categories||[]).flatMap(t=>t.icons||[]);this._apiIcons=r}catch(e){if(t!==this._apiRequestId)return;this._apiIcons=[],console.warn("Icons categories fetch failed:",e)}finally{t===this._apiRequestId&&(this._apiLoading=!1)}}async _fetchApiIcons(t){const e=++this._apiRequestId;this._apiLoading=!0,this._apiIcons=[];const a=(t||"").trim();try{const t=new URLSearchParams({q:a,format:"png",limit:"50",width:String(this.iconSize||24),height:String(this.iconSize||24)}),r=(this.iconColor||"000000").replace(/^#/,"");t.set("color",r);const o=await fetch(`${Z}/icons/search?${t.toString()}`);if(!o.ok)throw new Error(o.statusText);const s=await o.json();if(e!==this._apiRequestId)return;this._apiIcons=s.icons||[],this._setLastSearch(this._apiIcons.length?a:"")}catch(t){if(e!==this._apiRequestId)return;this._apiIcons=[],this._setLastSearch(""),console.warn("Icons API search failed:",t)}finally{e===this._apiRequestId&&(this._apiLoading=!1)}}_selectApiIcon(t){const e=this.iconColor||"000000",a=this.iconSize||24,r=Q(t,{width:a,height:a,color:e});this.selectedIcon=r,this.dispatchEvent(new CustomEvent("icon-selected",{detail:{src:r,urlPng:r,urlSvg:t.urlSvg||t.src,name:t.name,category:t.category,size:{width:a,height:a},color:e},bubbles:!0,composed:!0}))}_selectIcon(t){this.selectedIcon=t.src,this.dispatchEvent(new CustomEvent("icon-selected",{detail:{src:t.src,name:t.name},bubbles:!0,composed:!0}))}_handleImageError(t){const e=t.target.closest(".icon-item");e&&e.classList.add("broken")}}Y.properties={selectedIcon:{type:String},useIconsApi:{type:Boolean},iconColor:{type:String},iconSize:{type:Number},searchTerm:{type:String},filteredImages:{type:Array},_tab:{type:String,state:!0},_apiIcons:{type:Array,state:!0},_apiLoading:{type:Boolean,state:!0},_apiSearchDebounce:{type:Object,state:!0}},Y.styles=r.AH`
|
|
794
794
|
:host {
|
|
795
795
|
display: block;
|
|
796
796
|
font-family: var(--font-sans, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif);
|
|
@@ -1140,7 +1140,7 @@
|
|
|
1140
1140
|
.hasBottom=${t.hasBottom||!0}
|
|
1141
1141
|
></cdtr-spacing>
|
|
1142
1142
|
</cdtr-row>
|
|
1143
|
-
</cdtr-editor-container>`;var ot=a(12258),
|
|
1143
|
+
</cdtr-editor-container>`;var ot=a(12258),st=a(40648),it=a(15155);const nt=t=>r.qy`
|
|
1144
1144
|
<cdtr-editor-container pt="0">
|
|
1145
1145
|
<cdtr-row style="padding:0.7rem 0px;" justify="${t.justify||"center"}" alignItems="center">
|
|
1146
1146
|
${t.src&&t.hasPreview?r.qy`
|
|
@@ -1177,7 +1177,7 @@
|
|
|
1177
1177
|
`:null}
|
|
1178
1178
|
</cdtr-row>
|
|
1179
1179
|
</cdtr-editor-container>
|
|
1180
|
-
`;a(45888);Promise.resolve().then(a.bind(a,58691));class lt extends r.WF{constructor(){super(),this.editor={},this.tabName="",this.factory=this.factory.bind(this),this.execCommandWrapper=this.execCommandWrapper.bind(this),this.connectWith=this.connectWith.bind(this),this.changeTab=this.changeTab.bind(this),this.$select=this.$select.bind(this),this.$update=this.$update.bind(this),this.handleJustifyContent=this.handleJustifyContent.bind(this),this.handleAlignItems=this.handleAlignItems.bind(this)}$select(){this.editor&&this.editor.select&&this.editor.select({changeTab:this.changeTab,tab:this.tabName}),this.connectWith("select")}$update(){this.connectWith("update")}_sectionScope(){return`${this.type||""}:${this.tabName||""}`}_applyPersistedOpen(t){const e=this._sectionScope();for(const a of t)if(a&&"section"===a.type){a.persistKey=`${e}::${a.label}`;const t=(0,
|
|
1180
|
+
`;a(45888);Promise.resolve().then(a.bind(a,58691));class lt extends r.WF{constructor(){super(),this.editor={},this.tabName="",this.factory=this.factory.bind(this),this.execCommandWrapper=this.execCommandWrapper.bind(this),this.connectWith=this.connectWith.bind(this),this.changeTab=this.changeTab.bind(this),this.$select=this.$select.bind(this),this.$update=this.$update.bind(this),this.handleJustifyContent=this.handleJustifyContent.bind(this),this.handleAlignItems=this.handleAlignItems.bind(this)}$select(){this.editor&&this.editor.select&&this.editor.select({changeTab:this.changeTab,tab:this.tabName}),this.connectWith("select")}$update(){this.connectWith("update")}_sectionScope(){return`${this.type||""}:${this.tabName||""}`}_applyPersistedOpen(t){const e=this._sectionScope();for(const a of t)if(a&&"section"===a.type){a.persistKey=`${e}::${a.label}`;const t=(0,st.i)(a.persistKey);void 0!==t&&(a.open=t)}return t}connectedCallback(){super.connectedCallback(),n.Ay.on("update",this.$update),n.Ay.on("select",this.$select),this.connectWith("load")}disconnectedCallback(){super.disconnectedCallback(),n.Ay.off("update",this.$update),n.Ay.off("select",this.$select)}connectWith(){const t=new UIEvent(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"update",{view:window,bubbles:!0,cancelable:!0});this.dispatchEvent(t);const e=n.Ay.components.find(t=>t.type===this.type);e&&"function"==typeof e.createEditor&&(this.component={...e},this.props=e.props,this.editor=e.createEditor(this.commandsBuilder()))}factory(t,e){if("function"==typeof t&&(t=t()),t.debug,"boolean"==typeof t.active&&!t.active)return null;if("function"==typeof t.active){if(!1===t.active())return null}const a=t.type;switch(a){case"background":return nt(t);case"datetime":return j(t);case"radius":return W(t);case"justifyContent":case"alignItems":return F(t,a);case"node":case"lit":case"custom":return t.node();case"button":return N(t);case"borderpicker":return E(t);case"linkpicker":return V(t);case"input":return(0,s.A)(t);case"dropdown":return(0,i.A)(t);case"fontSize":return c(t);case"fontFamily":return l(t);case"mergeTags":return U(t);case"boxShadow":return v(t);case"colorpicker":return d(t);case"slider":return p(t);case"divider":return b(t);case"heading":return(0,h.A)(t);case"option":return f(t);case"checkbox":return y(t);case"stringListBuilder":return x(t);case"chipsInput":return $(t);case"typography":return I(t);case"icons":return r.qy`<icons-gallery
|
|
1181
1181
|
.selectedIcon=${t.selectedIcon}
|
|
1182
1182
|
.useIconsApi=${!0===t.useIconsApi}
|
|
1183
1183
|
.iconColor=${t.iconColor??"000000"}
|
|
@@ -1192,13 +1192,13 @@
|
|
|
1192
1192
|
.isOpen=${t.isOpen}
|
|
1193
1193
|
>
|
|
1194
1194
|
${t.children.map(t=>this.factory(t))}
|
|
1195
|
-
</cdtr-accordion-item>`;case"imagePrompt":return document.createElement("cdtr-image-prompt-builder");case"spacingPicker":return rt(t);case"section":return(0,ot.A)(t,(t.children||[]).map((t,e)=>this.factory(t,e)));case"colorSwatchGroup":return(0,
|
|
1195
|
+
</cdtr-accordion-item>`;case"imagePrompt":return document.createElement("cdtr-image-prompt-builder");case"spacingPicker":return rt(t);case"section":return(0,ot.A)(t,(t.children||[]).map((t,e)=>this.factory(t,e)));case"colorSwatchGroup":return(0,it.A)(t)}}execCommandWrapper(t,e){let a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};a.components=[this.component],n.Ay.store().execCommand(t,e,a)}commandsBuilder(){return{tab:this.tabName,helpers:{Url:z.A,deepMerge:k()},commands:{execCommand:this.execCommandWrapper,injectEditor:o.M.get("injectEditor")}}}changeTab(t){this.tabName=t,"function"==typeof this.component?.createEditor&&(this.editor=this.component.createEditor(this.commandsBuilder()))}getColElementData(t){const e=t[0]?.closest("col");return e?{colElement:e,justifyValue:e.props.justify,alignItemsValue:e.props.alignItems,colElementRect:e.element.getBoundingClientRect()}:null}shouldShowDesignControls(t,e){const a=t[0]?.element.getBoundingClientRect(),r=t[0]?.type,o=e.find(t=>t.selected)?.text;let s=("design"===o||void 0===o)&&!["root","section","block","row","col"].includes(r);const i=this.getColElementData(t);return i&&i.colElementRect.width===a.width&&(s=!1),s}handleJustifyContent(t){const e=t.target.value,a=n.Ay.getSelectedComponent(),r=a[0]?.closest("col");r&&n.Ay.store().execCommand("justify",e,{find:"col"})}handleAlignItems(t){const e=t.target.value,a=n.Ay.getSelectedComponent(),r=a[0]?.closest("col");r&&n.Ay.store().execCommand("alignItems",e,{find:"col"})}renderJustifyAlignControls(t){return t?(0,ot.A)({label:"alignment",open:!1},[F({value:t.justifyValue,onChange:this.handleJustifyContent}),F({value:t.alignItemsValue,type:"alignItems",title:"alignItems",onChange:this.handleAlignItems})]):null}preprocessLayout(t){if(!t||0===t.length)return t;if(t.some(t=>t&&"section"===t.type))return this._applyPersistedOpen(t);t=t.filter(t=>!!t&&("boolean"==typeof t.active?t.active:"function"!=typeof t.active||!1!==t.active()));const e=[];let a=[];for(const r of t)r&&("function"!=typeof r?"divider"===r.type?(a.length>0&&e.push(a),a=[]):"heading"===r.type?(a.length>0&&e.push(a),a=[r]):a.push(r):a.push(r));a.length>0&&e.push(a);const r=[];let o=0;for(let t=0;t<e.length;t++){const a=e[t];if(a[0]&&"heading"===a[0].type){const t=a[0].text||"settings",e=a.slice(1);e.length>0&&(o++,r.push({type:"section",label:t,open:!0,children:e}))}else r.push(...a)}if(o>=4){let t=0;for(const e of r)"section"===e.type&&(t++,e.open=t<=2)}return this._applyPersistedOpen(r)}createRenderRoot(){return this}render(){if(!this.editor)return;if("function"!=typeof this.editor.tabs)return;const t=n.Ay.getSelectedComponent(),e=this.editor?.tabs(this.tabName),a=this.getColElementData(t),o=this.shouldShowDesignControls(t,e),s=this.preprocessLayout(this.editor.layout({tabs:e,tab:e.find(t=>t.selected)||e[0]||{text:"style"},changeTab:this.changeTab}));return r.qy`<cdtr-editor-tabs
|
|
1196
1196
|
.value=${this.tabName}
|
|
1197
1197
|
@tabChanged=${t=>this.changeTab(t.target.value)}
|
|
1198
1198
|
.tabs=${e}
|
|
1199
1199
|
>
|
|
1200
1200
|
<div slot="content">
|
|
1201
|
-
${
|
|
1201
|
+
${s.map(this.factory)}
|
|
1202
1202
|
${o?this.renderJustifyAlignControls(a):null}
|
|
1203
1203
|
</div>
|
|
1204
1204
|
</cdtr-editor-tabs> `}}lt.styles=r.AH`
|
|
@@ -1222,7 +1222,7 @@
|
|
|
1222
1222
|
paper-button.backgrounds:hover {
|
|
1223
1223
|
background: #eaeaed;
|
|
1224
1224
|
}
|
|
1225
|
-
`,lt.properties={type:{type:String},editor:{},tabName:{type:String},tabs:{type:Array}},customElements.define("cdtr-editor-builder",lt)},92384(t,e,a){a.r(e),a.d(e,{FONT_WEIGHTS:()=>
|
|
1225
|
+
`,lt.properties={type:{type:String},editor:{},tabName:{type:String},tabs:{type:Array}},customElements.define("cdtr-editor-builder",lt)},92384(t,e,a){a.r(e),a.d(e,{FONT_WEIGHTS:()=>i,FontFamilyEditor:()=>n});var r=a(59929),o=a(40120),s=a(86319);const i=[{name:"Thin",value:100},{name:"Light",value:300},{name:"Regular",value:400},{name:"Medium",value:500},{name:"SemiBold",value:600},{name:"Bold",value:700},{name:"Black",value:900}];class n extends r.WF{constructor(){super(),this.onchangeFontWeight=t=>{const e=parseInt(t.target.value,10);Number.isNaN(e)||(this.weight=e,this.dispatchEvent(new CustomEvent("weightchange",{bubbles:!0,composed:!0,cancelable:!0,detail:{value:e}})))},this.onchangeFontFamily=t=>{const e=t.target.value,a=this.fontFamilies.find(t=>t.name===e);if(!a)return void console.error("cant set font family, font family not founded..");(0,o.sw)(a),this.value=a.cssRule,this.name=e;const r=new UIEvent("change",{view:window,bubbles:!0,cancelable:!0});this.dispatchEvent(r)},this.onFilteredFonts=t=>{const e=t.target.value;this.filteredFonts=this.fontFamilies.filter(t=>t.name.toLowerCase().includes(e.toLowerCase()))},this.filteredFonts=[],this.fontFamilies=[],this.showWeight=!1}async connectedCallback(){super.connectedCallback();const t=await(0,o.VH)(),e=Array.isArray(t)?t:[];this.filteredFonts=this.fontFamilies=e,e.forEach(t=>{t&&t.url&&t.id&&function(t){if(document.getElementById(t.id))return;const e=document.createElement("link");e.href=t.url,e.id=t.id,e.setAttribute("data-name",t.name),e.rel="stylesheet",e.type="text/css",document.head.appendChild(e)}(t)})}disconnectedCallback(){super.disconnectedCallback()}render(){const t=this.fontFamilies.find(t=>"string"==typeof t?.cssRule&&(-1!==t.cssRule.indexOf(this.value||"")||-1!==t.cssRule.indexOf(this.name||"")));t&&(this.name=t.name);const e=r.qy`<cdtr-dropdown
|
|
1226
1226
|
style="width:100%"
|
|
1227
1227
|
.value="${this.name}"
|
|
1228
1228
|
@change=${this.onchangeFontFamily}
|
|
@@ -1235,7 +1235,7 @@
|
|
|
1235
1235
|
</cdtr-dropdown-button>
|
|
1236
1236
|
<div slot="content">
|
|
1237
1237
|
<cdtr-input
|
|
1238
|
-
.placeholder="${
|
|
1238
|
+
.placeholder="${s.M.get("lang","search")}.."
|
|
1239
1239
|
@input=${this.onFilteredFonts}
|
|
1240
1240
|
type="search"
|
|
1241
1241
|
></cdtr-input>
|
|
@@ -1260,7 +1260,7 @@
|
|
|
1260
1260
|
</cdtr-col>
|
|
1261
1261
|
</cdtr-row>
|
|
1262
1262
|
</cdtr-editor-container>
|
|
1263
|
-
`,o=
|
|
1263
|
+
`,o=i.find(t=>String(t.value)===String(this.weight))||i.find(t=>400===t.value),n=r.qy`<cdtr-dropdown
|
|
1264
1264
|
style="width:100%"
|
|
1265
1265
|
.value="${String(o?.value)}"
|
|
1266
1266
|
@change=${this.onchangeFontWeight}
|
|
@@ -1272,7 +1272,7 @@
|
|
|
1272
1272
|
>${o?.value}
|
|
1273
1273
|
</cdtr-dropdown-button>
|
|
1274
1274
|
<div slot="content">
|
|
1275
|
-
${
|
|
1275
|
+
${i.map(t=>r.qy`<cdtr-dropdown-item
|
|
1276
1276
|
.focused=${String(t.value)===String(o?.value)}
|
|
1277
1277
|
.selected=${String(t.value)===String(o?.value)}
|
|
1278
1278
|
value="${t.value}"
|
|
@@ -1315,4 +1315,4 @@
|
|
|
1315
1315
|
background: rgba(16, 24, 40, 0.055) !important;
|
|
1316
1316
|
color: #14171f;
|
|
1317
1317
|
}
|
|
1318
|
-
`,customElements.define("cdtr-font-family-editor",n)},
|
|
1318
|
+
`,customElements.define("cdtr-font-family-editor",n)},88385(t,e,a){a.d(e,{A:()=>n});const r=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 s(t){const e={},a=/([^&=]+)=?([^&]*)/g,r=t=>{try{return decodeURIComponent(t.replace(/\+/g," "))}catch(e){return t.replace(/\+/g," ")}},o=t.indexOf("?");let s,i=-1!==o?t.substring(o+1):"";for(;null!==(s=a.exec(i));){const t=r(s[1]),a=r(s[2]);t&&(e[t]=a)}return e}function i(t){if(!t)return"";let e=t.replace(/^[^:]+:(?:\/\/)?/,"");return e=e.replace(/^\/+/,""),e=e.split("?")[0],encodeURIComponent(e).replace(/%24/g,"$")}class n{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,...s(t)};const a=t.indexOf("?");return this.url=a>-1?t.slice(0,a):t,this.href=t,void(this.fullHref=t)}this.isValid=this.isValidUrl(this.href),this.protocol=e?.protocol||this.protocol||n.getProtocol(this.href);const a=function(t){if(!t)return"";let e=t.replace(/^[^:]+:(?:\/\/)?/,"");return e=e.replace(/^\/+/,""),e=e.split("?")[0],e}(this.href);if(this.isEmail=r(a),this.isPhone=o(a),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,...s(this.href)},this.url=i(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 a in this.params){const r=this.params[a],o=encodeURIComponent(a).replace(/%24/g,"$");if(r){const a=encodeURIComponent(r).replace(/%24/g,"$");t+=`${o}=${a}&`,e+=`${o}=${a}&`}else t+=`${o}&`,e+=`${o}&`}t=t.slice(0,-1)}const a=t=>{try{return decodeURIComponent(t)}catch{return t}};if(this.protocol&&("http:"===this.protocol||"https:"===this.protocol))return a(this.protocol+"//"+t);if(this.isAnchor||"anchor:"===this.protocol)return t?a(t.startsWith("#")?t:`#${t}`):"";if("whatsapp:"===this.protocol){const r=this.extractPhoneFromTextUsingRegex(t);return r.length>0?a("https://wa.me/"+r[0]+e):a("https://wa.me/"+e)}return a(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)}}n.resetURL=i}}]);
|
|
Binary file
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
/*! For license information please see 9535.creaditor.bundle.js.LICENSE.txt */
|
|
2
|
+
"use strict";(("undefined"!=typeof self?self:this).webpackChunkCreaditor=("undefined"!=typeof self?self:this).webpackChunkCreaditor||[]).push([[9535],{39535(t,e,s){s.r(e),s.d(e,{SendTestEmailsPlugin:()=>V});var i=s(59929);const o=globalThis,r=o.ShadowRoot&&(void 0===o.ShadyCSS||o.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,n=Symbol(),a=new WeakMap;let l=class{constructor(t,e,s){if(this._$cssResult$=!0,s!==n)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const e=this.t;if(r&&void 0===t){const s=void 0!==e&&1===e.length;s&&(t=a.get(e)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),s&&a.set(e,t))}return t}toString(){return this.cssText}};const h=(t,e)=>{if(r)t.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const s of e){const e=document.createElement("style"),i=o.litNonce;void 0!==i&&e.setAttribute("nonce",i),e.textContent=s.cssText,t.appendChild(e)}},p=r?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const s of t.cssRules)e+=s.cssText;return(t=>new l("string"==typeof t?t:t+"",void 0,n))(e)})(t):t,{is:d,defineProperty:c,getOwnPropertyDescriptor:u,getOwnPropertyNames:m,getOwnPropertySymbols:f,getPrototypeOf:g}=Object,y=globalThis,v=y.trustedTypes,E=v?v.emptyScript:"",b=y.reactiveElementPolyfillSupport,$=(t,e)=>t,S={toAttribute(t,e){switch(e){case Boolean:t=t?E:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let s=t;switch(e){case Boolean:s=null!==t;break;case Number:s=null===t?null:Number(t);break;case Object:case Array:try{s=JSON.parse(t)}catch(t){s=null}}return s}},w=(t,e)=>!d(t,e),x={attribute:!0,type:String,converter:S,reflect:!1,useDefault:!1,hasChanged:w};Symbol.metadata??=Symbol("metadata"),y.litPropertyMetadata??=new WeakMap;class _ extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:x;if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(t,e),!e.noAccessor){const s=Symbol(),i=this.getPropertyDescriptor(t,s,e);void 0!==i&&c(this.prototype,t,i)}}static getPropertyDescriptor(t,e,s){const{get:i,set:o}=u(this.prototype,t)??{get(){return this[e]},set(t){this[e]=t}};return{get:i,set(e){const r=i?.call(this);o?.call(this,e),this.requestUpdate(t,r,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??x}static _$Ei(){if(this.hasOwnProperty($("elementProperties")))return;const t=g(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty($("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty($("properties"))){const t=this.properties,e=[...m(t),...f(t)];for(const s of e)this.createProperty(s,t[s])}const t=this[Symbol.metadata];if(null!==t){const e=litPropertyMetadata.get(t);if(void 0!==e)for(const[t,s]of e)this.elementProperties.set(t,s)}this._$Eh=new Map;for(const[t,e]of this.elementProperties){const s=this._$Eu(t,e);void 0!==s&&this._$Eh.set(s,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const s=new Set(t.flat(1/0).reverse());for(const t of s)e.unshift(p(t))}else void 0!==t&&e.push(p(t));return e}static _$Eu(t,e){const s=e.attribute;return!1===s?void 0:"string"==typeof s?s:"string"==typeof t?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(t=>t(this))}addController(t){(this._$EO??=new Set).add(t),void 0!==this.renderRoot&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){const t=new Map,e=this.constructor.elementProperties;for(const s of e.keys())this.hasOwnProperty(s)&&(t.set(s,this[s]),delete this[s]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return h(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(t=>t.hostConnected?.())}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach(t=>t.hostDisconnected?.())}attributeChangedCallback(t,e,s){this._$AK(t,s)}_$ET(t,e){const s=this.constructor.elementProperties.get(t),i=this.constructor._$Eu(t,s);if(void 0!==i&&!0===s.reflect){const o=(void 0!==s.converter?.toAttribute?s.converter:S).toAttribute(e,s.type);this._$Em=t,null==o?this.removeAttribute(i):this.setAttribute(i,o),this._$Em=null}}_$AK(t,e){const s=this.constructor,i=s._$Eh.get(t);if(void 0!==i&&this._$Em!==i){const t=s.getPropertyOptions(i),o="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:S;this._$Em=i;const r=o.fromAttribute(e,t.type);this[i]=r??this._$Ej?.get(i)??r,this._$Em=null}}requestUpdate(t,e,s){if(void 0!==t){const i=this.constructor,o=this[t];if(s??=i.getPropertyOptions(t),!((s.hasChanged??w)(o,e)||s.useDefault&&s.reflect&&o===this._$Ej?.get(t)&&!this.hasAttribute(i._$Eu(t,s))))return;this.C(t,e,s)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(t,e,s,i){let{useDefault:o,reflect:r,wrapped:n}=s;o&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,i??e??this[t]),!0!==n||void 0!==i)||(this._$AL.has(t)||(this.hasUpdated||o||(e=void 0),this._$AL.set(t,e)),!0===r&&this._$Em!==t&&(this._$Eq??=new Set).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[t,e]of this._$Ep)this[t]=e;this._$Ep=void 0}const t=this.constructor.elementProperties;if(t.size>0)for(const[e,s]of t){const{wrapped:t}=s,i=this[e];!0!==t||this._$AL.has(e)||void 0===i||this.C(e,void 0,s,i)}}let t=!1;const e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$EO?.forEach(t=>t.hostUpdate?.()),this.update(e)):this._$EM()}catch(e){throw t=!1,this._$EM(),e}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$EO?.forEach(t=>t.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Eq&&=this._$Eq.forEach(t=>this._$ET(t,this[t])),this._$EM()}updated(t){}firstUpdated(t){}}_.elementStyles=[],_.shadowRootOptions={mode:"open"},_[$("elementProperties")]=new Map,_[$("finalized")]=new Map,b?.({ReactiveElement:_}),(y.reactiveElementVersions??=[]).push("2.1.1");const C={attribute:!0,type:String,converter:S,reflect:!1,hasChanged:w},P=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:C,e=arguments.length>1?arguments[1]:void 0,s=arguments.length>2?arguments[2]:void 0;const{kind:i,metadata:o}=s;let r=globalThis.litPropertyMetadata.get(o);if(void 0===r&&globalThis.litPropertyMetadata.set(o,r=new Map),"setter"===i&&((t=Object.create(t)).wrapped=!0),r.set(s.name,t),"accessor"===i){const{name:i}=s;return{set(s){const o=e.get.call(this);e.set.call(this,s),this.requestUpdate(i,o,t)},init(e){return void 0!==e&&this.C(i,void 0,t,e),e}}}if("setter"===i){const{name:i}=s;return function(s){const o=this[i];e.call(this,s),this.requestUpdate(i,o,t)}}throw Error("Unsupported decorator location: "+i)};function O(t){return(e,s)=>"object"==typeof s?P(t,e,s):((t,e,s)=>{const i=e.hasOwnProperty(s);return e.constructor.createProperty(s,t),i?Object.getOwnPropertyDescriptor(e,s):void 0})(t,e,s)}function T(t){return O({...t,state:!0,attribute:!1})}var U=Object.defineProperty,A=Object.getOwnPropertyDescriptor,M=(t,e,s,i)=>{for(var o,r=i>1?void 0:i?A(e,s):e,n=t.length-1;n>=0;n--)(o=t[n])&&(r=(i?o(e,s,r):o(r))||r);return i&&r&&U(e,s,r),r};const k="cdtr-test-emails";let V=class extends i.WF{constructor(){super(...arguments),this.emails=[],this.inputValue="",this.error="",this.isLoading=!1,this.customColor="#000",this.customTextColor="#ffffff",this.buttonText="#ffffff",this.triggerText="Send Test Emails",this.headerText="Send Test Emails",this.inputPlaceholder="Enter email addresses (comma or enter to add)",this.sendButtonText="Send",this.loadingText="Sending...",this.invalidEmailError="Please enter a valid email address",this.noEmailsError="Please add at least one email address"}connectedCallback(){super.connectedCallback();const t=localStorage.getItem(k);t&&(this.emails=JSON.parse(t))}validateEmail(t){return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t)}handleInput(t){const e=t.target;this.inputValue=e.value,this.error=""}handleKeyDown(t){"Enter"!==t.key&&","!==t.key||(t.preventDefault(),this.addEmail())}addEmail(){const t=this.inputValue.trim();t&&(this.validateEmail(t)?(this.emails.includes(t)||(this.emails=[...this.emails,t],localStorage.setItem(k,JSON.stringify(this.emails)),this.dispatchEvent(new CustomEvent("email-added",{detail:{email:t},bubbles:!0,composed:!0}))),this.inputValue=""):this.error=this.invalidEmailError)}removeEmail(t){this.emails=this.emails.filter(e=>e!==t),localStorage.setItem(k,JSON.stringify(this.emails)),this.dispatchEvent(new CustomEvent("email-removed",{detail:{email:t},bubbles:!0,composed:!0}))}sendEmails(){this.inputValue.trim()&&this.validateEmail(this.inputValue.trim())&&this.addEmail(),0!==this.emails.length?(this.isLoading=!0,this.dispatchEvent(new CustomEvent("sendEmails",{detail:{emails:this.emails},bubbles:!0,composed:!0})),setTimeout(()=>{this.isLoading=!1;const t=this.shadowRoot?.querySelector("cdtr-popover");t&&t.close&&t.close()},1e3)):this.error=this.noEmailsError}render(){return i.qy`
|
|
3
|
+
<cdtr-popover>
|
|
4
|
+
<paper-button
|
|
5
|
+
color="primary"
|
|
6
|
+
slot="trigger"
|
|
7
|
+
style="color: ${this.customTextColor};"
|
|
8
|
+
>
|
|
9
|
+
<svg
|
|
10
|
+
width="20"
|
|
11
|
+
height="20"
|
|
12
|
+
xmlns="http://www.w3. org/2000/svg"
|
|
13
|
+
viewBox="0 0 24 24"
|
|
14
|
+
fill="currentColor"
|
|
15
|
+
>
|
|
16
|
+
<path
|
|
17
|
+
d="M21 3C21.5523 3 22 3.44772 22 4V20.0066C22 20.5552 21.5447 21 21.0082 21H2.9918C2.44405 21 2 20.5551 2 20.0066V19H20V7.3L12 14.5L2 5.5V4C2 3.44772 2.44772 3 3 3H21ZM8 15V17H0V15H8ZM5 10V12H0V10H5ZM19.5659 5H4.43414L12 11.8093L19.5659 5Z"
|
|
18
|
+
></path>
|
|
19
|
+
</svg>
|
|
20
|
+
<span dir="auto">${this.triggerText}</span>
|
|
21
|
+
</paper-button>
|
|
22
|
+
<div slot="content" class="popover-content" dir="auto">
|
|
23
|
+
<div class="popover-header">
|
|
24
|
+
<svg
|
|
25
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
26
|
+
viewBox="0 0 24 24"
|
|
27
|
+
fill="currentColor"
|
|
28
|
+
>
|
|
29
|
+
<path
|
|
30
|
+
d="M21 3C21.5523 3 22 3.44772 22 4V20.0066C22 20.5552 21.5447 21 21.0082 21H2.9918C2.44405 21 2 20.5551 2 20.0066V19H20V7.3L12 14.5L2 5.5V4C2 3.44772 2.44772 3 3 3H21ZM8 15V17H0V15H8ZM5 10V12H0V10H5ZM19.5659 5H4.43414L12 11.8093L19.5659 5Z"
|
|
31
|
+
></path>
|
|
32
|
+
</svg>
|
|
33
|
+
<h3>${this.headerText}</h3>
|
|
34
|
+
</div>
|
|
35
|
+
<input
|
|
36
|
+
name="emails"
|
|
37
|
+
class="email-input"
|
|
38
|
+
type="text"
|
|
39
|
+
.value=${this.inputValue}
|
|
40
|
+
@input=${this.handleInput}
|
|
41
|
+
@keydown=${this.handleKeyDown}
|
|
42
|
+
placeholder=${this.inputPlaceholder}
|
|
43
|
+
dir="auto"
|
|
44
|
+
/>
|
|
45
|
+
${this.error?i.qy`<div class="error" dir="auto">${this.error}</div>`:""}
|
|
46
|
+
<div class="email-tags">
|
|
47
|
+
${this.emails.map(t=>i.qy`
|
|
48
|
+
<div class="email-tag" dir="auto">
|
|
49
|
+
${t}
|
|
50
|
+
<span
|
|
51
|
+
class="remove-tag"
|
|
52
|
+
@click=${()=>this.removeEmail(t)}
|
|
53
|
+
>×</span
|
|
54
|
+
>
|
|
55
|
+
</div>
|
|
56
|
+
`)}
|
|
57
|
+
</div>
|
|
58
|
+
<paper-button
|
|
59
|
+
size="sm"
|
|
60
|
+
fullwidth
|
|
61
|
+
@click=${this.sendEmails}
|
|
62
|
+
?disabled=${this.isLoading}
|
|
63
|
+
class="send-button"
|
|
64
|
+
style="background: ${this.customColor}; color: ${this.customTextColor};width:100%;"
|
|
65
|
+
>
|
|
66
|
+
${this.isLoading?i.qy`
|
|
67
|
+
<span class="loading-spinner"></span>
|
|
68
|
+
<span dir="auto">${this.loadingText}</span>
|
|
69
|
+
`:i.qy`<span dir="auto">${this.sendButtonText}</span>`}
|
|
70
|
+
</paper-button>
|
|
71
|
+
</div>
|
|
72
|
+
</cdtr-popover>
|
|
73
|
+
`}};V.styles=i.AH`
|
|
74
|
+
:host {
|
|
75
|
+
display: block;
|
|
76
|
+
}
|
|
77
|
+
* {
|
|
78
|
+
font-family: Arial, Helvetica, sans-serif;
|
|
79
|
+
box-sizing: border-box;
|
|
80
|
+
}
|
|
81
|
+
paper-button {
|
|
82
|
+
text-transform: none;
|
|
83
|
+
min-width: 10px;
|
|
84
|
+
}
|
|
85
|
+
.popover-content {
|
|
86
|
+
padding: 16px;
|
|
87
|
+
min-width: 300px;
|
|
88
|
+
}
|
|
89
|
+
.popover-header {
|
|
90
|
+
display: flex;
|
|
91
|
+
align-items: center;
|
|
92
|
+
gap: 8px;
|
|
93
|
+
margin-bottom: 16px;
|
|
94
|
+
padding-bottom: 8px;
|
|
95
|
+
border-bottom: 1px solid #e0e0e0;
|
|
96
|
+
}
|
|
97
|
+
.popover-header h3 {
|
|
98
|
+
margin: 0;
|
|
99
|
+
font-size: 16px;
|
|
100
|
+
font-weight: 600;
|
|
101
|
+
color: #333;
|
|
102
|
+
}
|
|
103
|
+
.popover-header svg {
|
|
104
|
+
width: 20px;
|
|
105
|
+
height: 20px;
|
|
106
|
+
color: #666;
|
|
107
|
+
}
|
|
108
|
+
.email-input {
|
|
109
|
+
padding: 8px 12px;
|
|
110
|
+
border: 1px solid #ccc;
|
|
111
|
+
border-radius: 4px;
|
|
112
|
+
width: 100%;
|
|
113
|
+
margin-bottom: 8px;
|
|
114
|
+
font-size: 14px;
|
|
115
|
+
transition: border-color 0.2s;
|
|
116
|
+
}
|
|
117
|
+
.email-input:focus {
|
|
118
|
+
outline: none;
|
|
119
|
+
border-color: #666;
|
|
120
|
+
}
|
|
121
|
+
.email-tags {
|
|
122
|
+
display: flex;
|
|
123
|
+
flex-wrap: wrap;
|
|
124
|
+
gap: 4px;
|
|
125
|
+
margin-bottom: 16px;
|
|
126
|
+
max-width: 200px;
|
|
127
|
+
}
|
|
128
|
+
.email-tag {
|
|
129
|
+
background: #f0f0f0;
|
|
130
|
+
padding: 4px 8px;
|
|
131
|
+
border-radius: 4px;
|
|
132
|
+
display: flex;
|
|
133
|
+
align-items: center;
|
|
134
|
+
gap: 4px;
|
|
135
|
+
font-size: 13px;
|
|
136
|
+
}
|
|
137
|
+
.remove-tag {
|
|
138
|
+
cursor: pointer;
|
|
139
|
+
color: #666;
|
|
140
|
+
font-size: 16px;
|
|
141
|
+
line-height: 1;
|
|
142
|
+
padding: 0 2px;
|
|
143
|
+
}
|
|
144
|
+
.remove-tag:hover {
|
|
145
|
+
color: #ff0000;
|
|
146
|
+
}
|
|
147
|
+
.error {
|
|
148
|
+
color: #ff0000;
|
|
149
|
+
font-size: 12px;
|
|
150
|
+
margin-bottom: 8px;
|
|
151
|
+
}
|
|
152
|
+
.loading-spinner {
|
|
153
|
+
display: inline-block;
|
|
154
|
+
width: 16px;
|
|
155
|
+
height: 16px;
|
|
156
|
+
border: 2px solid #ffffff;
|
|
157
|
+
border-radius: 50%;
|
|
158
|
+
border-top-color: transparent;
|
|
159
|
+
animation: spin 1s ease-in-out infinite;
|
|
160
|
+
margin-right: 8px;
|
|
161
|
+
}
|
|
162
|
+
@keyframes spin {
|
|
163
|
+
to {
|
|
164
|
+
transform: rotate(360deg);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
.send-button:disabled {
|
|
168
|
+
opacity: 0.6;
|
|
169
|
+
cursor: not-allowed;
|
|
170
|
+
}
|
|
171
|
+
`,M([T()],V.prototype,"emails",2),M([T()],V.prototype,"inputValue",2),M([T()],V.prototype,"error",2),M([T()],V.prototype,"isLoading",2),M([O({type:String})],V.prototype,"customColor",2),M([O({type:String})],V.prototype,"customTextColor",2),M([O({type:String})],V.prototype,"buttonText",2),M([O({type:String})],V.prototype,"triggerText",2),M([O({type:String})],V.prototype,"headerText",2),M([O({type:String})],V.prototype,"inputPlaceholder",2),M([O({type:String})],V.prototype,"sendButtonText",2),M([O({type:String})],V.prototype,"loadingText",2),M([O({type:String})],V.prototype,"invalidEmailError",2),M([O({type:String})],V.prototype,"noEmailsError",2),V=M([(t=>(e,s)=>{void 0!==s?s.addInitializer(()=>{customElements.define(t,e)}):customElements.define(t,e)})("cdtr-send-test-emails-plugin")],V)}}]);
|
|
Binary file
|