@creaditor/web-starterkit 1.0.44 → 1.0.46
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/creaditor.bundle.js +1722 -771
- 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/7918.creaditor.bundle.js +0 -1
- package/dist/7918.creaditor.bundle.js.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
|