builder-settings-types 0.0.55 → 0.0.56

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,21 +1,21 @@
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=`
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 C{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 C?e[i]=n.getValues():e[i]=n.value}return e}else{const e=this.settings[t];return e?e instanceof C?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 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`
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,u=this.props.maxValue??Number.MAX_SAFE_INTEGER;let h=Number(o.value);h<r&&(h=r),h>u&&(h=u),o.value=String(h)}))},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 u=Number(r);isNaN(u)||(this.value=u)}this.onChange&&this.onChange(this.value)}),i}}class E extends C{constructor(t){super({title:"Margins",settings:{marginTop:new v({title:"Top",icon:L,suffix:"px",default:(t==null?void 0:t.marginTop)??"auto"}),marginRight:new v({title:"Right",icon:S,suffix:"px",default:(t==null?void 0:t.marginRight)??0}),marginBottom:new v({title:"Bottom",icon:y,suffix:"px",default:(t==null?void 0:t.marginBottom)??0}),marginLeft:new v({title:"Left",icon:V,suffix:"px",default:(t==null?void 0:t.marginLeft)??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
6
  margin-top: ${t};
7
7
  margin-right: ${e};
8
8
  margin-bottom: ${i};
9
9
  margin-left: ${n};
10
10
  `}}const L=`<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
11
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"/>
12
+ </svg>`,S=`<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
13
+ <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.0075M2.25 2.75H2.2575M2.25 9.5H2.2575M2.25 16.25H2.2575M2.25 12.875H2.2575M2.25 6.125H2.2575M15.75 16.25V2.75" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
14
14
  </svg>`,y=`<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
15
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
16
  </svg>`,V=`<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
17
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=`
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 u=this.createInput({value:this.value,inputType:"text",inputClassName:"color-text-input"}),h=u.querySelector("input"),g=this.createInput({value:this.value,inputType:this.inputType,inputClassName:"color-picker"}),w=g.querySelector("input");return h.oninput=p=>{var m;let c=p.target.value.trim();c.charAt(0)!=="#"&&(c="#"+c,h.value=c),o(h)&&(this.value=c,(m=this.onChange)==null||m.call(this,c),w.value=c,r.style.backgroundColor=c)},w.oninput=p=>{var m;let c=p.target.value;c.charAt(0)!=="#"&&(c="#"+c,w.value=c),this.value=c,(m=this.onChange)==null||m.call(this,c),h.value=c,r.style.backgroundColor=c,o(h)},s.appendChild(r),s.appendChild(g),s.appendChild(u),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=`
19
19
  <svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
20
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"/>
21
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"/>
@@ -63,4 +63,4 @@
63
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
64
  <span class="upload-icon">${_}</span>
65
65
  <span class="upload-label">Upload</span>
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;
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 h,g;const u=(h=r.target)==null?void 0:h.result;this.value=u,e.src=u,(g=this.onChange)==null||g.call(this,u)},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=C;exports.StringSetting=N;exports.UploadSetting=W;exports.iterateSettings=H;
@@ -173,7 +173,7 @@ class m extends d {
173
173
  }
174
174
  }
175
175
  class B extends v {
176
- constructor() {
176
+ constructor(t) {
177
177
  super({
178
178
  title: "Margins",
179
179
  settings: {
@@ -181,25 +181,25 @@ class B extends v {
181
181
  title: "Top",
182
182
  icon: E,
183
183
  suffix: "px",
184
- default: "auto"
184
+ default: (t == null ? void 0 : t.marginTop) ?? "auto"
185
185
  }),
186
186
  marginRight: new m({
187
187
  title: "Right",
188
188
  icon: b,
189
189
  suffix: "px",
190
- default: 0
190
+ default: (t == null ? void 0 : t.marginRight) ?? 0
191
191
  }),
192
192
  marginBottom: new m({
193
193
  title: "Bottom",
194
194
  icon: L,
195
195
  suffix: "px",
196
- default: 0
196
+ default: (t == null ? void 0 : t.marginBottom) ?? 0
197
197
  }),
198
198
  marginLeft: new m({
199
199
  title: "Left",
200
200
  icon: y,
201
201
  suffix: "px",
202
- default: 0
202
+ default: (t == null ? void 0 : t.marginLeft) ?? 0
203
203
  })
204
204
  }
205
205
  });
@@ -216,8 +216,8 @@ class B extends v {
216
216
  }
217
217
  const E = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
218
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"/>
219
+ </svg>`, b = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
220
+ <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.0075M2.25 2.75H2.2575M2.25 9.5H2.2575M2.25 16.25H2.2575M2.25 12.875H2.2575M2.25 6.125H2.2575M15.75 16.25V2.75" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
221
221
  </svg>`, L = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
222
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
223
  </svg>`, y = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
package/dist/index.d.ts CHANGED
@@ -137,7 +137,12 @@ export declare class MarginSettingGroup extends SettingGroup<{
137
137
  marginBottom: MarginNumberSetting;
138
138
  marginLeft: MarginNumberSetting;
139
139
  }> {
140
- constructor();
140
+ constructor(defaults?: {
141
+ marginTop?: number | 'auto';
142
+ marginRight?: number | 'auto';
143
+ marginBottom?: number | 'auto';
144
+ marginLeft?: number | 'auto';
145
+ });
141
146
  getCssCode(): string;
142
147
  }
143
148
 
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.55",
4
+ "version": "0.0.56",
5
5
  "type": "module",
6
6
  "main": "dist/builder-settings-types.cjs.js",
7
7
  "module": "dist/builder-settings-types.es.js",