builder-settings-types 0.0.54 → 0.0.55

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,21 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let H=(l=21)=>{let t="",e=crypto.getRandomValues(new Uint8Array(l|=0));for(;l--;)t+=y[e[l]&63];return t};function S(l,t){for(const e in l)if(l.hasOwnProperty(e)){const i=l[e];t(e,i)}}class g{constructor(t){this.id=t.id||H(),this.title=t.title,this.settings=t.settings,Object.assign(this,t.settings)}setOnChange(t){return this.onChange=t,S(this.settings,(e,i)=>{i.setOnChange(t)}),this}getValues(t){if(t===void 0){const e={};for(const i in this.settings)if(this.settings.hasOwnProperty(i)){const n=this.settings[i];n instanceof g?e[i]=n.getValues():e[i]=n.value}return e}else{const e=this.settings[t];return e?e instanceof g?e.getValues():e.value:void 0}}draw(){const t=document.createElement("div");t.className="setting-group";const e=document.createElement("div");e.className="setting-group-title";const i=document.createElement("h3");i.textContent=this.title;const n=document.createElement("span");n.className="setting-group-arrow",n.innerHTML=`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const k="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let x=(l=21)=>{let t="",e=crypto.getRandomValues(new Uint8Array(l|=0));for(;l--;)t+=k[e[l]&63];return t};function H(l,t){for(const e in l)if(l.hasOwnProperty(e)){const i=l[e];t(e,i)}}class m{constructor(t){this.id=t.id||x(),this.title=t.title,this.settings=t.settings,Object.assign(this,t.settings)}setOnChange(t){return this.onChange=t,H(this.settings,(e,i)=>{i.setOnChange(t)}),this}getValues(t){if(t===void 0){const e={};for(const i in this.settings)if(this.settings.hasOwnProperty(i)){const n=this.settings[i];n instanceof m?e[i]=n.getValues():e[i]=n.value}return e}else{const e=this.settings[t];return e?e instanceof m?e.getValues():e.value:void 0}}draw(){const t=document.createElement("div");t.className="setting-group";const e=document.createElement("div");e.className="setting-group-title";const i=document.createElement("h3");i.textContent=this.title;const n=document.createElement("span");n.className="setting-group-arrow",n.innerHTML=`
2
2
  <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20" fill="none">
3
3
  <path d="M5 7.5L10 12.5L15 7.5" stroke="#344054" stroke-width="1.66667" stroke-linecap="round" stroke-linejoin="round"/>
4
4
  </svg>
5
- `,e.onclick=()=>{const a=t.querySelector(".setting-group-content");a&&(a.classList.toggle("collapsed"),n.classList.toggle("rotated"))},e.appendChild(i),e.appendChild(n);const s=document.createElement("div");s.className="setting-group-content";for(const a in this.settings)if(this.settings.hasOwnProperty(a)){const o=this.settings[a];s.appendChild(o.draw())}return t.appendChild(e),t.appendChild(s),t}}function E(l){switch(l){case"number":return 0;case"text":return"";case"select":return null;case"color":return"#000000";case"date":return new Date().toISOString().split("T")[0];case"button":return"";default:return""}}class C{constructor(t={}){this.props=t,this.id=t.id||H(),this.value=this.props.default,this.title=t.title||""}setOnChange(t){return this.onChange=t,this}setValue(t){this.value=t,this.inputEl&&(this.inputEl.value=String(t)),this.onChange&&this.onChange(t)}createInput(t){t={...this.props.inputProps,...t};const e=document.createElement("div");if(e.className=t.wrapperClassName||"",t.title||t.icon){const s=document.createElement("div");if(s.className="icon-container",t.icon){const a=this.createIcon(t.icon,t.iconClassName);s.appendChild(a)}if(t.title){const a=this.createLabel(t.title,t.labelClassName);s.appendChild(a)}e.appendChild(s)}const i=document.createElement("div");i.className=t.wrapperClassName||"";const n=document.createElement("input");return this.inputEl=n,n.value=String(t.value||E(t.inputType)),n.type=t.inputType,n.placeholder=t.placeholder||"",n.className=t.inputClassName||"",n.oninput=s=>{const a=s.target;let o=a.value;t.inputType==="number"?o=Number(a.value):(t.inputType==="color"||t.inputType==="date")&&(o=a.value),this.value=o,this.onChange&&this.onChange(this.value)},t.inputCustomizer&&t.inputCustomizer(n),i.appendChild(n),e.appendChild(i),e}createLabel(t,e){const i=document.createElement("span");return i.textContent=t,i.className="input-label "+(e||""),i}createIcon(t,e){const i=document.createElement("span");return i.className="input-icon "+(e||""),i.innerHTML=t,i}}class f extends C{constructor(t={}){super(t),this.inputType="text"}draw(){const t=e=>{this.props.maxLength!==void 0&&(e.maxLength=this.props.maxLength),this.props.className&&e.classList.add(this.props.className)};return this.createInput({value:this.value,inputType:this.inputType,title:this.props.title,placeholder:this.props.placeholder,icon:this.props.icon,inputClassName:"string-setting-input "+(this.props.inputClassName||""),wrapperClassName:"string-setting-wrapper "+(this.props.wrapperClassName||""),inputCustomizer:t})}}const k="<svg xmlns='http://www.w3.org/2000/svg' width='18' height='19' viewBox='0 0 18 19' fill='none'><path d='M8.99999 15.8542C9.79613 16.5667 10.8475 17 12 17C14.4853 17 16.5 14.9853 16.5 12.5C16.5 10.4248 15.0953 8.67769 13.1849 8.15763M4.81513 8.15762C2.9047 8.67768 1.5 10.4248 1.5 12.5C1.5 14.9853 3.51472 17 6 17C8.48528 17 10.5 14.9853 10.5 12.5C10.5 11.9146 10.3882 11.3554 10.1849 10.8424M13.5 6.5C13.5 8.98528 11.4853 11 9 11C6.51472 11 4.5 8.98528 4.5 6.5C4.5 4.01472 6.51472 2 9 2C11.4853 2 13.5 4.01472 13.5 6.5Z' stroke='#667085' stroke-linecap='round' stroke-linejoin='round'/></svg>";class b extends f{constructor(t){super({...t,icon:t.icon||k,title:t.title||"Color"}),this.inputType="color"}draw(){const t=document.createElement("div");t.className="color-setting-wrapper";const e=document.createElement("div");e.className="icon-container";const i=this.createIcon(this.props.icon||k),n=this.createLabel(this.title||"Color");e.appendChild(i),e.appendChild(n);const s=document.createElement("div");s.className="color-input-wrapper";const a=/^([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/,o=p=>{const u=p.value.startsWith("#")?p.value.slice(1):p.value;return a.test(u)?(p.style.border="",!0):(p.style.border="1px solid red",!1)},r=document.createElement("div");r.className="color-preview",r.style.backgroundColor=this.value||"";const h=this.createInput({value:this.value,inputType:"text",inputClassName:"color-text-input"}),c=h.querySelector("input"),m=this.createInput({value:this.value,inputType:this.inputType,inputClassName:"color-picker"}),M=m.querySelector("input");return c.oninput=p=>{var v;let u=p.target.value.trim();u.charAt(0)!=="#"&&(u="#"+u,c.value=u),o(c)&&(this.value=u,(v=this.onChange)==null||v.call(this,u),M.value=u,r.style.backgroundColor=u)},M.oninput=p=>{var v;let u=p.target.value;u.charAt(0)!=="#"&&(u="#"+u,M.value=u),this.value=u,(v=this.onChange)==null||v.call(this,u),c.value=u,r.style.backgroundColor=u,o(c)},s.appendChild(r),s.appendChild(m),s.appendChild(h),t.appendChild(e),t.appendChild(s),t}}class d extends C{constructor(t={}){super(t),this.inputType="number"}draw(){const t=s=>{this.props.minValue!==void 0&&(s.min=String(this.props.minValue)),this.props.maxValue!==void 0&&(s.max=String(this.props.maxValue)),this.props.className&&s.classList.add(this.props.className),s.addEventListener("input",()=>{const a=this.props.minValue??Number.MIN_SAFE_INTEGER,o=this.props.maxValue??Number.MAX_SAFE_INTEGER;let r=Number(s.value);r<a&&(r=a),r>o&&(r=o),s.value=String(r)})},e=this.createInput({value:this.value,inputType:this.inputType,title:this.props.title,icon:this.props.icon,inputClassName:"number-setting-input "+(this.props.inputClassName||""),wrapperClassName:"number-setting-wrapper "+(this.props.wrapperClassName||""),inputCustomizer:t});if(!this.props.suffix||this.props.suffix==="none")return e;e.classList.add("suffix-wrapper");const i=e.querySelector("input.number-setting-input");i&&(i.style.paddingRight="35px");const n=document.createElement("span");return n.className="suffix-label",n.textContent=this.props.suffix,e.appendChild(n),e}}class L extends d{constructor(t){super({...t,minValue:0,maxValue:100,icon:t.icon||V,title:t.title||"Opacity"}),this.inputType="number"}}const V=`
5
+ `,e.onclick=()=>{const a=t.querySelector(".setting-group-content");a&&(a.classList.toggle("collapsed"),n.classList.toggle("rotated"))},e.appendChild(i),e.appendChild(n);const s=document.createElement("div");s.className="setting-group-content";for(const a in this.settings)if(this.settings.hasOwnProperty(a)){const o=this.settings[a];s.appendChild(o.draw())}return t.appendChild(e),t.appendChild(s),t}}function b(l){switch(l){case"number":return 0;case"text":return"";case"select":return null;case"color":return"#000000";case"date":return new Date().toISOString().split("T")[0];case"button":return"";default:return""}}class d{constructor(t={}){this.props=t,this.id=t.id||x(),this.value=this.props.default,this.title=t.title||""}setOnChange(t){return this.onChange=t,this}setValue(t){this.value=t,this.inputEl&&(this.inputEl.value=String(t)),this.onChange&&this.onChange(t)}createInput(t){t={...this.props.inputProps,...t};const e=document.createElement("div");if(e.className=t.wrapperClassName||"",t.title||t.icon){const s=document.createElement("div");if(s.className="icon-container",t.icon){const a=this.createIcon(t.icon,t.iconClassName);s.appendChild(a)}if(t.title){const a=this.createLabel(t.title,t.labelClassName);s.appendChild(a)}e.appendChild(s)}const i=document.createElement("div");i.className=t.wrapperClassName||"";const n=document.createElement("input");return this.inputEl=n,n.value=String(t.value||b(t.inputType)),n.type=t.inputType,n.placeholder=t.placeholder||"",n.className=t.inputClassName||"",n.oninput=s=>{const a=s.target;let o=a.value;t.inputType==="number"?o=Number(a.value):(t.inputType==="color"||t.inputType==="date")&&(o=a.value),this.value=o,this.onChange&&this.onChange(this.value)},t.inputCustomizer&&t.inputCustomizer(n),i.appendChild(n),e.appendChild(i),e}createLabel(t,e){const i=document.createElement("span");return i.textContent=t,i.className="input-label "+(e||""),i}createIcon(t,e){const i=document.createElement("span");return i.className="input-icon "+(e||""),i.innerHTML=t,i}}class v extends d{constructor(t){super({...t,default:t.default!==void 0?t.default:"auto"}),this.inputType="number",this.value=t.default!==void 0?t.default:"auto"}draw(){const t=this.value==="auto"?"text":"number",e=o=>{this.value!=="auto"&&(this.props.minValue!==void 0&&(o.min=String(this.props.minValue)),this.props.maxValue!==void 0&&(o.max=String(this.props.maxValue)),this.props.className&&o.classList.add(this.props.className),o.addEventListener("input",()=>{const r=this.props.minValue??Number.MIN_SAFE_INTEGER,h=this.props.maxValue??Number.MAX_SAFE_INTEGER;let u=Number(o.value);u<r&&(u=r),u>h&&(u=h),o.value=String(u)}))},i=this.createInput({value:this.value,inputType:t,title:this.props.title,icon:this.props.icon,inputClassName:"number-setting-input "+(this.props.inputClassName||""),wrapperClassName:"number-setting-wrapper "+(this.props.wrapperClassName||""),inputCustomizer:e,placeholder:this.value==="auto"?"auto":""});if(!this.props.suffix||this.props.suffix==="none")return i;i.classList.add("suffix-wrapper");const n=i.querySelector("input.number-setting-input");n&&(n.style.paddingRight="35px");const s=document.createElement("span");s.className="suffix-label",s.textContent=this.props.suffix,i.appendChild(s);const a=i.querySelector("input");return a&&(a.oninput=o=>{const r=o.target.value.trim();if(r.toLowerCase()==="auto")this.value="auto";else{const h=Number(r);isNaN(h)||(this.value=h)}this.onChange&&this.onChange(this.value)}),i}}class E extends m{constructor(){super({title:"Margins",settings:{marginTop:new v({title:"Top",icon:L,suffix:"px",default:"auto"}),marginRight:new v({title:"Right",icon:S,suffix:"px",default:0}),marginBottom:new v({title:"Bottom",icon:y,suffix:"px",default:0}),marginLeft:new v({title:"Left",icon:V,suffix:"px",default:0})}})}getCssCode(){const t=typeof this.settings.marginTop.value=="number"?`${this.settings.marginTop.value}px`:this.settings.marginTop.value,e=typeof this.settings.marginRight.value=="number"?`${this.settings.marginRight.value}px`:this.settings.marginRight.value,i=typeof this.settings.marginBottom.value=="number"?`${this.settings.marginBottom.value}px`:this.settings.marginBottom.value,n=typeof this.settings.marginLeft.value=="number"?`${this.settings.marginLeft.value}px`:this.settings.marginLeft.value;return`
6
+ margin-top: ${t};
7
+ margin-right: ${e};
8
+ margin-bottom: ${i};
9
+ margin-left: ${n};
10
+ `}}const L=`<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
11
+ <path d="M2.25 16.25H2.2575M2.25 9.5H2.2575M2.25 12.875H2.2575M2.25 6.125H2.2575M5.625 16.25H5.6325M5.625 9.5H5.6325M12.375 16.25H12.3825M12.375 9.5H12.3825M9 16.25H9.0075M9 9.5H9.0075M9 12.875H9.0075M9 6.125H9.0075M15.75 16.25H15.7575M15.75 9.5H15.7575M15.75 12.875H15.7575M15.75 6.125H15.7575M15.75 2.75H2.25" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
12
+ </svg>`,S=`<svg xmlns="http://www.w3.org/2000/svg" width="16" height="15" viewBox="0 0 16 15" fill="none">
13
+ <path d="M4.625 0.75H4.6325M4.625 7.5H4.6325M4.625 14.25H4.6325M11.375 0.75H11.3825M11.375 7.5H11.3825M11.375 14.25H11.3825M8 0.75H8.0075M8 7.5H8.0075M8 14.25H8.0075M8 10.875H8.0075M8 4.125H8.0075M1.25 0.75H1.2575M1.25 7.5H1.2575M1.25 14.25H1.2575M1.25 10.875H1.2575M1.25 4.125H1.2575M14.75 14.25V0.75" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
14
+ </svg>`,y=`<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
15
+ <path d="M2.25 2.75H2.2575M2.25 9.5H2.2575M2.25 12.875H2.2575M2.25 6.125H2.2575M5.625 2.75H5.6325M5.625 9.5H5.6325M12.375 2.75H12.3825M12.375 9.5H12.3825M9 2.75H9.0075M9 9.5H9.0075M9 12.875H9.0075M9 6.125H9.0075M15.75 2.75H15.7575M15.75 9.5H15.7575M15.75 12.875H15.7575M15.75 6.125H15.7575M15.75 16.25H2.25" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
16
+ </svg>`,V=`<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
17
+ <path d="M5.625 2.75H5.6325M5.625 9.5H5.6325M5.625 16.25H5.6325M12.375 2.75H12.3825M12.375 9.5H12.3825M12.375 16.25H12.3825M9 2.75H9.0075M9 9.5H9.0075M9 16.25H9.0075M9 12.875H9.0075M9 6.125H9.0075M15.75 2.75H15.7575M15.75 9.5H15.7575M15.75 16.25H15.7575M15.75 12.875H15.7575M15.75 6.125H15.7575M2.25 16.25V2.75" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
18
+ </svg>`;class N extends d{constructor(t={}){super(t),this.inputType="text"}draw(){const t=e=>{this.props.maxLength!==void 0&&(e.maxLength=this.props.maxLength),this.props.className&&e.classList.add(this.props.className)};return this.createInput({value:this.value,inputType:this.inputType,title:this.props.title,placeholder:this.props.placeholder,icon:this.props.icon,inputClassName:"string-setting-input "+(this.props.inputClassName||""),wrapperClassName:"string-setting-wrapper "+(this.props.wrapperClassName||""),inputCustomizer:t})}}const M="<svg xmlns='http://www.w3.org/2000/svg' width='18' height='19' viewBox='0 0 18 19' fill='none'><path d='M8.99999 15.8542C9.79613 16.5667 10.8475 17 12 17C14.4853 17 16.5 14.9853 16.5 12.5C16.5 10.4248 15.0953 8.67769 13.1849 8.15763M4.81513 8.15762C2.9047 8.67768 1.5 10.4248 1.5 12.5C1.5 14.9853 3.51472 17 6 17C8.48528 17 10.5 14.9853 10.5 12.5C10.5 11.9146 10.3882 11.3554 10.1849 10.8424M13.5 6.5C13.5 8.98528 11.4853 11 9 11C6.51472 11 4.5 8.98528 4.5 6.5C4.5 4.01472 6.51472 2 9 2C11.4853 2 13.5 4.01472 13.5 6.5Z' stroke='#667085' stroke-linecap='round' stroke-linejoin='round'/></svg>";class T extends N{constructor(t){super({...t,icon:t.icon||M,title:t.title||"Color"}),this.inputType="color"}draw(){const t=document.createElement("div");t.className="color-setting-wrapper";const e=document.createElement("div");e.className="icon-container";const i=this.createIcon(this.props.icon||M),n=this.createLabel(this.title||"Color");e.appendChild(i),e.appendChild(n);const s=document.createElement("div");s.className="color-input-wrapper";const a=/^([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/,o=p=>{const c=p.value.startsWith("#")?p.value.slice(1):p.value;return a.test(c)?(p.style.border="",!0):(p.style.border="1px solid red",!1)},r=document.createElement("div");r.className="color-preview",r.style.backgroundColor=this.value||"";const h=this.createInput({value:this.value,inputType:"text",inputClassName:"color-text-input"}),u=h.querySelector("input"),g=this.createInput({value:this.value,inputType:this.inputType,inputClassName:"color-picker"}),w=g.querySelector("input");return u.oninput=p=>{var C;let c=p.target.value.trim();c.charAt(0)!=="#"&&(c="#"+c,u.value=c),o(u)&&(this.value=c,(C=this.onChange)==null||C.call(this,c),w.value=c,r.style.backgroundColor=c)},w.oninput=p=>{var C;let c=p.target.value;c.charAt(0)!=="#"&&(c="#"+c,w.value=c),this.value=c,(C=this.onChange)==null||C.call(this,c),u.value=c,r.style.backgroundColor=c,o(u)},s.appendChild(r),s.appendChild(g),s.appendChild(h),t.appendChild(e),t.appendChild(s),t}}class f extends d{constructor(t={}){super(t),this.inputType="number"}draw(){const t=s=>{this.props.minValue!==void 0&&(s.min=String(this.props.minValue)),this.props.maxValue!==void 0&&(s.max=String(this.props.maxValue)),this.props.className&&s.classList.add(this.props.className),s.addEventListener("input",()=>{const a=this.props.minValue??Number.MIN_SAFE_INTEGER,o=this.props.maxValue??Number.MAX_SAFE_INTEGER;let r=Number(s.value);r<a&&(r=a),r>o&&(r=o),s.value=String(r)})},e=this.createInput({value:this.value,inputType:this.inputType,title:this.props.title,icon:this.props.icon,inputClassName:"number-setting-input "+(this.props.inputClassName||""),wrapperClassName:"number-setting-wrapper "+(this.props.wrapperClassName||""),inputCustomizer:t});if(!this.props.suffix||this.props.suffix==="none")return e;e.classList.add("suffix-wrapper");const i=e.querySelector("input.number-setting-input");i&&(i.style.paddingRight="35px");const n=document.createElement("span");return n.className="suffix-label",n.textContent=this.props.suffix,e.appendChild(n),e}}class I extends f{constructor(t){super({...t,minValue:0,maxValue:100,icon:t.icon||R,title:t.title||"Opacity"}),this.inputType="number"}}const R=`
6
19
  <svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
7
20
  <path d="M3.69749 15.365C3.54749 15.365 3.40502 15.305 3.30002 15.2C1.77752 13.6775 0.9375 11.6525 0.9375 9.5C0.9375 5.0525 4.5525 1.4375 9 1.4375C11.1525 1.4375 13.1775 2.2775 14.7 3.8C14.805 3.905 14.865 4.0475 14.865 4.1975C14.865 4.3475 14.805 4.49 14.7 4.595L4.09502 15.2C3.99002 15.305 3.84749 15.365 3.69749 15.365ZM9 2.5625C5.175 2.5625 2.0625 5.675 2.0625 9.5C2.0625 11.165 2.64751 12.74 3.71251 13.9925L13.4925 4.2125C12.24 3.1475 10.665 2.5625 9 2.5625Z" fill="#667085"/>
8
21
  <path d="M9.00014 17.5623C6.84764 17.5623 4.82266 16.7223 3.30016 15.1998C3.19516 15.0948 3.13513 14.9523 3.13513 14.8023C3.13513 14.6523 3.19516 14.5098 3.30016 14.4048L13.9051 3.79984C14.1226 3.58234 14.4826 3.58234 14.7001 3.79984C16.2226 5.32234 17.0626 7.34734 17.0626 9.49984C17.0626 13.9473 13.4476 17.5623 9.00014 17.5623ZM4.50764 14.7873C5.76014 15.8523 7.33514 16.4373 9.00014 16.4373C12.8251 16.4373 15.9376 13.3248 15.9376 9.49984C15.9376 7.83484 15.3526 6.25984 14.2876 5.00734L4.50764 14.7873Z" fill="#667085"/>
@@ -10,7 +23,7 @@
10
23
  <path d="M13.4025 15.5225C13.26 15.5225 13.1175 15.47 13.005 15.3575L8.06999 10.4225C7.85249 10.205 7.85249 9.84498 8.06999 9.62748C8.28749 9.40998 8.64748 9.40998 8.86498 9.62748L13.8 14.5625C14.0175 14.78 14.0175 15.14 13.8 15.3575C13.6875 15.47 13.545 15.5225 13.4025 15.5225Z" fill="#667085"/>
11
24
  <path d="M15.84 12.6648C15.6975 12.6648 15.555 12.6123 15.4425 12.4998L10.725 7.78234C10.5075 7.56484 10.5075 7.20484 10.725 6.98734C10.9425 6.76984 11.3025 6.76984 11.52 6.98734L16.2375 11.7048C16.455 11.9223 16.455 12.2823 16.2375 12.4998C16.1325 12.6048 15.99 12.6648 15.84 12.6648Z" fill="#667085"/>
12
25
  </svg>
13
- `;class x extends C{constructor(t={}){super(t),this.inputType="select",this.props.options||(this.props.options=[]),this.props.getOptionsAsync&&this.props.getOptionsAsync().then(e=>{this.props.options=[...this.props.options,...e],e.forEach(i=>{var n;(n=this.selectNode)==null||n.appendChild(this.createOption(i))})}).catch(e=>{console.error("Failed to fetch async options:",e)})}createOption(t){const e=document.createElement("option");return e.value=t.value,e.textContent=t.name,e}draw(){var o,r;const t=document.createElement("div");t.classList.add("select-container");const e=document.createElement("div");e.className="icon-container";const i=this.createIcon(this.props.icon||""),n=this.createLabel(this.props.title||""),s=document.createElement("select");return this.selectNode=s,s.classList.add("select"),s.onchange=h=>{var c;this.value=h.target.value,(c=this.onChange)==null||c.call(this,h.target.value)},[...this.props.options||[],...((r=(o=this.props).getOptions)==null?void 0:r.call(o))||[]].forEach(h=>{const c=this.createOption(h);s.appendChild(c)}),this.value&&(s.value=this.value),e.appendChild(i),e.appendChild(n),t.appendChild(e),t.appendChild(s),t}}class N extends C{constructor(t={}){super(t),this.inputType="button",this.value||(this.value="center")}draw(){const t=document.createElement("div");t.className="align-setting-wrapper";const e=document.createElement("label");e.className="align-setting-label",e.textContent=this.title||"Align",t.appendChild(e);const i=document.createElement("div");return i.className="align-options-container",[{name:"left",icon:`
26
+ `;class B extends d{constructor(t={}){super(t),this.inputType="select",this._options=[],t.options&&(this._options=[...t.options]),t.getOptions&&this._options.push(...t.getOptions()),t.getOptionsAsync&&t.getOptionsAsync().then(e=>{this._options.push(...e),this.selectNode&&e.forEach((i,n)=>{const s=this._options.length-e.length+n;this.selectNode.appendChild(this.createOption(i,s))})}).catch(e=>{console.error("Failed to fetch async options:",e)})}createOption(t,e){const i=document.createElement("option");return i.value=String(e),i.textContent=t.name,i}draw(){const t=document.createElement("div");if(t.classList.add("select-container"),this.props.icon||this.props.title){const i=document.createElement("div");if(i.className="icon-container",this.props.icon){const n=this.createIcon(this.props.icon);i.appendChild(n)}if(this.props.title){const n=this.createLabel(this.props.title);i.appendChild(n)}t.appendChild(i)}const e=document.createElement("select");if(this.selectNode=e,e.classList.add("select"),this._options.forEach((i,n)=>{const s=this.createOption(i,n);e.appendChild(s)}),this.value!==void 0){const i=this._options.findIndex(n=>n.value===this.value);i>=0&&(e.value=String(i))}return e.onchange=i=>{var a;const n=Number(i.target.value),s=this._options[n];s&&(this.value=s.value,(a=this.onChange)==null||a.call(this,this.value))},t.appendChild(e),t}}class O extends d{constructor(t={}){super(t),this.inputType="button",this.value||(this.value="center")}draw(){const t=document.createElement("div");t.className="align-setting-wrapper";const e=document.createElement("label");e.className="align-setting-label",e.textContent=this.title||"Align",t.appendChild(e);const i=document.createElement("div");return i.className="align-options-container",[{name:"left",icon:`
14
27
  <svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" fill="none">
15
28
  <path d="M10.5 7.5C11.1989 7.5 11.5484 7.5 11.824 7.38582C12.1916 7.23358 12.4836 6.94157 12.6358 6.57402C12.75 6.29837 12.75 5.94891 12.75 5.25C12.75 4.55109 12.75 4.20163 12.6358 3.92598C12.4836 3.55843 12.1916 3.26642 11.824 3.11418C11.5484 3 11.1989 3 10.5 3L4.5 3C3.80109 3 3.45163 3 3.17598 3.11418C2.80843 3.26642 2.51642 3.55843 2.36418 3.92597C2.25 4.20163 2.25 4.55109 2.25 5.25C2.25 5.94891 2.25 6.29837 2.36418 6.57402C2.51642 6.94157 2.80843 7.23358 3.17598 7.38582C3.45163 7.5 3.80109 7.5 4.5 7.5L10.5 7.5Z"
16
29
  stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"/>
@@ -31,7 +44,7 @@
31
44
  <path d="M13.5 15C14.1989 15 14.5484 15 14.824 14.8858C15.1916 14.7336 15.4836 14.4416 15.6358 14.074C15.75 13.7984 15.75 13.4489 15.75 12.75C15.75 12.0511 15.75 11.7016 15.6358 11.426C15.4836 11.0584 15.1916 10.7664 14.824 10.6142C14.5484 10.5 14.1989 10.5 13.5 10.5H4.5C3.80109 10.5 3.45163 10.5 3.17598 10.6142C2.80843 10.7664 2.51642 11.0584 2.36418 11.426C2.25 11.7016 2.25 12.0511 2.25 12.75C2.25 13.4489 2.25 13.7984 2.36418 14.074C2.51642 14.4416 2.80843 14.7336 3.17597 14.8858C3.45163 15 3.80109 15 4.5 15L13.5 15Z"
32
45
  stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"/>
33
46
  </svg>
34
- `}].forEach(s=>{const a=document.createElement("button");a.className="align-option-button",a.innerHTML=s.icon,this.value===s.name&&a.classList.add("selected"),a.addEventListener("click",()=>{var o;i.querySelectorAll(".align-option-button").forEach(r=>r.classList.remove("selected")),a.classList.add("selected"),this.value=s.name,(o=this.onChange)==null||o.call(this,this.value)}),i.appendChild(a)}),t.appendChild(i),t}}class T extends C{constructor(t){super(t),this.inputType="button"}draw(){const t=document.createElement("button");t.className="button-setting "+(this.props.className||""),t.textContent=this.props.label,t.addEventListener("click",()=>{this.props.onClick&&this.props.onClick()});const e=document.createElement("div");return e.className="button-setting-wrapper "+(this.props.wrapperClassName||""),e.appendChild(t),e}}class B extends C{constructor(t={}){super(t),this.inputType={width:"number",height:"number"},this.isUpdating=!1,this.value||(this.value={width:100,height:100}),this.locked=t.locked??!1,this.value.height===0&&(this.value.height=1),this.aspectRatio=this.value.width/this.value.height,this.widthSetting=new d({title:"Width",default:this.value.width,suffix:"px",minValue:t.minWidth??1,maxValue:t.maxWidth,icon:I}),this.heightSetting=new d({title:"Height",default:this.value.height,suffix:"px",minValue:t.minHeight??1,maxValue:t.maxHeight,icon:R}),this.widthSetting.setOnChange(e=>{var s;if(this.isUpdating||isNaN(e)||e<1)return;this.isUpdating=!0;let i=e,n=this.value.height;this.locked&&isFinite(this.aspectRatio)&&!isNaN(this.aspectRatio)&&(n=Math.round(i/this.aspectRatio),n<1&&(n=1)),this.value={width:i,height:n},n!==0&&(this.aspectRatio=i/n),(s=this.onChange)==null||s.call(this,this.value),this.heightSetting.setValue(n),this.isUpdating=!1}),this.heightSetting.setOnChange(e=>{var s;if(this.isUpdating||isNaN(e)||e<1)return;this.isUpdating=!0;let i=e,n=this.value.width;this.locked&&isFinite(this.aspectRatio)&&!isNaN(this.aspectRatio)&&(n=Math.round(i*this.aspectRatio),n<1&&(n=1)),this.value={width:n,height:i},i!==0&&(this.aspectRatio=n/i),(s=this.onChange)==null||s.call(this,this.value),this.widthSetting.setValue(n),this.isUpdating=!1})}toggleLock(t){if(this.locked=!this.locked,this.locked){const e=this.value.width,i=this.value.height;i!==0&&(this.aspectRatio=e/i)}t.innerHTML=this.getLockSVG(this.locked)}getLockSVG(t){return t?`
47
+ `}].forEach(s=>{const a=document.createElement("button");a.className="align-option-button",a.innerHTML=s.icon,this.value===s.name&&a.classList.add("selected"),a.addEventListener("click",()=>{var o;i.querySelectorAll(".align-option-button").forEach(r=>r.classList.remove("selected")),a.classList.add("selected"),this.value=s.name,(o=this.onChange)==null||o.call(this,this.value)}),i.appendChild(a)}),t.appendChild(i),t}}class A extends d{constructor(t){super(t),this.inputType="button"}draw(){const t=document.createElement("button");t.className="button-setting "+(this.props.className||""),t.textContent=this.props.label,t.addEventListener("click",()=>{this.props.onClick&&this.props.onClick()});const e=document.createElement("div");return e.className="button-setting-wrapper "+(this.props.wrapperClassName||""),e.appendChild(t),e}}class j extends d{constructor(t={}){super(t),this.inputType={width:"number",height:"number"},this.isUpdating=!1,this.value||(this.value={width:100,height:100}),this.locked=t.locked??!1,this.value.height===0&&(this.value.height=1),this.aspectRatio=this.value.width/this.value.height,this.widthSetting=new f({title:"Width",default:this.value.width,suffix:"px",minValue:t.minWidth??1,maxValue:t.maxWidth,icon:U}),this.heightSetting=new f({title:"Height",default:this.value.height,suffix:"px",minValue:t.minHeight??1,maxValue:t.maxHeight,icon:Z}),this.widthSetting.setOnChange(e=>{var s;if(this.isUpdating||isNaN(e)||e<1)return;this.isUpdating=!0;let i=e,n=this.value.height;this.locked&&isFinite(this.aspectRatio)&&!isNaN(this.aspectRatio)&&(n=Math.round(i/this.aspectRatio),n<1&&(n=1)),this.value={width:i,height:n},n!==0&&(this.aspectRatio=i/n),(s=this.onChange)==null||s.call(this,this.value),this.heightSetting.setValue(n),this.isUpdating=!1}),this.heightSetting.setOnChange(e=>{var s;if(this.isUpdating||isNaN(e)||e<1)return;this.isUpdating=!0;let i=e,n=this.value.width;this.locked&&isFinite(this.aspectRatio)&&!isNaN(this.aspectRatio)&&(n=Math.round(i*this.aspectRatio),n<1&&(n=1)),this.value={width:n,height:i},i!==0&&(this.aspectRatio=n/i),(s=this.onChange)==null||s.call(this,this.value),this.widthSetting.setValue(n),this.isUpdating=!1})}toggleLock(t){if(this.locked=!this.locked,this.locked){const e=this.value.width,i=this.value.height;i!==0&&(this.aspectRatio=e/i)}t.innerHTML=this.getLockSVG(this.locked)}getLockSVG(t){return t?`
35
48
  <svg xmlns="http://www.w3.org/2000/svg" width="10" height="10" viewBox="0 0 10 10" fill="none">
36
49
  <path d="M2.91663 4.58333V3.33333C2.91663 2.18274 3.84937 1.25 4.99996 1.25C6.00786 1.25 6.84859 1.96573 7.04162 2.91667M3.66663 8.75H6.33329C7.03336 8.75 7.38339 8.75 7.65078 8.61376C7.88598 8.49392 8.07721 8.30269 8.19705 8.06749C8.33329 7.8001 8.33329 7.45007 8.33329 6.75V6.58333C8.33329 5.88327 8.33329 5.53323 8.19705 5.26584C8.07721 5.03064 7.88598 4.83942 7.65078 4.71958C7.38339 4.58333 7.03336 4.58333 6.33329 4.58333H3.66663C2.96656 4.58333 2.61653 4.58333 2.34914 4.71958C2.11394 4.83942 1.92271 5.03064 1.80287 5.26584C1.66663 5.53323 1.66663 5.88327 1.66663 6.58333V6.75C1.66663 7.45007 1.66663 7.8001 1.80287 8.06749C1.92271 8.30269 2.11394 8.49392 2.34914 8.61376C2.61653 8.75 2.96656 8.75 3.66663 8.75Z" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
37
50
  </svg>
@@ -39,82 +52,15 @@
39
52
  <svg xmlns="http://www.w3.org/2000/svg" width="10" height="10" viewBox="0 0 10 10" fill="none">
40
53
  <path d="M2.91663 4.58333V3.33333C2.91663 2.18274 3.84937 1.25 4.99996 1.25M3.66663 8.75H6.33329C7.03336 8.75 7.38339 8.75 7.65078 8.61376C7.88598 8.49392 8.07721 8.30269 8.19705 8.06749C8.33329 7.8001 8.33329 7.45007 8.33329 6.75V6.58333C8.33329 5.88327 8.33329 5.53323 8.19705 5.26584C8.07721 5.03064 7.88598 4.83942 7.65078 4.71958C7.38339 4.58333 7.03336 4.58333 6.33329 4.58333H3.66663C2.96656 4.58333 2.61653 4.58333 2.34914 4.71958C2.11394 4.83942 1.92271 5.03064 1.80287 5.26584C1.66663 5.53323 1.66663 5.88327 1.66663 6.58333V6.75C1.66663 7.45007 1.66663 7.8001 1.80287 8.06749C1.92271 8.30269 2.11394 8.49392 2.34914 8.61376C2.61653 8.75 2.96656 8.75 3.66663 8.75Z" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
41
54
  </svg>
42
- `}draw(){const t=document.createElement("div");t.className="dimension-setting-container";const e=this.widthSetting.draw(),i=this.heightSetting.draw(),n=document.createElement("div");n.className="dimension-bracket";const s=document.createElement("span");return s.className="dimension-lock-icon",s.innerHTML=this.getLockSVG(this.locked),s.onclick=()=>this.toggleLock(s),n.appendChild(s),t.appendChild(e),t.appendChild(n),t.appendChild(i),t}}const I=`<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
55
+ `}draw(){const t=document.createElement("div");t.className="dimension-setting-container";const e=this.widthSetting.draw(),i=this.heightSetting.draw(),n=document.createElement("div");n.className="dimension-bracket";const s=document.createElement("span");return s.className="dimension-lock-icon",s.innerHTML=this.getLockSVG(this.locked),s.onclick=()=>this.toggleLock(s),n.appendChild(s),t.appendChild(e),t.appendChild(n),t.appendChild(i),t}}const U=`<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
43
56
  <path d="M4.5 9.5H13.5M4.5 9.5L6 7.25M4.5 9.5L6 11.75M13.5 9.5L12 7.25M13.5 9.5L12 11.75M15.75 16.25V2.75M2.25 16.25V2.75" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
44
- </svg>`,R=`<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
57
+ </svg>`,Z=`<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
45
58
  <path d="M9 14L9 5M9 14L6.75 12.5M9 14L11.25 12.5M9 5L6.75 6.5M9 5L11.25 6.5M15.75 2.75H2.25M15.75 16.25H2.25" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
46
- </svg>`,j=`
59
+ </svg>`,_=`
47
60
  <svg xmlns="http://www.w3.org/2000/svg" width="15" height="16" viewBox="0 0 15 16" fill="none">
48
61
  <path d="M5 10.5L7.5 8M7.5 8L10 10.5M7.5 8V13.625M12.5 10.9643C13.2634 10.3338 13.75 9.37996 13.75 8.3125C13.75 6.41402 12.211 4.875 10.3125 4.875C10.1759 4.875 10.0482 4.80375 9.97882 4.68609C9.16379 3.30302 7.65902 2.375 5.9375 2.375C3.34867 2.375 1.25 4.47367 1.25 7.0625C1.25 8.35381 1.77215 9.52317 2.61684 10.371" stroke="#475467" stroke-linecap="round" stroke-linejoin="round"/>
49
62
  </svg>
50
- `;class A extends C{constructor(t={}){super(t),this.inputType="button",!this.value&&t.defaultUrl&&(this.value=t.defaultUrl)}draw(){const t=document.createElement("div");t.className="upload-setting-wrapper";const e=document.createElement("img");e.className="upload-preview",e.src=this.value||this.props.defaultUrl||"";const i=document.createElement("button");i.className="upload-button",i.innerHTML=`
51
- <span class="upload-icon">${j}</span>
63
+ `;class W extends d{constructor(t={}){super(t),this.inputType="button",!this.value&&t.defaultUrl&&(this.value=t.defaultUrl)}draw(){const t=document.createElement("div");t.className="upload-setting-wrapper";const e=document.createElement("img");e.className="upload-preview",e.src=this.value||this.props.defaultUrl||"";const i=document.createElement("button");i.className="upload-button",i.innerHTML=`
64
+ <span class="upload-icon">${_}</span>
52
65
  <span class="upload-label">Upload</span>
53
- `;const n=document.createElement("input");return n.type="file",n.accept="image/*",n.style.display="none",i.onclick=()=>{n.click()},n.onchange=()=>{var a;const s=(a=n.files)==null?void 0:a[0];if(s){const o=new FileReader;o.onload=r=>{var c,m;const h=(c=r.target)==null?void 0:c.result;this.value=h,e.src=h,(m=this.onChange)==null||m.call(this,h)},o.readAsDataURL(s)}},t.appendChild(e),t.appendChild(i),t.appendChild(n),t}}const $=`
54
- <svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
55
- <path d="M5.625 9.5H5.6325M12.375 9.5H12.3825M9 9.5H9.0075M9 12.875H9.0075M9 6.125H9.0075M2.25 6.35L2.25 12.65C2.25 13.9101 2.25 14.5402 2.49524 15.0215C2.71095 15.4448 3.05516 15.789 3.47852 16.0048C3.95982 16.25 4.58988 16.25 5.85 16.25H12.15C13.4101 16.25 14.0402 16.25 14.5215 16.0048C14.9448 15.789 15.289 15.4448 15.5048 15.0215C15.75 14.5402 15.75 13.9101 15.75 12.65V6.35C15.75 5.08988 15.75 4.45982 15.5048 3.97852C15.289 3.55516 14.9448 3.21095 14.5215 2.99524C14.0402 2.75 13.4101 2.75 12.15 2.75L5.85 2.75C4.58988 2.75 3.95982 2.75 3.47852 2.99524C3.05516 3.21095 2.71095 3.55516 2.49524 3.97852C2.25 4.45982 2.25 5.08988 2.25 6.35Z" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
56
- </svg>
57
- `,O=`
58
- <svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
59
- <path d="M6 2.75H5.85C4.58988 2.75 3.95982 2.75 3.47852 2.99524C3.05516 3.21095 2.71095 3.55516 2.49524 3.97852C2.25 4.45982 2.25 5.08988 2.25 6.35V6.5M6 16.25H5.85C4.58988 16.25 3.95982 16.25 3.47852 16.0048C3.05516 15.789 2.71095 15.4448 2.49524 15.0215C2.25 14.5402 2.25 13.9101 2.25 12.65V12.5M15.75 6.5V6.35C15.75 5.08988 15.75 4.45982 15.5048 3.97852C15.289 3.55516 14.9448 3.21095 14.5215 2.99524C14.0402 2.75 13.4101 2.75 12.15 2.75H12M15.75 12.5V12.65C15.75 13.9101 15.75 14.5402 15.5048 15.0215C15.289 15.4448 14.9448 15.789 14.5215 16.0048C14.0402 16.25 13.4101 16.25 12.15 16.25H12" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
60
- </svg>
61
- `;class Z extends g{constructor(){super({title:"Border",settings:{color:new b({title:"Color",default:"#00141E"}),opacity:new d({title:"Opacity",default:100,maxValue:100,minValue:0}),radius:new d({title:"Radius",icon:$,default:12,suffix:"px"}),size:new d({title:"Size",icon:O,default:0,suffix:"px"})}})}getCssCode(){const t=this.settings.color.value??"#000000",e=this.settings.opacity.value??100,i=this.settings.radius.value??0,n=this.settings.size.value??0;return`
62
- /* Example CSS usage */
63
- border-color: ${t};
64
- border-width: ${n}px;
65
- border-radius: ${i}px;
66
- opacity: ${e/100};
67
- `}}const U=`
68
- <svg xmlns="http://www.w3.org/2000/svg" width="14" height="13" viewBox="0 0 14 13" fill="none">
69
- <path d="M1 2.75C1 2.05109 1 1.70163 1.11418 1.42597C1.26642 1.05843 1.55843 0.766422 1.92597 0.614181C2.20163 0.5 2.55109 0.5 3.25 0.5H10.75C11.4489 0.5 11.7984 0.5 12.074 0.614181C12.4416 0.766422 12.7336 1.05843 12.8858 1.42597C13 1.70163 13 2.05109 13 2.75M4.75 12.5H9.25M7 0.5V12.5" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
70
- </svg>
71
- `,G=`
72
- <svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
73
- <path d="M3 5.75C3 5.05109 3 4.70163 3.11418 4.42597C3.26642 4.05843 3.55843 3.76642 3.92597 3.61418C4.20163 3.5 4.55109 3.5 5.25 3.5H12.75C13.4489 3.5 13.7984 3.5 14.074 3.61418C14.4416 3.76642 14.7336 4.05843 14.8858 4.42597C15 4.70163 15 5.05109 15 5.75M6 15.5H12M7.6875 3.5V15.5M10.3125 3.5V15.5" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
74
- </svg>
75
- `,z=`
76
- <svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
77
- <path d="M6 5.75H12M9 5.75V13.25M5.85 16.25H12.15C13.4101 16.25 14.0402 16.25 14.5215 16.0048C14.9448 15.789 15.289 15.4448 15.5048 15.0215C15.75 14.5402 15.75 13.9101 15.75 12.65V6.35C15.75 5.08988 15.75 4.45982 15.5048 3.97852C15.289 3.55516 14.9448 3.21095 14.5215 2.99524C14.0402 2.75 13.4101 2.75 12.15 2.75H5.85C4.58988 2.75 3.95982 2.75 3.47852 2.99524C3.05516 3.21095 2.71095 3.55516 2.49524 3.97852C2.25 4.45982 2.25 5.08988 2.25 6.35V12.65C2.25 13.9101 2.25 14.5402 2.49524 15.0215C2.71095 15.4448 3.05516 15.789 3.47852 16.0048C3.95982 16.25 4.58988 16.25 5.85 16.25Z" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
78
- </svg>
79
- `;class W extends g{constructor(){super({title:"Header Typography",settings:{color:new b({title:"Color",default:"#00141E"}),opacity:new d({title:"Opacity",default:100}),fontFamily:new x({title:"Font",icon:U,default:"Satoshi",options:[{name:"Satoshi",value:"Satoshi"},{name:"Arial",value:"Arial"},{name:"Roboto",value:"Roboto"}]}),fontWeight:new x({title:"Weight",icon:G,default:"bold",options:[{name:"Regular",value:"regular"},{name:"Medium",value:"medium"},{name:"Bold",value:"bold"}]}),fontSize:new d({title:"Size",icon:z,default:12,suffix:"px"}),align:new N({title:"Align",default:"center"})}})}getCssCode(){const t=this.settings.color.value??"#000000",e=this.settings.opacity.value??100,i=this.settings.fontFamily.value??"Satoshi",n=this.settings.fontWeight.value??"bold",s=this.settings.fontSize.value??12,a=this.settings.align.value??"left";return`
80
- color: ${t};
81
- opacity: ${e/100};
82
- font-family: ${i};
83
- font-weight: ${n};
84
- font-size: ${s}px;
85
- text-align: ${a};
86
- `}}class w extends C{constructor(t){super({...t,default:t.default!==void 0?t.default:"auto"}),this.inputType="number",this.value=t.default!==void 0?t.default:"auto"}draw(){const t=this.value==="auto"?"text":"number",e=o=>{this.value!=="auto"&&(this.props.minValue!==void 0&&(o.min=String(this.props.minValue)),this.props.maxValue!==void 0&&(o.max=String(this.props.maxValue)),this.props.className&&o.classList.add(this.props.className),o.addEventListener("input",()=>{const r=this.props.minValue??Number.MIN_SAFE_INTEGER,h=this.props.maxValue??Number.MAX_SAFE_INTEGER;let c=Number(o.value);c<r&&(c=r),c>h&&(c=h),o.value=String(c)}))},i=this.createInput({value:this.value,inputType:t,title:this.props.title,icon:this.props.icon,inputClassName:"number-setting-input "+(this.props.inputClassName||""),wrapperClassName:"number-setting-wrapper "+(this.props.wrapperClassName||""),inputCustomizer:e,placeholder:this.value==="auto"?"auto":""});if(!this.props.suffix||this.props.suffix==="none")return i;i.classList.add("suffix-wrapper");const n=i.querySelector("input.number-setting-input");n&&(n.style.paddingRight="35px");const s=document.createElement("span");s.className="suffix-label",s.textContent=this.props.suffix,i.appendChild(s);const a=i.querySelector("input");return a&&(a.oninput=o=>{const r=o.target.value.trim();if(r.toLowerCase()==="auto")this.value="auto";else{const h=Number(r);isNaN(h)||(this.value=h)}this.onChange&&this.onChange(this.value)}),i}}class _ extends g{constructor(){super({title:"Margins",settings:{marginTop:new w({title:"Top",icon:F,suffix:"px",default:"auto"}),marginRight:new w({title:"Right",icon:q,suffix:"px",default:0}),marginBottom:new w({title:"Bottom",icon:D,suffix:"px",default:0}),marginLeft:new w({title:"Left",icon:P,suffix:"px",default:0})}})}getCssCode(){const t=typeof this.settings.marginTop.value=="number"?`${this.settings.marginTop.value}px`:this.settings.marginTop.value,e=typeof this.settings.marginRight.value=="number"?`${this.settings.marginRight.value}px`:this.settings.marginRight.value,i=typeof this.settings.marginBottom.value=="number"?`${this.settings.marginBottom.value}px`:this.settings.marginBottom.value,n=typeof this.settings.marginLeft.value=="number"?`${this.settings.marginLeft.value}px`:this.settings.marginLeft.value;return`
87
- margin-top: ${t};
88
- margin-right: ${e};
89
- margin-bottom: ${i};
90
- margin-left: ${n};
91
- `}}const F=`<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
92
- <path d="M2.25 16.25H2.2575M2.25 9.5H2.2575M2.25 12.875H2.2575M2.25 6.125H2.2575M5.625 16.25H5.6325M5.625 9.5H5.6325M12.375 16.25H12.3825M12.375 9.5H12.3825M9 16.25H9.0075M9 9.5H9.0075M9 12.875H9.0075M9 6.125H9.0075M15.75 16.25H15.7575M15.75 9.5H15.7575M15.75 12.875H15.7575M15.75 6.125H15.7575M15.75 2.75H2.25" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
93
- </svg>`,q=`<svg xmlns="http://www.w3.org/2000/svg" width="16" height="15" viewBox="0 0 16 15" fill="none">
94
- <path d="M4.625 0.75H4.6325M4.625 7.5H4.6325M4.625 14.25H4.6325M11.375 0.75H11.3825M11.375 7.5H11.3825M11.375 14.25H11.3825M8 0.75H8.0075M8 7.5H8.0075M8 14.25H8.0075M8 10.875H8.0075M8 4.125H8.0075M1.25 0.75H1.2575M1.25 7.5H1.2575M1.25 14.25H1.2575M1.25 10.875H1.2575M1.25 4.125H1.2575M14.75 14.25V0.75" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
95
- </svg>`,D=`<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
96
- <path d="M2.25 2.75H2.2575M2.25 9.5H2.2575M2.25 12.875H2.2575M2.25 6.125H2.2575M5.625 2.75H5.6325M5.625 9.5H5.6325M12.375 2.75H12.3825M12.375 9.5H12.3825M9 2.75H9.0075M9 9.5H9.0075M9 12.875H9.0075M9 6.125H9.0075M15.75 2.75H15.7575M15.75 9.5H15.7575M15.75 12.875H15.7575M15.75 6.125H15.7575M15.75 16.25H2.25" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
97
- </svg>`,P=`<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
98
- <path d="M5.625 2.75H5.6325M5.625 9.5H5.6325M5.625 16.25H5.6325M12.375 2.75H12.3825M12.375 9.5H12.3825M12.375 16.25H12.3825M9 2.75H9.0075M9 9.5H9.0075M9 16.25H9.0075M9 12.875H9.0075M9 6.125H9.0075M15.75 2.75H15.7575M15.75 9.5H15.7575M15.75 16.25H15.7575M15.75 12.875H15.7575M15.75 6.125H15.7575M2.25 16.25V2.75" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
99
- </svg>`;class X extends g{constructor(t,e){super({title:`Tab ${t+1}`,settings:{name:new f({title:"Tab Name",default:`Tab ${t+1}`}),content:new f({title:"Content",default:""})}}),this.onDeleteCallback=e}draw(){const t=super.draw(),e=t.querySelector(".setting-group-arrow");e&&e.parentElement&&e.parentElement.removeChild(e);const i=t.querySelector(".setting-group-title");if(i){const n=document.createElement("div");n.className="tab-delete-container";const s=document.createElement("button");s.className="tab-delete-button",s.innerHTML=`
100
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="#f87171" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="trash-icon">
101
- <polyline points="3 6 5 6 21 6"></polyline>
102
- <path d="M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6"></path>
103
- <path d="M10 11v6"></path>
104
- <path d="M14 11v6"></path>
105
- <path d="M9 6V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2"></path>
106
- </svg>
107
- `,s.onclick=()=>{var o;return(o=this.onDeleteCallback)==null?void 0:o.call(this)},n.appendChild(s);const a=i.querySelector("h3");a?a.insertAdjacentElement("afterend",n):i.appendChild(n)}return t}}class J extends g{constructor(){super({title:"Tabs",settings:{}}),this.tabs=[],this._el=null,this.addTab()}addTab(){const t=this.tabs.length,e=new X(t,()=>this.removeTab(e));this.tabs.push(e),this.settings[`Tab ${t+1}`]=e}removeTab(t){const e=this.tabs.indexOf(t);e>=0&&(this.tabs.splice(e,1),delete this.settings[`Tab ${e+1}`],this.relabelTabs(),this.rerender())}relabelTabs(){this.settings={},this.tabs.forEach((t,e)=>{t.title=`Tab ${e+1}`,this.settings[`Tab ${e+1}`]=t})}draw(){const t=super.draw();this._el=t;const e=document.createElement("div");e.className="tabs-add-btn-container";const i=document.createElement("button");return i.className="tabs-add-button",i.innerHTML=`
108
- <span class="add-icon">
109
- <svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" stroke="#667085">
110
- <g id="SVGRepo_bgCarrier" stroke-width="0"></g>
111
- <g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g>
112
- <g id="SVGRepo_iconCarrier">
113
- <g id="Edit / Add_Plus">
114
- <path id="Vector" d="M6 12H12M12 12H18M12 12V18M12 12V6" stroke="#667085" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path>
115
- </g>
116
- </g>
117
- </svg>
118
- </span>
119
- <span class="add-label">Add Tab</span>
120
- `,i.onclick=()=>{this.addTab(),this.rerender()},e.appendChild(i),t.appendChild(e),t}rerender(){if(!this._el)return;const t=this._el.querySelector(".setting-group-content");t&&(t.innerHTML="",Object.keys(this.settings).forEach(e=>{const i=this.settings[e];t.appendChild(i.draw())}))}}exports.AlignSetting=N;exports.BorderSettingSet=Z;exports.ButtonSetting=T;exports.ColorSetting=b;exports.DimensionSetting=B;exports.HeaderTypographySettingSet=W;exports.MarginSettingGroup=_;exports.NumberSetting=d;exports.OpacitySetting=L;exports.SelectSetting=x;exports.Setting=C;exports.SettingGroup=g;exports.StringSetting=f;exports.TabsContainerGroup=J;exports.UploadSetting=A;exports.iterateSettings=S;
66
+ `;const n=document.createElement("input");return n.type="file",n.accept="image/*",n.style.display="none",i.onclick=()=>{n.click()},n.onchange=()=>{var a;const s=(a=n.files)==null?void 0:a[0];if(s){const o=new FileReader;o.onload=r=>{var u,g;const h=(u=r.target)==null?void 0:u.result;this.value=h,e.src=h,(g=this.onChange)==null||g.call(this,h)},o.readAsDataURL(s)}},t.appendChild(e),t.appendChild(i),t.appendChild(n),t}}exports.AlignSetting=O;exports.ButtonSetting=A;exports.ColorSetting=T;exports.DimensionSetting=j;exports.MarginSettingGroup=E;exports.NumberSetting=f;exports.OpacitySetting=I;exports.SelectSetting=B;exports.Setting=d;exports.SettingGroup=m;exports.StringSetting=N;exports.UploadSetting=W;exports.iterateSettings=H;
@@ -1,23 +1,23 @@
1
- const N = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
2
- let k = (l = 21) => {
1
+ const H = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
2
+ let x = (l = 21) => {
3
3
  let t = "", e = crypto.getRandomValues(new Uint8Array(l |= 0));
4
4
  for (; l--; )
5
- t += N[e[l] & 63];
5
+ t += H[e[l] & 63];
6
6
  return t;
7
7
  };
8
- function E(l, t) {
8
+ function k(l, t) {
9
9
  for (const e in l)
10
10
  if (l.hasOwnProperty(e)) {
11
11
  const i = l[e];
12
12
  t(e, i);
13
13
  }
14
14
  }
15
- class g {
15
+ class v {
16
16
  constructor(t) {
17
- this.id = t.id || k(), this.title = t.title, this.settings = t.settings, Object.assign(this, t.settings);
17
+ this.id = t.id || x(), this.title = t.title, this.settings = t.settings, Object.assign(this, t.settings);
18
18
  }
19
19
  setOnChange(t) {
20
- return this.onChange = t, E(this.settings, (e, i) => {
20
+ return this.onChange = t, k(this.settings, (e, i) => {
21
21
  i.setOnChange(t);
22
22
  }), this;
23
23
  }
@@ -31,12 +31,12 @@ class g {
31
31
  for (const i in this.settings)
32
32
  if (this.settings.hasOwnProperty(i)) {
33
33
  const n = this.settings[i];
34
- n instanceof g ? e[i] = n.getValues() : e[i] = n.value;
34
+ n instanceof v ? e[i] = n.getValues() : e[i] = n.value;
35
35
  }
36
36
  return e;
37
37
  } else {
38
38
  const e = this.settings[t];
39
- return e ? e instanceof g ? e.getValues() : e.value : void 0;
39
+ return e ? e instanceof v ? e.getValues() : e.value : void 0;
40
40
  }
41
41
  }
42
42
  draw() {
@@ -65,7 +65,7 @@ class g {
65
65
  return t.appendChild(e), t.appendChild(s), t;
66
66
  }
67
67
  }
68
- function y(l) {
68
+ function N(l) {
69
69
  switch (l) {
70
70
  case "number":
71
71
  return 0;
@@ -83,9 +83,9 @@ function y(l) {
83
83
  return "";
84
84
  }
85
85
  }
86
- class C {
86
+ class d {
87
87
  constructor(t = {}) {
88
- this.props = t, this.id = t.id || k(), this.value = this.props.default, this.title = t.title || "";
88
+ this.props = t, this.id = t.id || x(), this.value = this.props.default, this.title = t.title || "";
89
89
  }
90
90
  setOnChange(t) {
91
91
  return this.onChange = t, this;
@@ -111,7 +111,7 @@ class C {
111
111
  const i = document.createElement("div");
112
112
  i.className = t.wrapperClassName || "";
113
113
  const n = document.createElement("input");
114
- return this.inputEl = n, n.value = String(t.value || y(t.inputType)), n.type = t.inputType, n.placeholder = t.placeholder || "", n.className = t.inputClassName || "", n.oninput = (s) => {
114
+ return this.inputEl = n, n.value = String(t.value || N(t.inputType)), n.type = t.inputType, n.placeholder = t.placeholder || "", n.className = t.inputClassName || "", n.oninput = (s) => {
115
115
  const a = s.target;
116
116
  let o = a.value;
117
117
  t.inputType === "number" ? o = Number(a.value) : (t.inputType === "color" || t.inputType === "date") && (o = a.value), this.value = o, this.onChange && this.onChange(this.value);
@@ -126,7 +126,104 @@ class C {
126
126
  return i.className = "input-icon " + (e || ""), i.innerHTML = t, i;
127
127
  }
128
128
  }
129
- class M extends C {
129
+ class m extends d {
130
+ constructor(t) {
131
+ super({
132
+ ...t,
133
+ default: t.default !== void 0 ? t.default : "auto"
134
+ }), this.inputType = "number", this.value = t.default !== void 0 ? t.default : "auto";
135
+ }
136
+ draw() {
137
+ const t = this.value === "auto" ? "text" : "number", e = (o) => {
138
+ this.value !== "auto" && (this.props.minValue !== void 0 && (o.min = String(this.props.minValue)), this.props.maxValue !== void 0 && (o.max = String(this.props.maxValue)), this.props.className && o.classList.add(this.props.className), o.addEventListener("input", () => {
139
+ const r = this.props.minValue ?? Number.MIN_SAFE_INTEGER, u = this.props.maxValue ?? Number.MAX_SAFE_INTEGER;
140
+ let h = Number(o.value);
141
+ h < r && (h = r), h > u && (h = u), o.value = String(h);
142
+ }));
143
+ }, i = this.createInput({
144
+ value: this.value,
145
+ inputType: t,
146
+ title: this.props.title,
147
+ icon: this.props.icon,
148
+ inputClassName: "number-setting-input " + (this.props.inputClassName || ""),
149
+ wrapperClassName: "number-setting-wrapper " + (this.props.wrapperClassName || ""),
150
+ inputCustomizer: e,
151
+ placeholder: this.value === "auto" ? "auto" : ""
152
+ });
153
+ if (!this.props.suffix || this.props.suffix === "none")
154
+ return i;
155
+ i.classList.add("suffix-wrapper");
156
+ const n = i.querySelector(
157
+ "input.number-setting-input"
158
+ );
159
+ n && (n.style.paddingRight = "35px");
160
+ const s = document.createElement("span");
161
+ s.className = "suffix-label", s.textContent = this.props.suffix, i.appendChild(s);
162
+ const a = i.querySelector("input");
163
+ return a && (a.oninput = (o) => {
164
+ const r = o.target.value.trim();
165
+ if (r.toLowerCase() === "auto")
166
+ this.value = "auto";
167
+ else {
168
+ const u = Number(r);
169
+ isNaN(u) || (this.value = u);
170
+ }
171
+ this.onChange && this.onChange(this.value);
172
+ }), i;
173
+ }
174
+ }
175
+ class B extends v {
176
+ constructor() {
177
+ super({
178
+ title: "Margins",
179
+ settings: {
180
+ marginTop: new m({
181
+ title: "Top",
182
+ icon: E,
183
+ suffix: "px",
184
+ default: "auto"
185
+ }),
186
+ marginRight: new m({
187
+ title: "Right",
188
+ icon: b,
189
+ suffix: "px",
190
+ default: 0
191
+ }),
192
+ marginBottom: new m({
193
+ title: "Bottom",
194
+ icon: L,
195
+ suffix: "px",
196
+ default: 0
197
+ }),
198
+ marginLeft: new m({
199
+ title: "Left",
200
+ icon: y,
201
+ suffix: "px",
202
+ default: 0
203
+ })
204
+ }
205
+ });
206
+ }
207
+ getCssCode() {
208
+ const t = typeof this.settings.marginTop.value == "number" ? `${this.settings.marginTop.value}px` : this.settings.marginTop.value, e = typeof this.settings.marginRight.value == "number" ? `${this.settings.marginRight.value}px` : this.settings.marginRight.value, i = typeof this.settings.marginBottom.value == "number" ? `${this.settings.marginBottom.value}px` : this.settings.marginBottom.value, n = typeof this.settings.marginLeft.value == "number" ? `${this.settings.marginLeft.value}px` : this.settings.marginLeft.value;
209
+ return `
210
+ margin-top: ${t};
211
+ margin-right: ${e};
212
+ margin-bottom: ${i};
213
+ margin-left: ${n};
214
+ `;
215
+ }
216
+ }
217
+ const E = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
218
+ <path d="M2.25 16.25H2.2575M2.25 9.5H2.2575M2.25 12.875H2.2575M2.25 6.125H2.2575M5.625 16.25H5.6325M5.625 9.5H5.6325M12.375 16.25H12.3825M12.375 9.5H12.3825M9 16.25H9.0075M9 9.5H9.0075M9 12.875H9.0075M9 6.125H9.0075M15.75 16.25H15.7575M15.75 9.5H15.7575M15.75 12.875H15.7575M15.75 6.125H15.7575M15.75 2.75H2.25" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
219
+ </svg>`, b = `<svg xmlns="http://www.w3.org/2000/svg" width="16" height="15" viewBox="0 0 16 15" fill="none">
220
+ <path d="M4.625 0.75H4.6325M4.625 7.5H4.6325M4.625 14.25H4.6325M11.375 0.75H11.3825M11.375 7.5H11.3825M11.375 14.25H11.3825M8 0.75H8.0075M8 7.5H8.0075M8 14.25H8.0075M8 10.875H8.0075M8 4.125H8.0075M1.25 0.75H1.2575M1.25 7.5H1.2575M1.25 14.25H1.2575M1.25 10.875H1.2575M1.25 4.125H1.2575M14.75 14.25V0.75" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
221
+ </svg>`, L = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
222
+ <path d="M2.25 2.75H2.2575M2.25 9.5H2.2575M2.25 12.875H2.2575M2.25 6.125H2.2575M5.625 2.75H5.6325M5.625 9.5H5.6325M12.375 2.75H12.3825M12.375 9.5H12.3825M9 2.75H9.0075M9 9.5H9.0075M9 12.875H9.0075M9 6.125H9.0075M15.75 2.75H15.7575M15.75 9.5H15.7575M15.75 12.875H15.7575M15.75 6.125H15.7575M15.75 16.25H2.25" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
223
+ </svg>`, y = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
224
+ <path d="M5.625 2.75H5.6325M5.625 9.5H5.6325M5.625 16.25H5.6325M12.375 2.75H12.3825M12.375 9.5H12.3825M12.375 16.25H12.3825M9 2.75H9.0075M9 9.5H9.0075M9 16.25H9.0075M9 12.875H9.0075M9 6.125H9.0075M15.75 2.75H15.7575M15.75 9.5H15.7575M15.75 16.25H15.7575M15.75 12.875H15.7575M15.75 6.125H15.7575M2.25 16.25V2.75" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
225
+ </svg>`;
226
+ class S extends d {
130
227
  constructor(t = {}) {
131
228
  super(t), this.inputType = "text";
132
229
  }
@@ -146,12 +243,12 @@ class M extends C {
146
243
  });
147
244
  }
148
245
  }
149
- const x = "<svg xmlns='http://www.w3.org/2000/svg' width='18' height='19' viewBox='0 0 18 19' fill='none'><path d='M8.99999 15.8542C9.79613 16.5667 10.8475 17 12 17C14.4853 17 16.5 14.9853 16.5 12.5C16.5 10.4248 15.0953 8.67769 13.1849 8.15763M4.81513 8.15762C2.9047 8.67768 1.5 10.4248 1.5 12.5C1.5 14.9853 3.51472 17 6 17C8.48528 17 10.5 14.9853 10.5 12.5C10.5 11.9146 10.3882 11.3554 10.1849 10.8424M13.5 6.5C13.5 8.98528 11.4853 11 9 11C6.51472 11 4.5 8.98528 4.5 6.5C4.5 4.01472 6.51472 2 9 2C11.4853 2 13.5 4.01472 13.5 6.5Z' stroke='#667085' stroke-linecap='round' stroke-linejoin='round'/></svg>";
150
- class H extends M {
246
+ const M = "<svg xmlns='http://www.w3.org/2000/svg' width='18' height='19' viewBox='0 0 18 19' fill='none'><path d='M8.99999 15.8542C9.79613 16.5667 10.8475 17 12 17C14.4853 17 16.5 14.9853 16.5 12.5C16.5 10.4248 15.0953 8.67769 13.1849 8.15763M4.81513 8.15762C2.9047 8.67768 1.5 10.4248 1.5 12.5C1.5 14.9853 3.51472 17 6 17C8.48528 17 10.5 14.9853 10.5 12.5C10.5 11.9146 10.3882 11.3554 10.1849 10.8424M13.5 6.5C13.5 8.98528 11.4853 11 9 11C6.51472 11 4.5 8.98528 4.5 6.5C4.5 4.01472 6.51472 2 9 2C11.4853 2 13.5 4.01472 13.5 6.5Z' stroke='#667085' stroke-linecap='round' stroke-linejoin='round'/></svg>";
247
+ class O extends S {
151
248
  constructor(t) {
152
249
  super({
153
250
  ...t,
154
- icon: t.icon || x,
251
+ icon: t.icon || M,
155
252
  title: t.title || "Color"
156
253
  }), this.inputType = "color";
157
254
  }
@@ -160,40 +257,40 @@ class H extends M {
160
257
  t.className = "color-setting-wrapper";
161
258
  const e = document.createElement("div");
162
259
  e.className = "icon-container";
163
- const i = this.createIcon(this.props.icon || x), n = this.createLabel(this.title || "Color");
260
+ const i = this.createIcon(this.props.icon || M), n = this.createLabel(this.title || "Color");
164
261
  e.appendChild(i), e.appendChild(n);
165
262
  const s = document.createElement("div");
166
263
  s.className = "color-input-wrapper";
167
264
  const a = /^([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/, o = (p) => {
168
- const u = p.value.startsWith("#") ? p.value.slice(1) : p.value;
169
- return a.test(u) ? (p.style.border = "", !0) : (p.style.border = "1px solid red", !1);
265
+ const c = p.value.startsWith("#") ? p.value.slice(1) : p.value;
266
+ return a.test(c) ? (p.style.border = "", !0) : (p.style.border = "1px solid red", !1);
170
267
  }, r = document.createElement("div");
171
268
  r.className = "color-preview", r.style.backgroundColor = this.value || "";
172
- const h = this.createInput({
269
+ const u = this.createInput({
173
270
  value: this.value,
174
271
  inputType: "text",
175
272
  inputClassName: "color-text-input"
176
- }), c = h.querySelector(
273
+ }), h = u.querySelector(
177
274
  "input"
178
- ), m = this.createInput({
275
+ ), g = this.createInput({
179
276
  value: this.value,
180
277
  inputType: this.inputType,
181
278
  inputClassName: "color-picker"
182
- }), f = m.querySelector(
279
+ }), f = g.querySelector(
183
280
  "input"
184
281
  );
185
- return c.oninput = (p) => {
186
- var v;
187
- let u = p.target.value.trim();
188
- u.charAt(0) !== "#" && (u = "#" + u, c.value = u), o(c) && (this.value = u, (v = this.onChange) == null || v.call(this, u), f.value = u, r.style.backgroundColor = u);
282
+ return h.oninput = (p) => {
283
+ var C;
284
+ let c = p.target.value.trim();
285
+ c.charAt(0) !== "#" && (c = "#" + c, h.value = c), o(h) && (this.value = c, (C = this.onChange) == null || C.call(this, c), f.value = c, r.style.backgroundColor = c);
189
286
  }, f.oninput = (p) => {
190
- var v;
191
- let u = p.target.value;
192
- u.charAt(0) !== "#" && (u = "#" + u, f.value = u), this.value = u, (v = this.onChange) == null || v.call(this, u), c.value = u, r.style.backgroundColor = u, o(c);
193
- }, s.appendChild(r), s.appendChild(m), s.appendChild(h), t.appendChild(e), t.appendChild(s), t;
287
+ var C;
288
+ let c = p.target.value;
289
+ c.charAt(0) !== "#" && (c = "#" + c, f.value = c), this.value = c, (C = this.onChange) == null || C.call(this, c), h.value = c, r.style.backgroundColor = c, o(h);
290
+ }, s.appendChild(r), s.appendChild(g), s.appendChild(u), t.appendChild(e), t.appendChild(s), t;
194
291
  }
195
292
  }
196
- class d extends C {
293
+ class w extends d {
197
294
  constructor(t = {}) {
198
295
  super(t), this.inputType = "number";
199
296
  }
@@ -224,18 +321,18 @@ class d extends C {
224
321
  return n.className = "suffix-label", n.textContent = this.props.suffix, e.appendChild(n), e;
225
322
  }
226
323
  }
227
- class _ extends d {
324
+ class A extends w {
228
325
  constructor(t) {
229
326
  super({
230
327
  ...t,
231
328
  minValue: 0,
232
329
  maxValue: 100,
233
- icon: t.icon || L,
330
+ icon: t.icon || V,
234
331
  title: t.title || "Opacity"
235
332
  }), this.inputType = "number";
236
333
  }
237
334
  }
238
- const L = `
335
+ const V = `
239
336
  <svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
240
337
  <path d="M3.69749 15.365C3.54749 15.365 3.40502 15.305 3.30002 15.2C1.77752 13.6775 0.9375 11.6525 0.9375 9.5C0.9375 5.0525 4.5525 1.4375 9 1.4375C11.1525 1.4375 13.1775 2.2775 14.7 3.8C14.805 3.905 14.865 4.0475 14.865 4.1975C14.865 4.3475 14.805 4.49 14.7 4.595L4.09502 15.2C3.99002 15.305 3.84749 15.365 3.69749 15.365ZM9 2.5625C5.175 2.5625 2.0625 5.675 2.0625 9.5C2.0625 11.165 2.64751 12.74 3.71251 13.9925L13.4925 4.2125C12.24 3.1475 10.665 2.5625 9 2.5625Z" fill="#667085"/>
241
338
  <path d="M9.00014 17.5623C6.84764 17.5623 4.82266 16.7223 3.30016 15.1998C3.19516 15.0948 3.13513 14.9523 3.13513 14.8023C3.13513 14.6523 3.19516 14.5098 3.30016 14.4048L13.9051 3.79984C14.1226 3.58234 14.4826 3.58234 14.7001 3.79984C16.2226 5.32234 17.0626 7.34734 17.0626 9.49984C17.0626 13.9473 13.4476 17.5623 9.00014 17.5623ZM4.50764 14.7873C5.76014 15.8523 7.33514 16.4373 9.00014 16.4373C12.8251 16.4373 15.9376 13.3248 15.9376 9.49984C15.9376 7.83484 15.3526 6.25984 14.2876 5.00734L4.50764 14.7873Z" fill="#667085"/>
@@ -244,41 +341,51 @@ const L = `
244
341
  <path d="M15.84 12.6648C15.6975 12.6648 15.555 12.6123 15.4425 12.4998L10.725 7.78234C10.5075 7.56484 10.5075 7.20484 10.725 6.98734C10.9425 6.76984 11.3025 6.76984 11.52 6.98734L16.2375 11.7048C16.455 11.9223 16.455 12.2823 16.2375 12.4998C16.1325 12.6048 15.99 12.6648 15.84 12.6648Z" fill="#667085"/>
245
342
  </svg>
246
343
  `;
247
- class b extends C {
344
+ class j extends d {
248
345
  constructor(t = {}) {
249
- super(t), this.inputType = "select", this.props.options || (this.props.options = []), this.props.getOptionsAsync && this.props.getOptionsAsync().then((e) => {
250
- this.props.options = [...this.props.options, ...e], e.forEach((i) => {
251
- var n;
252
- (n = this.selectNode) == null || n.appendChild(this.createOption(i));
346
+ super(t), this.inputType = "select", this._options = [], t.options && (this._options = [...t.options]), t.getOptions && this._options.push(...t.getOptions()), t.getOptionsAsync && t.getOptionsAsync().then((e) => {
347
+ this._options.push(...e), this.selectNode && e.forEach((i, n) => {
348
+ const s = this._options.length - e.length + n;
349
+ this.selectNode.appendChild(this.createOption(i, s));
253
350
  });
254
351
  }).catch((e) => {
255
352
  console.error("Failed to fetch async options:", e);
256
353
  });
257
354
  }
258
- createOption(t) {
259
- const e = document.createElement("option");
260
- return e.value = t.value, e.textContent = t.name, e;
355
+ createOption(t, e) {
356
+ const i = document.createElement("option");
357
+ return i.value = String(e), i.textContent = t.name, i;
261
358
  }
262
359
  draw() {
263
- var o, r;
264
360
  const t = document.createElement("div");
265
- t.classList.add("select-container");
266
- const e = document.createElement("div");
267
- e.className = "icon-container";
268
- const i = this.createIcon(this.props.icon || ""), n = this.createLabel(this.props.title || ""), s = document.createElement("select");
269
- return this.selectNode = s, s.classList.add("select"), s.onchange = (h) => {
270
- var c;
271
- this.value = h.target.value, (c = this.onChange) == null || c.call(this, h.target.value);
272
- }, [
273
- ...this.props.options || [],
274
- ...((r = (o = this.props).getOptions) == null ? void 0 : r.call(o)) || []
275
- ].forEach((h) => {
276
- const c = this.createOption(h);
277
- s.appendChild(c);
278
- }), this.value && (s.value = this.value), e.appendChild(i), e.appendChild(n), t.appendChild(e), t.appendChild(s), t;
361
+ if (t.classList.add("select-container"), this.props.icon || this.props.title) {
362
+ const i = document.createElement("div");
363
+ if (i.className = "icon-container", this.props.icon) {
364
+ const n = this.createIcon(this.props.icon);
365
+ i.appendChild(n);
366
+ }
367
+ if (this.props.title) {
368
+ const n = this.createLabel(this.props.title);
369
+ i.appendChild(n);
370
+ }
371
+ t.appendChild(i);
372
+ }
373
+ const e = document.createElement("select");
374
+ if (this.selectNode = e, e.classList.add("select"), this._options.forEach((i, n) => {
375
+ const s = this.createOption(i, n);
376
+ e.appendChild(s);
377
+ }), this.value !== void 0) {
378
+ const i = this._options.findIndex((n) => n.value === this.value);
379
+ i >= 0 && (e.value = String(i));
380
+ }
381
+ return e.onchange = (i) => {
382
+ var a;
383
+ const n = Number(i.target.value), s = this._options[n];
384
+ s && (this.value = s.value, (a = this.onChange) == null || a.call(this, this.value));
385
+ }, t.appendChild(e), t;
279
386
  }
280
387
  }
281
- class V extends C {
388
+ class Z extends d {
282
389
  constructor(t = {}) {
283
390
  super(t), this.inputType = "button", this.value || (this.value = "center");
284
391
  }
@@ -331,7 +438,7 @@ class V extends C {
331
438
  }), t.appendChild(i), t;
332
439
  }
333
440
  }
334
- class F extends C {
441
+ class U extends d {
335
442
  constructor(t) {
336
443
  super(t), this.inputType = "button";
337
444
  }
@@ -344,24 +451,24 @@ class F extends C {
344
451
  return e.className = "button-setting-wrapper " + (this.props.wrapperClassName || ""), e.appendChild(t), e;
345
452
  }
346
453
  }
347
- class G extends C {
454
+ class _ extends d {
348
455
  constructor(t = {}) {
349
- super(t), this.inputType = { width: "number", height: "number" }, this.isUpdating = !1, this.value || (this.value = { width: 100, height: 100 }), this.locked = t.locked ?? !1, this.value.height === 0 && (this.value.height = 1), this.aspectRatio = this.value.width / this.value.height, this.widthSetting = new d({
456
+ super(t), this.inputType = { width: "number", height: "number" }, this.isUpdating = !1, this.value || (this.value = { width: 100, height: 100 }), this.locked = t.locked ?? !1, this.value.height === 0 && (this.value.height = 1), this.aspectRatio = this.value.width / this.value.height, this.widthSetting = new w({
350
457
  title: "Width",
351
458
  default: this.value.width,
352
459
  suffix: "px",
353
460
  // Display "px" as the unit.
354
461
  minValue: t.minWidth ?? 1,
355
462
  maxValue: t.maxWidth,
356
- icon: S
463
+ icon: T
357
464
  // SVG icon defined at the bottom.
358
- }), this.heightSetting = new d({
465
+ }), this.heightSetting = new w({
359
466
  title: "Height",
360
467
  default: this.value.height,
361
468
  suffix: "px",
362
469
  minValue: t.minHeight ?? 1,
363
470
  maxValue: t.maxHeight,
364
- icon: T
471
+ icon: I
365
472
  }), this.widthSetting.setOnChange((e) => {
366
473
  var s;
367
474
  if (this.isUpdating || isNaN(e) || e < 1) return;
@@ -417,16 +524,16 @@ class G extends C {
417
524
  return s.className = "dimension-lock-icon", s.innerHTML = this.getLockSVG(this.locked), s.onclick = () => this.toggleLock(s), n.appendChild(s), t.appendChild(e), t.appendChild(n), t.appendChild(i), t;
418
525
  }
419
526
  }
420
- const S = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
527
+ const T = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
421
528
  <path d="M4.5 9.5H13.5M4.5 9.5L6 7.25M4.5 9.5L6 11.75M13.5 9.5L12 7.25M13.5 9.5L12 11.75M15.75 16.25V2.75M2.25 16.25V2.75" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
422
- </svg>`, T = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
529
+ </svg>`, I = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
423
530
  <path d="M9 14L9 5M9 14L6.75 12.5M9 14L11.25 12.5M9 5L6.75 6.5M9 5L11.25 6.5M15.75 2.75H2.25M15.75 16.25H2.25" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
424
- </svg>`, I = `
531
+ </svg>`, R = `
425
532
  <svg xmlns="http://www.w3.org/2000/svg" width="15" height="16" viewBox="0 0 15 16" fill="none">
426
533
  <path d="M5 10.5L7.5 8M7.5 8L10 10.5M7.5 8V13.625M12.5 10.9643C13.2634 10.3338 13.75 9.37996 13.75 8.3125C13.75 6.41402 12.211 4.875 10.3125 4.875C10.1759 4.875 10.0482 4.80375 9.97882 4.68609C9.16379 3.30302 7.65902 2.375 5.9375 2.375C3.34867 2.375 1.25 4.47367 1.25 7.0625C1.25 8.35381 1.77215 9.52317 2.61684 10.371" stroke="#475467" stroke-linecap="round" stroke-linejoin="round"/>
427
534
  </svg>
428
535
  `;
429
- class q extends C {
536
+ class W extends d {
430
537
  constructor(t = {}) {
431
538
  super(t), this.inputType = "button", !this.value && t.defaultUrl && (this.value = t.defaultUrl);
432
539
  }
@@ -437,7 +544,7 @@ class q extends C {
437
544
  e.className = "upload-preview", e.src = this.value || this.props.defaultUrl || "";
438
545
  const i = document.createElement("button");
439
546
  i.className = "upload-button", i.innerHTML = `
440
- <span class="upload-icon">${I}</span>
547
+ <span class="upload-icon">${R}</span>
441
548
  <span class="upload-label">Upload</span>
442
549
  `;
443
550
  const n = document.createElement("input");
@@ -449,355 +556,26 @@ class q extends C {
449
556
  if (s) {
450
557
  const o = new FileReader();
451
558
  o.onload = (r) => {
452
- var c, m;
453
- const h = (c = r.target) == null ? void 0 : c.result;
454
- this.value = h, e.src = h, (m = this.onChange) == null || m.call(this, h);
559
+ var h, g;
560
+ const u = (h = r.target) == null ? void 0 : h.result;
561
+ this.value = u, e.src = u, (g = this.onChange) == null || g.call(this, u);
455
562
  }, o.readAsDataURL(s);
456
563
  }
457
564
  }, t.appendChild(e), t.appendChild(i), t.appendChild(n), t;
458
565
  }
459
566
  }
460
- const B = `
461
- <svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
462
- <path d="M5.625 9.5H5.6325M12.375 9.5H12.3825M9 9.5H9.0075M9 12.875H9.0075M9 6.125H9.0075M2.25 6.35L2.25 12.65C2.25 13.9101 2.25 14.5402 2.49524 15.0215C2.71095 15.4448 3.05516 15.789 3.47852 16.0048C3.95982 16.25 4.58988 16.25 5.85 16.25H12.15C13.4101 16.25 14.0402 16.25 14.5215 16.0048C14.9448 15.789 15.289 15.4448 15.5048 15.0215C15.75 14.5402 15.75 13.9101 15.75 12.65V6.35C15.75 5.08988 15.75 4.45982 15.5048 3.97852C15.289 3.55516 14.9448 3.21095 14.5215 2.99524C14.0402 2.75 13.4101 2.75 12.15 2.75L5.85 2.75C4.58988 2.75 3.95982 2.75 3.47852 2.99524C3.05516 3.21095 2.71095 3.55516 2.49524 3.97852C2.25 4.45982 2.25 5.08988 2.25 6.35Z" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
463
- </svg>
464
- `, R = `
465
- <svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
466
- <path d="M6 2.75H5.85C4.58988 2.75 3.95982 2.75 3.47852 2.99524C3.05516 3.21095 2.71095 3.55516 2.49524 3.97852C2.25 4.45982 2.25 5.08988 2.25 6.35V6.5M6 16.25H5.85C4.58988 16.25 3.95982 16.25 3.47852 16.0048C3.05516 15.789 2.71095 15.4448 2.49524 15.0215C2.25 14.5402 2.25 13.9101 2.25 12.65V12.5M15.75 6.5V6.35C15.75 5.08988 15.75 4.45982 15.5048 3.97852C15.289 3.55516 14.9448 3.21095 14.5215 2.99524C14.0402 2.75 13.4101 2.75 12.15 2.75H12M15.75 12.5V12.65C15.75 13.9101 15.75 14.5402 15.5048 15.0215C15.289 15.4448 14.9448 15.789 14.5215 16.0048C14.0402 16.25 13.4101 16.25 12.15 16.25H12" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
467
- </svg>
468
- `;
469
- class D extends g {
470
- constructor() {
471
- super({
472
- title: "Border",
473
- settings: {
474
- color: new H({
475
- title: "Color",
476
- default: "#00141E"
477
- }),
478
- opacity: new d({
479
- title: "Opacity",
480
- default: 100,
481
- maxValue: 100,
482
- minValue: 0
483
- }),
484
- radius: new d({
485
- title: "Radius",
486
- icon: B,
487
- default: 12,
488
- suffix: "px"
489
- }),
490
- size: new d({
491
- title: "Size",
492
- icon: R,
493
- default: 0,
494
- suffix: "px"
495
- })
496
- }
497
- });
498
- }
499
- /**
500
- * Optional helper to generate CSS from the current settings.
501
- */
502
- getCssCode() {
503
- const t = this.settings.color.value ?? "#000000", e = this.settings.opacity.value ?? 100, i = this.settings.radius.value ?? 0, n = this.settings.size.value ?? 0;
504
- return `
505
- /* Example CSS usage */
506
- border-color: ${t};
507
- border-width: ${n}px;
508
- border-radius: ${i}px;
509
- opacity: ${e / 100};
510
- `;
511
- }
512
- }
513
- const j = `
514
- <svg xmlns="http://www.w3.org/2000/svg" width="14" height="13" viewBox="0 0 14 13" fill="none">
515
- <path d="M1 2.75C1 2.05109 1 1.70163 1.11418 1.42597C1.26642 1.05843 1.55843 0.766422 1.92597 0.614181C2.20163 0.5 2.55109 0.5 3.25 0.5H10.75C11.4489 0.5 11.7984 0.5 12.074 0.614181C12.4416 0.766422 12.7336 1.05843 12.8858 1.42597C13 1.70163 13 2.05109 13 2.75M4.75 12.5H9.25M7 0.5V12.5" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
516
- </svg>
517
- `, $ = `
518
- <svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
519
- <path d="M3 5.75C3 5.05109 3 4.70163 3.11418 4.42597C3.26642 4.05843 3.55843 3.76642 3.92597 3.61418C4.20163 3.5 4.55109 3.5 5.25 3.5H12.75C13.4489 3.5 13.7984 3.5 14.074 3.61418C14.4416 3.76642 14.7336 4.05843 14.8858 4.42597C15 4.70163 15 5.05109 15 5.75M6 15.5H12M7.6875 3.5V15.5M10.3125 3.5V15.5" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
520
- </svg>
521
- `, A = `
522
- <svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
523
- <path d="M6 5.75H12M9 5.75V13.25M5.85 16.25H12.15C13.4101 16.25 14.0402 16.25 14.5215 16.0048C14.9448 15.789 15.289 15.4448 15.5048 15.0215C15.75 14.5402 15.75 13.9101 15.75 12.65V6.35C15.75 5.08988 15.75 4.45982 15.5048 3.97852C15.289 3.55516 14.9448 3.21095 14.5215 2.99524C14.0402 2.75 13.4101 2.75 12.15 2.75H5.85C4.58988 2.75 3.95982 2.75 3.47852 2.99524C3.05516 3.21095 2.71095 3.55516 2.49524 3.97852C2.25 4.45982 2.25 5.08988 2.25 6.35V12.65C2.25 13.9101 2.25 14.5402 2.49524 15.0215C2.71095 15.4448 3.05516 15.789 3.47852 16.0048C3.95982 16.25 4.58988 16.25 5.85 16.25Z" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
524
- </svg>
525
- `;
526
- class P extends g {
527
- constructor() {
528
- super({
529
- title: "Header Typography",
530
- settings: {
531
- color: new H({
532
- title: "Color",
533
- default: "#00141E"
534
- }),
535
- opacity: new d({
536
- title: "Opacity",
537
- default: 100
538
- }),
539
- fontFamily: new b({
540
- title: "Font",
541
- icon: j,
542
- default: "Satoshi",
543
- options: [
544
- { name: "Satoshi", value: "Satoshi" },
545
- { name: "Arial", value: "Arial" },
546
- { name: "Roboto", value: "Roboto" }
547
- ]
548
- }),
549
- fontWeight: new b({
550
- title: "Weight",
551
- icon: $,
552
- default: "bold",
553
- options: [
554
- { name: "Regular", value: "regular" },
555
- { name: "Medium", value: "medium" },
556
- { name: "Bold", value: "bold" }
557
- ]
558
- }),
559
- fontSize: new d({
560
- title: "Size",
561
- icon: A,
562
- default: 12,
563
- suffix: "px"
564
- }),
565
- align: new V({
566
- title: "Align",
567
- default: "center"
568
- })
569
- }
570
- });
571
- }
572
- /**
573
- * Optional helper: generate CSS from these settings, for instance.
574
- */
575
- getCssCode() {
576
- const t = this.settings.color.value ?? "#000000", e = this.settings.opacity.value ?? 100, i = this.settings.fontFamily.value ?? "Satoshi", n = this.settings.fontWeight.value ?? "bold", s = this.settings.fontSize.value ?? 12, a = this.settings.align.value ?? "left";
577
- return `
578
- color: ${t};
579
- opacity: ${e / 100};
580
- font-family: ${i};
581
- font-weight: ${n};
582
- font-size: ${s}px;
583
- text-align: ${a};
584
- `;
585
- }
586
- }
587
- class w extends C {
588
- constructor(t) {
589
- super({
590
- ...t,
591
- default: t.default !== void 0 ? t.default : "auto"
592
- }), this.inputType = "number", this.value = t.default !== void 0 ? t.default : "auto";
593
- }
594
- draw() {
595
- const t = this.value === "auto" ? "text" : "number", e = (o) => {
596
- this.value !== "auto" && (this.props.minValue !== void 0 && (o.min = String(this.props.minValue)), this.props.maxValue !== void 0 && (o.max = String(this.props.maxValue)), this.props.className && o.classList.add(this.props.className), o.addEventListener("input", () => {
597
- const r = this.props.minValue ?? Number.MIN_SAFE_INTEGER, h = this.props.maxValue ?? Number.MAX_SAFE_INTEGER;
598
- let c = Number(o.value);
599
- c < r && (c = r), c > h && (c = h), o.value = String(c);
600
- }));
601
- }, i = this.createInput({
602
- value: this.value,
603
- inputType: t,
604
- title: this.props.title,
605
- icon: this.props.icon,
606
- inputClassName: "number-setting-input " + (this.props.inputClassName || ""),
607
- wrapperClassName: "number-setting-wrapper " + (this.props.wrapperClassName || ""),
608
- inputCustomizer: e,
609
- placeholder: this.value === "auto" ? "auto" : ""
610
- });
611
- if (!this.props.suffix || this.props.suffix === "none")
612
- return i;
613
- i.classList.add("suffix-wrapper");
614
- const n = i.querySelector(
615
- "input.number-setting-input"
616
- );
617
- n && (n.style.paddingRight = "35px");
618
- const s = document.createElement("span");
619
- s.className = "suffix-label", s.textContent = this.props.suffix, i.appendChild(s);
620
- const a = i.querySelector("input");
621
- return a && (a.oninput = (o) => {
622
- const r = o.target.value.trim();
623
- if (r.toLowerCase() === "auto")
624
- this.value = "auto";
625
- else {
626
- const h = Number(r);
627
- isNaN(h) || (this.value = h);
628
- }
629
- this.onChange && this.onChange(this.value);
630
- }), i;
631
- }
632
- }
633
- class X extends g {
634
- constructor() {
635
- super({
636
- title: "Margins",
637
- settings: {
638
- marginTop: new w({
639
- title: "Top",
640
- icon: O,
641
- suffix: "px",
642
- default: "auto"
643
- }),
644
- marginRight: new w({
645
- title: "Right",
646
- icon: Z,
647
- suffix: "px",
648
- default: 0
649
- }),
650
- marginBottom: new w({
651
- title: "Bottom",
652
- icon: U,
653
- suffix: "px",
654
- default: 0
655
- }),
656
- marginLeft: new w({
657
- title: "Left",
658
- icon: z,
659
- suffix: "px",
660
- default: 0
661
- })
662
- }
663
- });
664
- }
665
- getCssCode() {
666
- const t = typeof this.settings.marginTop.value == "number" ? `${this.settings.marginTop.value}px` : this.settings.marginTop.value, e = typeof this.settings.marginRight.value == "number" ? `${this.settings.marginRight.value}px` : this.settings.marginRight.value, i = typeof this.settings.marginBottom.value == "number" ? `${this.settings.marginBottom.value}px` : this.settings.marginBottom.value, n = typeof this.settings.marginLeft.value == "number" ? `${this.settings.marginLeft.value}px` : this.settings.marginLeft.value;
667
- return `
668
- margin-top: ${t};
669
- margin-right: ${e};
670
- margin-bottom: ${i};
671
- margin-left: ${n};
672
- `;
673
- }
674
- }
675
- const O = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
676
- <path d="M2.25 16.25H2.2575M2.25 9.5H2.2575M2.25 12.875H2.2575M2.25 6.125H2.2575M5.625 16.25H5.6325M5.625 9.5H5.6325M12.375 16.25H12.3825M12.375 9.5H12.3825M9 16.25H9.0075M9 9.5H9.0075M9 12.875H9.0075M9 6.125H9.0075M15.75 16.25H15.7575M15.75 9.5H15.7575M15.75 12.875H15.7575M15.75 6.125H15.7575M15.75 2.75H2.25" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
677
- </svg>`, Z = `<svg xmlns="http://www.w3.org/2000/svg" width="16" height="15" viewBox="0 0 16 15" fill="none">
678
- <path d="M4.625 0.75H4.6325M4.625 7.5H4.6325M4.625 14.25H4.6325M11.375 0.75H11.3825M11.375 7.5H11.3825M11.375 14.25H11.3825M8 0.75H8.0075M8 7.5H8.0075M8 14.25H8.0075M8 10.875H8.0075M8 4.125H8.0075M1.25 0.75H1.2575M1.25 7.5H1.2575M1.25 14.25H1.2575M1.25 10.875H1.2575M1.25 4.125H1.2575M14.75 14.25V0.75" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
679
- </svg>`, U = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
680
- <path d="M2.25 2.75H2.2575M2.25 9.5H2.2575M2.25 12.875H2.2575M2.25 6.125H2.2575M5.625 2.75H5.6325M5.625 9.5H5.6325M12.375 2.75H12.3825M12.375 9.5H12.3825M9 2.75H9.0075M9 9.5H9.0075M9 12.875H9.0075M9 6.125H9.0075M15.75 2.75H15.7575M15.75 9.5H15.7575M15.75 12.875H15.7575M15.75 6.125H15.7575M15.75 16.25H2.25" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
681
- </svg>`, z = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
682
- <path d="M5.625 2.75H5.6325M5.625 9.5H5.6325M5.625 16.25H5.6325M12.375 2.75H12.3825M12.375 9.5H12.3825M12.375 16.25H12.3825M9 2.75H9.0075M9 9.5H9.0075M9 16.25H9.0075M9 12.875H9.0075M9 6.125H9.0075M15.75 2.75H15.7575M15.75 9.5H15.7575M15.75 16.25H15.7575M15.75 12.875H15.7575M15.75 6.125H15.7575M2.25 16.25V2.75" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
683
- </svg>`;
684
- class W extends g {
685
- constructor(t, e) {
686
- super({
687
- title: `Tab ${t + 1}`,
688
- settings: {
689
- name: new M({
690
- title: "Tab Name",
691
- default: `Tab ${t + 1}`
692
- }),
693
- content: new M({
694
- title: "Content",
695
- default: ""
696
- })
697
- }
698
- }), this.onDeleteCallback = e;
699
- }
700
- draw() {
701
- const t = super.draw(), e = t.querySelector(".setting-group-arrow");
702
- e && e.parentElement && e.parentElement.removeChild(e);
703
- const i = t.querySelector(".setting-group-title");
704
- if (i) {
705
- const n = document.createElement("div");
706
- n.className = "tab-delete-container";
707
- const s = document.createElement("button");
708
- s.className = "tab-delete-button", s.innerHTML = `
709
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="#f87171" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="trash-icon">
710
- <polyline points="3 6 5 6 21 6"></polyline>
711
- <path d="M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6"></path>
712
- <path d="M10 11v6"></path>
713
- <path d="M14 11v6"></path>
714
- <path d="M9 6V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2"></path>
715
- </svg>
716
- `, s.onclick = () => {
717
- var o;
718
- return (o = this.onDeleteCallback) == null ? void 0 : o.call(this);
719
- }, n.appendChild(s);
720
- const a = i.querySelector("h3");
721
- a ? a.insertAdjacentElement("afterend", n) : i.appendChild(n);
722
- }
723
- return t;
724
- }
725
- }
726
- class J extends g {
727
- // Store the rendered element
728
- constructor() {
729
- super({ title: "Tabs", settings: {} }), this.tabs = [], this._el = null, this.addTab();
730
- }
731
- /** Adds a new tab. */
732
- addTab() {
733
- const t = this.tabs.length, e = new W(t, () => this.removeTab(e));
734
- this.tabs.push(e), this.settings[`Tab ${t + 1}`] = e;
735
- }
736
- /** Removes a specific tab. */
737
- removeTab(t) {
738
- const e = this.tabs.indexOf(t);
739
- e >= 0 && (this.tabs.splice(e, 1), delete this.settings[`Tab ${e + 1}`], this.relabelTabs(), this.rerender());
740
- }
741
- /** Relabels tabs sequentially after removal. */
742
- relabelTabs() {
743
- this.settings = {}, this.tabs.forEach((t, e) => {
744
- t.title = `Tab ${e + 1}`, this.settings[`Tab ${e + 1}`] = t;
745
- });
746
- }
747
- /**
748
- * Override draw() so we can store the created DOM element
749
- * and add the "Add Tab" button in a container positioned at the bottom-right.
750
- */
751
- draw() {
752
- const t = super.draw();
753
- this._el = t;
754
- const e = document.createElement("div");
755
- e.className = "tabs-add-btn-container";
756
- const i = document.createElement("button");
757
- return i.className = "tabs-add-button", i.innerHTML = `
758
- <span class="add-icon">
759
- <svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" stroke="#667085">
760
- <g id="SVGRepo_bgCarrier" stroke-width="0"></g>
761
- <g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g>
762
- <g id="SVGRepo_iconCarrier">
763
- <g id="Edit / Add_Plus">
764
- <path id="Vector" d="M6 12H12M12 12H18M12 12V18M12 12V6" stroke="#667085" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path>
765
- </g>
766
- </g>
767
- </svg>
768
- </span>
769
- <span class="add-label">Add Tab</span>
770
- `, i.onclick = () => {
771
- this.addTab(), this.rerender();
772
- }, e.appendChild(i), t.appendChild(e), t;
773
- }
774
- /**
775
- * Re-renders the inner settings content based on the current tabs.
776
- */
777
- rerender() {
778
- if (!this._el) return;
779
- const t = this._el.querySelector(".setting-group-content");
780
- t && (t.innerHTML = "", Object.keys(this.settings).forEach((e) => {
781
- const i = this.settings[e];
782
- t.appendChild(i.draw());
783
- }));
784
- }
785
- }
786
567
  export {
787
- V as AlignSetting,
788
- D as BorderSettingSet,
789
- F as ButtonSetting,
790
- H as ColorSetting,
791
- G as DimensionSetting,
792
- P as HeaderTypographySettingSet,
793
- X as MarginSettingGroup,
794
- d as NumberSetting,
795
- _ as OpacitySetting,
796
- b as SelectSetting,
797
- C as Setting,
798
- g as SettingGroup,
799
- M as StringSetting,
800
- J as TabsContainerGroup,
801
- q as UploadSetting,
802
- E as iterateSettings
568
+ Z as AlignSetting,
569
+ U as ButtonSetting,
570
+ O as ColorSetting,
571
+ _ as DimensionSetting,
572
+ B as MarginSettingGroup,
573
+ w as NumberSetting,
574
+ A as OpacitySetting,
575
+ j as SelectSetting,
576
+ d as Setting,
577
+ v as SettingGroup,
578
+ S as StringSetting,
579
+ W as UploadSetting,
580
+ k as iterateSettings
803
581
  };
package/dist/index.css CHANGED
@@ -1 +1 @@
1
- @import"https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap";.setting-group{padding:16px;display:flex;flex-direction:column;gap:8px;border-bottom:solid 1px var(--color-border);border-radius:8px;background-color:var(--color-bg)}.setting-group .setting-group{background-color:var(--color-white)!important;padding:12px;border-bottom:unset;border:1px solid var(--color-border-secondary);box-shadow:0 12px 16px -4px #10182814,0 4px 6px -2px #10182808}.setting-group-title{display:flex;align-items:center;justify-content:space-between;cursor:pointer}.setting-group-title h3{font-size:14px;font-weight:700;line-height:24px}.setting-group-arrow{display:flex;transition:transform .3s ease-in-out}.setting-group-arrow.rotated{transform:rotate(180deg)}.setting-group-content{flex-direction:column;gap:8px;max-height:fit-content;display:flex;transition:max-height .3s ease-in-out,display .2s ease-in-out}.setting-group-content.collapsed{max-height:0;display:none}.icon-container{display:flex;align-items:center;gap:4px}.input-icon{display:flex;align-items:center;justify-content:center;color:var(--color-text)}.input-label{color:var(--color-text)}.input-container{display:inline-flex;align-items:center;position:relative}.with-suffix{flex:1;padding-right:36px}.input-suffix{position:absolute;right:8px;top:50%;transform:translateY(-50%);color:#666;pointer-events:none;font-size:.9em}.string-setting-wrapper{display:flex;justify-content:space-between;align-items:center}.string-setting-input{max-width:120px;padding:8px;font-size:14px;border-radius:8px;color:var(--color-input-text);border:1px solid var(--color-border);background:var(--color-bg)}.color-setting-wrapper{display:flex;align-items:center;justify-content:space-between;gap:2px}.color-input-wrapper{position:relative;padding:8px 8px 8px 4px;width:120px;height:33px;display:flex;align-items:center;gap:4px;border:1px solid var(--color-border);border-radius:8px;background-color:var(--color-bg)}.color-text-input{border:none;outline:none;width:65px;color:var(--color-input-text);font-size:14px;text-align:center;background:transparent}.color-picker{position:absolute;left:0;top:0;width:25px;height:25px;opacity:0;cursor:pointer}.color-preview{width:25px;height:25px;border-radius:4px}.number-setting-wrapper{display:flex;align-items:center;justify-content:space-between}.number-setting-input{width:120px;padding:8px;font-size:14px;border-radius:8px;color:var(--color-input-text);border:1px solid var(--color-border);background:var(--color-bg);box-sizing:border-box}.suffix-wrapper{position:relative;display:inline-flex;align-items:center}.suffix-label{position:absolute;right:8px;padding-left:8px;top:50%;transform:translateY(-50%);border-left:1px solid var(--color-divider);font-size:12px;color:var(--color-text)}input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}input[type=number]{-moz-appearance:textfield}.select-container{display:flex;align-items:center;gap:4px;justify-content:space-between}.select{width:120px;padding:8px;font-size:14px;border-radius:8px;border:1px solid var(--color-border);background:var(--color-bg);cursor:pointer}.select:focus{outline:none}.align-setting-wrapper{display:flex;align-items:center;justify-content:space-between}.align-setting-label{font-size:12px;color:var(--color-text)}.align-options-container{width:120px;color:#0006;background-color:#f5f6f7;border-radius:9999px;padding:4px 13px;display:flex;gap:8px}.align-option-button{display:flex;align-items:center;justify-content:center;width:26px;height:26px;background:transparent;border:none;cursor:pointer;border-radius:50%;transition:background-color .2s,color .2s}.align-option-button:hover{background-color:#fff}.align-option-button.selected{background-color:var(--color-white);color:var(--color-black)}.button-setting-wrapper{display:flex;justify-content:center}.button-setting{padding:8px 16px;background-color:var(--button-bg, #007bff);color:var(--button-color, #fff);border:none;border-radius:4px;cursor:pointer;font-size:14px}.button-setting:hover{background-color:var(--button-bg-hover, #0056b3)}.dimension-setting-container{display:flex;flex-direction:column;gap:8px;position:relative}.dimension-bracket{width:18px;height:42px;position:absolute;top:16px;right:122px;display:flex;align-items:center;justify-content:center}.dimension-bracket:before{content:"";position:absolute;width:13px;height:14px;background:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='15' viewBox='0 0 14 15' fill='none'><path d='M14 1H5C2.79086 1 1 2.79086 1 5V15' stroke='%23667085'/></svg>") no-repeat center center;background-size:contain;top:0;right:1px}.dimension-bracket:after{content:"";position:absolute;width:13px;height:14px;background:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='15' viewBox='0 0 14 15' fill='none'><path d='M14 14H5C2.79086 14 1 12.2091 1 10V4.76837e-07' stroke='%23667085'/></svg>") no-repeat center center;background-size:contain;bottom:0;right:1px}.dimension-lock-icon{width:24px;height:24px;background:none;cursor:pointer;display:inline-flex;align-items:center;color:#667085;z-index:1}.dimension-lock-icon:hover{color:#000}.upload-setting-wrapper{display:flex;align-items:center;justify-content:space-between}.upload-preview{width:91px;height:71px;object-fit:cover;border-radius:4px}.upload-button{display:inline-flex;align-items:center;gap:4px;padding:5px 4px;background-color:var(--color-white);border:1px solid var(--color-border-secondary);border-radius:8px;cursor:pointer;transition:transform .15s ease,box-shadow .15s ease}.upload-icon{padding:7px 8px 8px 7px;display:flex;align-items:center;justify-content:center;background-color:var(--color-bg-icon);border-radius:28px}.upload-label{display:inline-block;font-size:12px;font-weight:600;color:var(--color-btn-text);transition:transform .15s ease}.upload-button:hover{transform:scale(1.02);box-shadow:0 2px 6px #0000001a}.tab-delete-button{background:transparent;border:none;cursor:pointer;padding:2px 4px}.tab-delete-button svg{width:16px;height:16px}.tabs-add-btn-container{display:flex;justify-content:flex-end}.tabs-add-button{display:inline-flex;align-items:center;gap:6px;padding:6px 12px;border-radius:6px;cursor:pointer;font-size:14px;color:#667085;transition:transform .15s ease,box-shadow .3s ease}.tabs-add-button:hover{transform:scale(1);box-shadow:0 2px 6px #0000001a}.add-icon{display:flex;align-items:center;width:18px}.add-label{display:inline-block}:root{--color-border: #d0d5dd;--color-bg: #f8f8f8;--color-border-secondary: #eaecf0;--color-text: #667085;--color-title: #344054;--color-input-text: #292b2e;--color-white: #fff;--color-black: #000;--color-divider: #dcdcdc;--color-btn-text: #4b4b4b;--color-bg-icon: #f2f4f7}*{padding:0;margin:0;border:none}*,*:before,*:after{box-sizing:border-box}a,a:link,a:visited,a:hover{text-decoration:none}body{font-family:Inter,serif;font-weight:400;font-size:12px;line-height:18px}aside,nav,footer,header,section,main{display:block}h1,h2,h3,h4,h5,h6,p{font-size:inherit;font-weight:inherit}ul,ul li{list-style:none}img{vertical-align:top}img,svg{max-width:100%;height:auto}address{font-style:normal}input,textarea,button,select{font-family:inherit;font-size:inherit;color:inherit;background-color:transparent}input::-ms-clear{display:none}button,input[type=submit]{display:inline-block;box-shadow:none;background-color:transparent;background:none;cursor:pointer}input:focus,input:active,button:focus,button:active{outline:none}button::-moz-focus-inner{padding:0;border:0}label{cursor:pointer}legend{display:block}
1
+ @import"https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap";.setting-group{padding:16px;display:flex;flex-direction:column;gap:8px;border-bottom:solid 1px var(--color-border);border-radius:8px;background-color:var(--color-bg)}.setting-group .setting-group{background-color:var(--color-white)!important;padding:12px;border-bottom:unset;border:1px solid var(--color-border-secondary);box-shadow:0 12px 16px -4px #10182814,0 4px 6px -2px #10182808}.setting-group-title{display:flex;align-items:center;justify-content:space-between;cursor:pointer}.setting-group-title h3{font-size:14px;font-weight:700;line-height:24px}.setting-group-arrow{display:flex;transition:transform .3s ease-in-out}.setting-group-arrow.rotated{transform:rotate(180deg)}.setting-group-content{flex-direction:column;gap:8px;max-height:fit-content;display:flex;transition:max-height .3s ease-in-out,display .2s ease-in-out}.setting-group-content.collapsed{max-height:0;display:none}.icon-container{display:flex;align-items:center;gap:4px}.input-icon{display:flex;align-items:center;justify-content:center;color:var(--color-text)}.input-label{color:var(--color-text)}.input-container{display:inline-flex;align-items:center;position:relative}.with-suffix{flex:1;padding-right:36px}.input-suffix{position:absolute;right:8px;top:50%;transform:translateY(-50%);color:#666;pointer-events:none;font-size:.9em}.string-setting-wrapper{display:flex;justify-content:space-between;align-items:center}.string-setting-input{max-width:120px;padding:8px;font-size:14px;border-radius:8px;color:var(--color-input-text);border:1px solid var(--color-border);background:var(--color-bg)}.color-setting-wrapper{display:flex;align-items:center;justify-content:space-between;gap:2px}.color-input-wrapper{position:relative;padding:8px 8px 8px 4px;width:120px;height:33px;display:flex;align-items:center;gap:4px;border:1px solid var(--color-border);border-radius:8px;background-color:var(--color-bg)}.color-text-input{border:none;outline:none;width:65px;color:var(--color-input-text);font-size:14px;text-align:center;background:transparent}.color-picker{position:absolute;left:0;top:0;width:25px;height:25px;opacity:0;cursor:pointer}.color-preview{width:25px;height:25px;border-radius:4px}.number-setting-wrapper{display:flex;align-items:center;justify-content:space-between}.number-setting-input{width:120px;padding:8px;font-size:14px;border-radius:8px;color:var(--color-input-text);border:1px solid var(--color-border);background:var(--color-bg);box-sizing:border-box}.suffix-wrapper{position:relative;display:inline-flex;align-items:center}.suffix-label{position:absolute;right:8px;padding-left:8px;top:50%;transform:translateY(-50%);border-left:1px solid var(--color-divider);font-size:12px;color:var(--color-text)}input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}input[type=number]{-moz-appearance:textfield}.select-container{display:flex;align-items:center;gap:4px;justify-content:space-between}.select{width:120px;padding:8px;font-size:14px;border-radius:8px;border:1px solid var(--color-border);background:var(--color-bg);cursor:pointer}.select:focus{outline:none}.align-setting-wrapper{display:flex;align-items:center;justify-content:space-between}.align-setting-label{font-size:12px;color:var(--color-text)}.align-options-container{width:120px;color:#0006;background-color:#f5f6f7;border-radius:9999px;padding:4px 13px;display:flex;gap:8px}.align-option-button{display:flex;align-items:center;justify-content:center;width:26px;height:26px;background:transparent;border:none;cursor:pointer;border-radius:50%;transition:background-color .2s,color .2s}.align-option-button:hover{background-color:#fff}.align-option-button.selected{background-color:var(--color-white);color:var(--color-black)}.button-setting-wrapper{display:flex;justify-content:center}.button-setting{padding:8px 16px;background-color:var(--button-bg, #007bff);color:var(--button-color, #fff);border:none;border-radius:4px;cursor:pointer;font-size:14px}.button-setting:hover{background-color:var(--button-bg-hover, #0056b3)}.dimension-setting-container{display:flex;flex-direction:column;gap:8px;position:relative}.dimension-bracket{width:18px;height:42px;position:absolute;top:16px;right:122px;display:flex;align-items:center;justify-content:center}.dimension-bracket:before{content:"";position:absolute;width:13px;height:14px;background:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='15' viewBox='0 0 14 15' fill='none'><path d='M14 1H5C2.79086 1 1 2.79086 1 5V15' stroke='%23667085'/></svg>") no-repeat center center;background-size:contain;top:0;right:1px}.dimension-bracket:after{content:"";position:absolute;width:13px;height:14px;background:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='15' viewBox='0 0 14 15' fill='none'><path d='M14 14H5C2.79086 14 1 12.2091 1 10V4.76837e-07' stroke='%23667085'/></svg>") no-repeat center center;background-size:contain;bottom:0;right:1px}.dimension-lock-icon{width:24px;height:24px;background:none;cursor:pointer;display:inline-flex;align-items:center;color:#667085;z-index:1}.dimension-lock-icon:hover{color:#000}.upload-setting-wrapper{display:flex;align-items:center;justify-content:space-between}.upload-preview{width:91px;height:71px;object-fit:cover;border-radius:4px}.upload-button{display:inline-flex;align-items:center;gap:4px;padding:5px 4px;background-color:var(--color-white);border:1px solid var(--color-border-secondary);border-radius:8px;cursor:pointer;transition:transform .15s ease,box-shadow .15s ease}.upload-icon{padding:7px 8px 8px 7px;display:flex;align-items:center;justify-content:center;background-color:var(--color-bg-icon);border-radius:28px}.upload-label{display:inline-block;font-size:12px;font-weight:600;color:var(--color-btn-text);transition:transform .15s ease}.upload-button:hover{transform:scale(1.02);box-shadow:0 2px 6px #0000001a}:root{--color-border: #d0d5dd;--color-bg: #f8f8f8;--color-border-secondary: #eaecf0;--color-text: #667085;--color-title: #344054;--color-input-text: #292b2e;--color-white: #fff;--color-black: #000;--color-divider: #dcdcdc;--color-btn-text: #4b4b4b;--color-bg-icon: #f2f4f7}*{padding:0;margin:0;border:none}*,*:before,*:after{box-sizing:border-box}a,a:link,a:visited,a:hover{text-decoration:none}body{font-family:Inter,serif;font-weight:400;font-size:12px;line-height:18px}aside,nav,footer,header,section,main{display:block}h1,h2,h3,h4,h5,h6,p{font-size:inherit;font-weight:inherit}ul,ul li{list-style:none}img{vertical-align:top}img,svg{max-width:100%;height:auto}address{font-style:normal}input,textarea,button,select{font-family:inherit;font-size:inherit;color:inherit;background-color:transparent}input::-ms-clear{display:none}button,input[type=submit]{display:inline-block;box-shadow:none;background-color:transparent;background:none;cursor:pointer}input:focus,input:active,button:focus,button:active{outline:none}button::-moz-focus-inner{padding:0;border:0}label{cursor:pointer}legend{display:block}
package/dist/index.d.ts CHANGED
@@ -10,26 +10,6 @@ export declare interface AlignSettingProps extends SettingProps<AlignValue> {
10
10
 
11
11
  export declare type AlignValue = 'left' | 'center' | 'right';
12
12
 
13
- /**
14
- * A SettingGroup for configuring "Border" settings:
15
- * - Color: a ColorSetting with a color picker and hex text.
16
- * - Opacity: a NumberSetting (0-100?).
17
- * - Radius: a NumberSetting with a "px" suffix.
18
- * - Size: a NumberSetting with a "px" suffix (e.g., border width).
19
- */
20
- export declare class BorderSettingSet extends SettingGroup<{
21
- color: ColorSetting;
22
- opacity: NumberSetting;
23
- radius: NumberSetting;
24
- size: NumberSetting;
25
- }> {
26
- constructor();
27
- /**
28
- * Optional helper to generate CSS from the current settings.
29
- */
30
- getCssCode(): string;
31
- }
32
-
33
13
  export declare class ButtonSetting extends Setting<void, ButtonSettingProps> {
34
14
  inputType: InputTypes;
35
15
  constructor(props: ButtonSettingProps);
@@ -110,21 +90,6 @@ export declare interface DimensionValue {
110
90
  height: number;
111
91
  }
112
92
 
113
- export declare class HeaderTypographySettingSet extends SettingGroup<{
114
- color: ColorSetting;
115
- opacity: NumberSetting;
116
- fontFamily: SelectSetting;
117
- fontWeight: SelectSetting;
118
- fontSize: NumberSetting;
119
- align: AlignSetting_2;
120
- }> {
121
- constructor();
122
- /**
123
- * Optional helper: generate CSS from these settings, for instance.
124
- */
125
- getCssCode(): string;
126
- }
127
-
128
93
  export declare interface IChangable<T> {
129
94
  setOnChange(onChange: (value: T) => void): void;
130
95
  }
@@ -201,32 +166,26 @@ export declare class OpacitySetting extends NumberSetting {
201
166
  export declare interface OpacitySettingProps extends NumberSettingsProps {
202
167
  }
203
168
 
204
- declare type Primitive = string | number | boolean | symbol | bigint | null | undefined;
169
+ export declare type Primitive = string | number | boolean | symbol | bigint | null | undefined;
205
170
 
206
- export declare class SelectSetting extends Setting<string, SelectSettingProps> {
207
- inputType: InputTypes;
208
- constructor(props?: SelectSettingProps);
209
- createOption(o: {
210
- value: string;
211
- name: string;
212
- }): HTMLOptionElement;
213
- selectNode: HTMLSelectElement | undefined;
171
+ export declare interface SelectOption {
172
+ name: string;
173
+ value: string | object;
174
+ }
175
+
176
+ export declare class SelectSetting<T = any> extends Setting<T, SelectSettingProps<T>> {
177
+ inputType: T extends Primitive ? InputTypes : Record<keyof T, InputTypes>;
178
+ private _options;
179
+ private selectNode?;
180
+ constructor(props?: SelectSettingProps<T>);
181
+ private createOption;
214
182
  draw(): HTMLElement;
215
183
  }
216
184
 
217
- export declare interface SelectSettingProps extends SettingProps<string> {
218
- options?: {
219
- value: string;
220
- name: string;
221
- }[];
222
- getOptions?: () => {
223
- value: string;
224
- name: string;
225
- }[];
226
- getOptionsAsync?: () => Promise<{
227
- value: string;
228
- name: string;
229
- }[]>;
185
+ export declare interface SelectSettingProps<T = any> extends SettingProps<T> {
186
+ options?: SelectOption[];
187
+ getOptions?: () => SelectOption[];
188
+ getOptionsAsync?: () => Promise<SelectOption[]>;
230
189
  }
231
190
 
232
191
  export declare abstract class Setting<T, P extends SettingProps<T>> implements IDrawable, IChangable<T> {
@@ -290,36 +249,6 @@ export declare interface StringSettingsProps extends SettingProps<string> {
290
249
  wrapperClassName?: string;
291
250
  }
292
251
 
293
- export declare class TabsContainerGroup extends SettingGroup<Record<string, TabSettingGroup>> {
294
- private tabs;
295
- private _el;
296
- constructor();
297
- /** Adds a new tab. */
298
- addTab(): void;
299
- /** Removes a specific tab. */
300
- removeTab(tab: TabSettingGroup): void;
301
- /** Relabels tabs sequentially after removal. */
302
- private relabelTabs;
303
- /**
304
- * Override draw() so we can store the created DOM element
305
- * and add the "Add Tab" button in a container positioned at the bottom-right.
306
- */
307
- draw(): HTMLElement;
308
- /**
309
- * Re-renders the inner settings content based on the current tabs.
310
- */
311
- rerender(): void;
312
- }
313
-
314
- declare class TabSettingGroup extends SettingGroup<{
315
- name: StringSetting;
316
- content: StringSetting;
317
- }> {
318
- private onDeleteCallback?;
319
- constructor(index: number, onDelete: () => void);
320
- draw(): HTMLElement;
321
- }
322
-
323
252
  /**
324
253
  * A Setting subclass that displays an image preview (if any)
325
254
  * and an "Upload" button with an icon. The user can select a file,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "builder-settings-types",
3
3
  "description": "builder settings",
4
- "version": "0.0.54",
4
+ "version": "0.0.55",
5
5
  "type": "module",
6
6
  "main": "dist/builder-settings-types.cjs.js",
7
7
  "module": "dist/builder-settings-types.es.js",