builder-settings-types 0.0.76 → 0.0.77
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const I="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let N=(r=21)=>{let t="",e=crypto.getRandomValues(new Uint8Array(r|=0));for(;r--;)t+=I[e[r]&63];return t};function
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const I="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let N=(r=21)=>{let t="",e=crypto.getRandomValues(new Uint8Array(r|=0));for(;r--;)t+=I[e[r]&63];return t};function T(r,t){for(const e in r)if(r.hasOwnProperty(e)){const i=r[e];t(e,i)}}class g{constructor(t){this.id=t.id||N(),this.title=t.title,this.settings=t.settings,this.isCollapsed=t.collapsed??!1,this.isMain=t.main??!1,Object.assign(this,t.settings)}setOnChange(t){return this.onChange=t,T(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=`
|
|
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
|
-
`;const s=document.createElement("div");s.className="setting-group-content",this.isCollapsed&&(s.classList.add("collapsed"),n.classList.add("rotated")),e.onclick=()=>{this.isCollapsed=!this.isCollapsed,s.classList.toggle("collapsed"),n.classList.toggle("rotated")},e.appendChild(i),e.appendChild(n);for(const o in this.settings)if(this.settings.hasOwnProperty(o)){const a=this.settings[o];s.appendChild(a.draw())}return t.appendChild(e),t.appendChild(s),this.isMain&&(t.classList.add("main-group"),s.classList.add("main-content")),t}}function B(r){switch(r){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||N(),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 o=this.createIcon(t.icon,t.iconClassName);s.appendChild(o)}if(t.title){const o=this.createLabel(t.title,t.labelClassName);s.appendChild(o)}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 o=s.target;let a=o.value;t.inputType==="number"?a=Number(o.value):(t.inputType==="color"||t.inputType==="date")&&(a=o.value),this.value=a,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 k 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 H="<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 E extends k{constructor(t){super({...t,icon:t.icon||H,title:t.title||"Color"}),this.inputType="color"}hexToRgb(t){t=t.replace("#","");const e=parseInt(t.substring(0,2),16),i=parseInt(t.substring(2,4),16),n=parseInt(t.substring(4,6),16);return`${e}, ${i}, ${n}`}rgbToHex(t){const[e,i,n]=t.split(",").map(o=>parseInt(o.trim()));if(isNaN(e)||isNaN(i)||isNaN(n))return"#000000";const s=o=>{const a=o.toString(16);return a.length===1?"0"+a:a};return`#${s(e)}${s(i)}${s(n)}`}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||H),n=this.createLabel(this.title||"Color");e.appendChild(i),e.appendChild(n);const s=document.createElement("div");s.className="color-input-wrapper";const o=
|
|
5
|
+
`;const s=document.createElement("div");s.className="setting-group-content",this.isCollapsed&&(s.classList.add("collapsed"),n.classList.add("rotated")),e.onclick=()=>{this.isCollapsed=!this.isCollapsed,s.classList.toggle("collapsed"),n.classList.toggle("rotated")},e.appendChild(i),e.appendChild(n);for(const o in this.settings)if(this.settings.hasOwnProperty(o)){const a=this.settings[o];s.appendChild(a.draw())}return t.appendChild(e),t.appendChild(s),this.isMain&&(t.classList.add("main-group"),s.classList.add("main-content")),t}}function B(r){switch(r){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||N(),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 o=this.createIcon(t.icon,t.iconClassName);s.appendChild(o)}if(t.title){const o=this.createLabel(t.title,t.labelClassName);s.appendChild(o)}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 o=s.target;let a=o.value;t.inputType==="number"?a=Number(o.value):(t.inputType==="color"||t.inputType==="date")&&(a=o.value),this.value=a,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 k 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 H="<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 E extends k{constructor(t){super({...t,icon:t.icon||H,title:t.title||"Color"}),this.inputType="color"}hexToRgb(t){t=t.replace("#","");const e=parseInt(t.substring(0,2),16),i=parseInt(t.substring(2,4),16),n=parseInt(t.substring(4,6),16);return`${e}, ${i}, ${n}`}rgbToHex(t){const[e,i,n]=t.split(",").map(o=>parseInt(o.trim()));if(isNaN(e)||isNaN(i)||isNaN(n))return"#000000";const s=o=>{const a=o.toString(16);return a.length===1?"0"+a:a};return`#${s(e)}${s(i)}${s(n)}`}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||H),n=this.createLabel(this.title||"Color");e.appendChild(i),e.appendChild(n);const s=document.createElement("div");s.className="color-input-wrapper";const o=C=>{const h=C.value.split(",").map(w=>parseInt(w.trim()));if(h.length!==3||h.some(isNaN))return C.style.border="1px solid red",!1;const[p,f,L]=h,M=p>=0&&p<=255&&f>=0&&f<=255&&L>=0&&L<=255;return C.style.border=M?"":"1px solid red",M},a=document.createElement("div");a.className="color-preview",a.style.backgroundColor=this.value?`rgb(${this.value})`:"";const l=this.createInput({value:this.value,inputType:"text",inputClassName:"color-text-input"}),c=l.querySelector("input"),u=this.createInput({value:this.value?this.rgbToHex(this.value):"",inputType:this.inputType,inputClassName:"color-picker"}),v=u.querySelector("input");return c.oninput=C=>{var p;let h=C.target.value.trim();o(c)&&(this.value=h,(p=this.onChange)==null||p.call(this,h),v.value=this.rgbToHex(h),a.style.backgroundColor=`rgb(${h})`)},v.oninput=C=>{var f;const h=C.target.value,p=this.hexToRgb(h);this.value=p,(f=this.onChange)==null||f.call(this,p),c.value=p,a.style.backgroundColor=`rgb(${p})`},s.appendChild(a),s.appendChild(u),s.appendChild(l),t.appendChild(e),t.appendChild(s),this.value&&(c.value=this.value,v.value=this.rgbToHex(this.value),a.style.backgroundColor=`rgb(${this.value})`),t}}class m 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 o=this.props.minValue??Number.MIN_SAFE_INTEGER,a=this.props.maxValue??Number.MAX_SAFE_INTEGER;let l=Number(s.value);l<o&&(l=o),l>a&&(l=a),s.value=String(l)})},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 b extends m{constructor(t){super({...t,minValue:0,maxValue:100,icon:t.icon||$,title:t.title||"Opacity"}),this.inputType="number"}}const $=`
|
|
6
6
|
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
7
7
|
<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
8
|
<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"/>
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
<svg xmlns="http://www.w3.org/2000/svg" class="svg-select" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-chevron-down">
|
|
15
15
|
<polyline points="6 9 12 15 18 9"></polyline>
|
|
16
16
|
</svg>
|
|
17
|
-
`;class S extends d{constructor(t={}){if(super(t),this.inputType="select",this._options=[],this.isOpen=!1,this.selectedOptionIndex=null,this.optionsListEl=null,this.svgContainer=null,t.options&&(this._options=[...t.options]),t.getOptions&&this._options.push(...t.getOptions()),t.getOptionsAsync&&t.getOptionsAsync().then(e=>{this._options.push(...e)}).catch(e=>{console.error("Failed to fetch async options:",e)}),this.value!==void 0){const e=this._options.findIndex(i=>i.value===this.value);e>=0&&(this.selectedOptionIndex=e)}this.optionsListEl=this.optionsListEl,this.svgContainer=this.svgContainer}createOption(t,e){const i=document.createElement("li");return i.classList.add("select-option"),i.textContent=t.name,i.dataset.index=String(e),i}draw(){const t=document.createElement("div");if(t.classList.add("select-container"),this.props.icon||this.props.title){const s=document.createElement("div");if(s.className="icon-container",this.props.icon){const o=this.createIcon(this.props.icon);s.appendChild(o)}if(this.props.title){const o=this.createLabel(this.props.title);s.appendChild(o)}t.appendChild(s)}const e=document.createElement("div");e.classList.add("select-button"),e.textContent=this.selectedOptionIndex!==null?this._options[this.selectedOptionIndex].name:"Select an option",e.onclick=()=>{var s,o;this.isOpen=!this.isOpen,(s=this.optionsListEl)==null||s.classList.toggle("open",this.isOpen),(o=this.svgContainer)==null||o.classList.toggle("open",this.isOpen)},t.appendChild(e);const i=document.createElement("ul");i.classList.add("select-options"),this._options.forEach((s,o)=>{const a=this.createOption(s,o);a.onclick=l=>this.selectOption(l,o,e),i.appendChild(a)}),t.appendChild(i);const n=document.createElement("div");return n.classList.add("svg-container"),n.innerHTML=R,t.appendChild(n),n.onclick=()=>{var s,o;this.isOpen=!this.isOpen,(s=this.optionsListEl)==null||s.classList.toggle("open",this.isOpen),(o=this.svgContainer)==null||o.classList.toggle("open",this.isOpen)},this.optionsListEl=i,this.svgContainer=n,t}selectOption(t,e,i){var s,o,a;const n=this._options[e];n&&(this.value=n.value,(s=this.onChange)==null||s.call(this,this.value),this.selectedOptionIndex=e,this.isOpen=!1,i.textContent=n.name,(o=this.optionsListEl)==null||o.classList.remove("open"),(a=this.svgContainer)==null||a.classList.remove("open"))}}class
|
|
17
|
+
`;class S extends d{constructor(t={}){if(super(t),this.inputType="select",this._options=[],this.isOpen=!1,this.selectedOptionIndex=null,this.optionsListEl=null,this.svgContainer=null,t.options&&(this._options=[...t.options]),t.getOptions&&this._options.push(...t.getOptions()),t.getOptionsAsync&&t.getOptionsAsync().then(e=>{this._options.push(...e)}).catch(e=>{console.error("Failed to fetch async options:",e)}),this.value!==void 0){const e=this._options.findIndex(i=>i.value===this.value);e>=0&&(this.selectedOptionIndex=e)}this.optionsListEl=this.optionsListEl,this.svgContainer=this.svgContainer}createOption(t,e){const i=document.createElement("li");return i.classList.add("select-option"),i.textContent=t.name,i.dataset.index=String(e),i}draw(){const t=document.createElement("div");if(t.classList.add("select-container"),this.props.icon||this.props.title){const s=document.createElement("div");if(s.className="icon-container",this.props.icon){const o=this.createIcon(this.props.icon);s.appendChild(o)}if(this.props.title){const o=this.createLabel(this.props.title);s.appendChild(o)}t.appendChild(s)}const e=document.createElement("div");e.classList.add("select-button"),e.textContent=this.selectedOptionIndex!==null?this._options[this.selectedOptionIndex].name:"Select an option",e.onclick=()=>{var s,o;this.isOpen=!this.isOpen,(s=this.optionsListEl)==null||s.classList.toggle("open",this.isOpen),(o=this.svgContainer)==null||o.classList.toggle("open",this.isOpen)},t.appendChild(e);const i=document.createElement("ul");i.classList.add("select-options"),this._options.forEach((s,o)=>{const a=this.createOption(s,o);a.onclick=l=>this.selectOption(l,o,e),i.appendChild(a)}),t.appendChild(i);const n=document.createElement("div");return n.classList.add("svg-container"),n.innerHTML=R,t.appendChild(n),n.onclick=()=>{var s,o;this.isOpen=!this.isOpen,(s=this.optionsListEl)==null||s.classList.toggle("open",this.isOpen),(o=this.svgContainer)==null||o.classList.toggle("open",this.isOpen)},this.optionsListEl=i,this.svgContainer=n,t}selectOption(t,e,i){var s,o,a;const n=this._options[e];n&&(this.value=n.value,(s=this.onChange)==null||s.call(this,this.value),this.selectedOptionIndex=e,this.isOpen=!1,i.textContent=n.name,(o=this.optionsListEl)==null||o.classList.remove("open"),(a=this.svgContainer)==null||a.classList.remove("open"))}}class V 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:`
|
|
18
18
|
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" fill="none">
|
|
19
19
|
<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"
|
|
20
20
|
stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"/>
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
<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"
|
|
36
36
|
stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"/>
|
|
37
37
|
</svg>
|
|
38
|
-
`}].forEach(s=>{const o=document.createElement("button");o.className="align-option-button",o.innerHTML=s.icon,this.value===s.name&&o.classList.add("selected"),o.addEventListener("click",()=>{var a;i.querySelectorAll(".align-option-button").forEach(l=>l.classList.remove("selected")),o.classList.add("selected"),this.value=s.name,(a=this.onChange)==null||a.call(this,this.value)}),i.appendChild(o)}),t.appendChild(i),t}}class j 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 A 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
|
|
38
|
+
`}].forEach(s=>{const o=document.createElement("button");o.className="align-option-button",o.innerHTML=s.icon,this.value===s.name&&o.classList.add("selected"),o.addEventListener("click",()=>{var a;i.querySelectorAll(".align-option-button").forEach(l=>l.classList.remove("selected")),o.classList.add("selected"),this.value=s.name,(a=this.onChange)==null||a.call(this,this.value)}),i.appendChild(o)}),t.appendChild(i),t}}class j 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 A 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 m({title:"Width",default:this.value.width,suffix:"px",minValue:t.minWidth??0,maxValue:t.maxWidth,icon:W}),this.heightSetting=new m({title:"Height",default:this.value.height,suffix:"px",minValue:t.minHeight??0,maxValue:t.maxHeight??0,icon:_}),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?`
|
|
39
39
|
<svg xmlns="http://www.w3.org/2000/svg" width="10" height="10" viewBox="0 0 10 10" fill="none">
|
|
40
40
|
<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"/>
|
|
41
41
|
</svg>
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
<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"/>
|
|
48
48
|
</svg>`,_=`<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
49
49
|
<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"/>
|
|
50
|
-
</svg>`,
|
|
50
|
+
</svg>`,y=`
|
|
51
51
|
<svg xmlns="http://www.w3.org/2000/svg" width="15" height="16" viewBox="0 0 15 16" fill="none">
|
|
52
52
|
<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"/>
|
|
53
53
|
</svg>
|
|
@@ -61,23 +61,23 @@
|
|
|
61
61
|
<path d="M8 3V2.6C8 2.03995 8 1.75992 7.89101 1.54601C7.79513 1.35785 7.64215 1.20487 7.45399 1.10899C7.24008 1 6.96005 1 6.4 1H5.6C5.03995 1 4.75992 1 4.54601 1.10899C4.35785 1.20487 4.20487 1.35785 4.10899 1.54601C4 1.75992 4 2.03995 4 2.6V3M5 5.75V8.25M7 5.75V8.25M1.5 3H10.5M9.5 3V8.6C9.5 9.44008 9.5 9.86012 9.33651 10.181C9.1927 10.4632 8.96323 10.6927 8.68099 10.8365C8.36012 11 7.94008 11 7.1 11H4.9C4.05992 11 3.63988 11 3.31901 10.8365C3.03677 10.6927 2.8073 10.4632 2.66349 10.181C2.5 9.86012 2.5 9.44008 2.5 8.6V3" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
|
|
62
62
|
</svg>
|
|
63
63
|
`;class O extends d{constructor(t={}){super(t),this.inputType="button",this.previewWrapper=null,this.previewEl=null,this.emptyStateEl=null,!this.value&&t.defaultUrl&&t.defaultUrl!==""&&(this.value=t.defaultUrl)}updatePreviewState(t=null){if(!(!this.previewWrapper||!this.previewEl||!this.emptyStateEl))if(t&&t!==""){this.previewEl.style.display="block",this.emptyStateEl.style.display="none";const e=document.querySelector(".upload-setting-wrapper"),i=document.querySelector(".upload-button");e&&(e.style.gridTemplateColumns="1fr 1fr"),i&&(i.innerHTML=`
|
|
64
|
-
<span class="upload-icon">${
|
|
64
|
+
<span class="upload-icon">${y}</span>
|
|
65
65
|
<span class="upload-label">Replace</span>
|
|
66
66
|
`),this.previewEl.src=t,this.previewWrapper.classList.add("has-image")}else this.previewEl.style.display="none",this.emptyStateEl.style.display="block",this.previewEl.src="",this.previewWrapper.classList.remove("has-image")}draw(){const t=document.createElement("div");t.className="upload-setting-wrapper",this.previewWrapper=document.createElement("div"),this.previewWrapper.className="preview-wrapper";const e=document.createElement("div");if(e.className="icon-title-container",this.props.icon){const a=this.createIcon(this.props.icon);e.appendChild(a)}if(this.props.title){const a=this.createLabel(this.props.title);e.appendChild(a)}t.appendChild(e),this.emptyStateEl=document.createElement("div"),this.emptyStateEl.className="empty-state",this.emptyStateEl.innerHTML=G,this.previewEl=document.createElement("img"),this.previewEl.className="upload-preview",this.value&&this.value!==""?this.updatePreviewState(this.value):this.updatePreviewState(null);const n=document.createElement("button");n.className="delete-button",n.type="button",n.title="Delete image",n.innerHTML=F,this.previewWrapper.appendChild(this.emptyStateEl),this.previewWrapper.appendChild(this.previewEl),this.previewWrapper.appendChild(n);const s=document.createElement("button");s.className="upload-button",s.innerHTML=`
|
|
67
|
-
<span class="upload-icon">${
|
|
67
|
+
<span class="upload-icon">${y}</span>
|
|
68
68
|
<span class="upload-label">Replace</span>
|
|
69
69
|
`,n.onclick=a=>{var l;a.stopPropagation(),this.value="",this.updatePreviewState(null),(l=this.onChange)==null||l.call(this,""),t.style.gridTemplateColumns="1fr",s.innerHTML=`
|
|
70
|
-
<span class="upload-icon">${
|
|
70
|
+
<span class="upload-icon">${y}</span>
|
|
71
71
|
<span class="upload-label">Upload</span>
|
|
72
|
-
`};const o=document.createElement("input");return o.type="file",o.accept="image/*",o.style.display="none",s.onclick=()=>{o.click()},o.onchange=async()=>{var l,c,u;const a=(l=o.files)==null?void 0:l[0];if(a)try{const v=new FormData,
|
|
72
|
+
`};const o=document.createElement("input");return o.type="file",o.accept="image/*",o.style.display="none",s.onclick=()=>{o.click()},o.onchange=async()=>{var l,c,u;const a=(l=o.files)==null?void 0:l[0];if(a)try{const v=new FormData,C=this.props.formFieldName||"file";v.append(C,a,a.name);const h=this.props.uploadUrl;if(!h)throw new Error("No uploadUrl provided to UploadSetting.");const p=this.props.requestMethod||"POST",f={...this.props.requestHeaders||{}},M=await(await fetch(h,{method:p,body:v,headers:f})).json();let w;if(this.props.parseResponse)w=this.props.parseResponse(M);else if(w=(c=M==null?void 0:M.data)==null?void 0:c.url,!w)throw new Error("No URL found in response. Provide a parseResponse if needed.");this.value=w,this.updatePreviewState(w),(u=this.onChange)==null||u.call(this,w)}catch(v){console.error("Error uploading file:",v),this.updatePreviewState(null)}},t.appendChild(this.previewWrapper),t.appendChild(s),t.appendChild(o),t}}class Z extends d{constructor(t={}){super(t),this.inputType="number",this.value=this.value??100,this.numberSetting=new m({title:"Height",default:this.value,suffix:"px",minValue:t.minHeight??1,maxValue:t.maxHeight,icon:z}),this.numberSetting.setOnChange(e=>{var i;isNaN(e)||e<1||(this.value=e,(i=this.onChange)==null||i.call(this,this.value))})}draw(){return this.numberSetting.draw()}}const z=`<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
73
73
|
<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"/>
|
|
74
|
-
</svg>`;class U extends d{constructor(t={}){super(t),this.inputType="number",this.value=this.value??100,this.numberSetting=new
|
|
74
|
+
</svg>`;class U extends d{constructor(t={}){super(t),this.inputType="number",this.value=this.value??100,this.numberSetting=new m({title:"Width",default:this.value,suffix:"px",minValue:t.minWidth??0,maxValue:t.maxWidth,icon:q}),this.numberSetting.setOnChange(e=>{var i;isNaN(e)||e<1||(this.value=e,(i=this.onChange)==null||i.call(this,this.value))})}draw(){return this.numberSetting.draw()}}const q=`<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
75
75
|
<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"/>
|
|
76
76
|
</svg>`,D=`
|
|
77
77
|
<svg xmlns="http://www.w3.org/2000/svg" class="svg-select-api" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-chevron-down">
|
|
78
78
|
<polyline points="6 9 12 15 18 9"></polyline>
|
|
79
79
|
</svg>
|
|
80
|
-
`;class P extends d{constructor(t={}){if(super(t),this.inputType="select",this._options=[],this.isOpen=!1,this.selectedOptionIndex=null,this.optionsListEl=null,this.svgContainer=null,t.options&&(this._options=[...t.options]),t.getOptions&&this._options.push(...t.getOptions()),t.getOptionsAsync&&t.getOptionsAsync().then(e=>{this._options.push(...e)}).catch(e=>{console.error("Failed to fetch async options:",e)}),this.value!==void 0){const e=this._options.findIndex(i=>i.value===this.value);e>=0&&(this.selectedOptionIndex=e)}this.optionsListEl=this.optionsListEl,this.svgContainer=this.svgContainer}createOption(t,e){const i=document.createElement("li");i.classList.add("select-api-option"),i.textContent=t.name,i.dataset.index=String(e);const n=document.createElement("input");return n.type="radio",n.classList.add("select-api-radio"),n.name="select-api-radio-group",i.appendChild(n),this.selectedOptionIndex===e&&(n.checked=!0),i}draw(){const t=document.createElement("div");if(t.classList.add("select-api-container"),this.props.icon||this.props.title){const s=document.createElement("div");if(s.className="icon-container",this.props.icon){const o=this.createIcon(this.props.icon);s.appendChild(o)}if(this.props.title){const o=this.createLabel(this.props.title);s.appendChild(o)}t.appendChild(s)}const e=document.createElement("div");e.classList.add("select-api-button"),e.textContent=this.selectedOptionIndex!==null?this._options[this.selectedOptionIndex].name:"Select an option",e.onclick=()=>{var s,o;this.isOpen=!this.isOpen,(s=this.optionsListEl)==null||s.classList.toggle("open",this.isOpen),(o=this.svgContainer)==null||o.classList.toggle("open",this.isOpen)},t.appendChild(e);const i=document.createElement("ul");i.classList.add("select-api-options"),this._options.forEach((s,o)=>{const a=this.createOption(s,o);a.onclick=l=>this.selectApiOption(l,o,e),i.appendChild(a)}),t.appendChild(i);const n=document.createElement("div");return n.classList.add("svg-container"),n.innerHTML=D,t.appendChild(n),n.onclick=()=>{var s,o;this.isOpen=!this.isOpen,(s=this.optionsListEl)==null||s.classList.toggle("open",this.isOpen),(o=this.svgContainer)==null||o.classList.toggle("open",this.isOpen)},this.optionsListEl=i,this.svgContainer=n,t}selectApiOption(t,e,i){var s,o,a;const n=this._options[e];if(n){console.log("selectedOption",n),this.value=n.value,(s=this.onChange)==null||s.call(this,this.value),this.selectedOptionIndex=e,this.isOpen=!1,i.textContent=n.name,(o=this.optionsListEl)==null||o.classList.remove("open"),(a=this.svgContainer)==null||a.classList.remove("open");const l=t.currentTarget.querySelector(".select-api-radio");l&&(l.checked=!0)}}}const X=`
|
|
80
|
+
`;class P extends d{constructor(t={}){if(super(t),this.inputType="select",this._options=[],this.isOpen=!1,this.selectedOptionIndex=null,this.optionsListEl=null,this.svgContainer=null,t.options&&(this._options=[...t.options]),t.getOptions&&this._options.push(...t.getOptions()),t.getOptionsAsync&&t.getOptionsAsync().then(e=>{this._options.push(...e),this.updateOptionsList()}).catch(e=>{console.error("Failed to fetch async options:",e)}),this.value!==void 0){const e=this._options.findIndex(i=>i.value===this.value);e>=0&&(this.selectedOptionIndex=e)}this.optionsListEl=this.optionsListEl,this.svgContainer=this.svgContainer}createOption(t,e){const i=document.createElement("li");i.classList.add("select-api-option"),i.textContent=t.name,i.dataset.index=String(e);const n=document.createElement("input");return n.type="radio",n.classList.add("select-api-radio"),n.name="select-api-radio-group",i.appendChild(n),this.selectedOptionIndex===e&&(n.checked=!0),i}draw(){const t=document.createElement("div");if(t.classList.add("select-api-container"),this.props.icon||this.props.title){const s=document.createElement("div");if(s.className="icon-container",this.props.icon){const o=this.createIcon(this.props.icon);s.appendChild(o)}if(this.props.title){const o=this.createLabel(this.props.title);s.appendChild(o)}t.appendChild(s)}const e=document.createElement("div");e.classList.add("select-api-button"),e.textContent=this.selectedOptionIndex!==null?this._options[this.selectedOptionIndex].name:"Select an option",e.onclick=()=>{var s,o;this.isOpen=!this.isOpen,(s=this.optionsListEl)==null||s.classList.toggle("open",this.isOpen),(o=this.svgContainer)==null||o.classList.toggle("open",this.isOpen)},t.appendChild(e);const i=document.createElement("ul");i.classList.add("select-api-options"),this._options.forEach((s,o)=>{const a=this.createOption(s,o);a.onclick=l=>this.selectApiOption(l,o,e),i.appendChild(a)}),t.appendChild(i);const n=document.createElement("div");return n.classList.add("svg-container"),n.innerHTML=D,t.appendChild(n),n.onclick=()=>{var s,o;this.isOpen=!this.isOpen,(s=this.optionsListEl)==null||s.classList.toggle("open",this.isOpen),(o=this.svgContainer)==null||o.classList.toggle("open",this.isOpen)},this.optionsListEl=i,this.svgContainer=n,t}selectApiOption(t,e,i){var s,o,a;const n=this._options[e];if(n){console.log("selectedOption",n),this.value=n.value,(s=this.onChange)==null||s.call(this,this.value),this.selectedOptionIndex=e,this.isOpen=!1,i.textContent=n.name,(o=this.optionsListEl)==null||o.classList.remove("open"),(a=this.svgContainer)==null||a.classList.remove("open");const l=t.currentTarget.querySelector(".select-api-radio");l&&(l.checked=!0)}}updateOptionsList(){this.optionsListEl&&(this.optionsListEl.innerHTML="",this._options.forEach((t,e)=>{const i=this.createOption(t,e);i.onclick=n=>this.selectApiOption(n,e,this.optionsListEl),this.optionsListEl.appendChild(i)}))}}const X=`
|
|
81
81
|
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
82
82
|
<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"/>
|
|
83
83
|
</svg>
|
|
@@ -85,7 +85,7 @@
|
|
|
85
85
|
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
86
86
|
<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"/>
|
|
87
87
|
</svg>
|
|
88
|
-
`;class Q extends g{constructor(t){super({title:"Border",collapsed:t==null?void 0:t.collapsed,settings:{size:new
|
|
88
|
+
`;class Q extends g{constructor(t){super({title:"Border",collapsed:t==null?void 0:t.collapsed,settings:{size:new m({title:"Size",icon:J,default:(t==null?void 0:t.size)??0,suffix:"px"}),color:new E({default:(t==null?void 0:t.color)??"0, 0, 30"}),opacity:new b({default:(t==null?void 0:t.opacity)??100,minValue:0,maxValue:100}),radius:new m({title:"Radius",icon:X,default:(t==null?void 0:t.radius)??12,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`
|
|
89
89
|
border-color: ${t};
|
|
90
90
|
border-width: ${n}px;
|
|
91
91
|
border-radius: ${i}px;
|
|
@@ -102,7 +102,7 @@
|
|
|
102
102
|
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
103
103
|
<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"/>
|
|
104
104
|
</svg>
|
|
105
|
-
`;class et extends g{constructor(t={}){super({title:t.title||"Typography",collapsed:t.collapsed,settings:{color:new E({default:t.colorDefault??"0, 0, 30"}),opacity:new
|
|
105
|
+
`;class et extends g{constructor(t={}){super({title:t.title||"Typography",collapsed:t.collapsed,settings:{color:new E({default:t.colorDefault??"0, 0, 30"}),opacity:new b({default:t.colorOpacityDefault??100}),fontFamily:new S({title:"Font",icon:Y,default:t.fontFamilyDefault??"Satoshi",options:t.fontFamilyOptions??[{name:"Satoshi",value:"Satoshi"},{name:"Arial",value:"Arial"},{name:"Roboto",value:"Roboto"}],getOptions:t.fontFamilyGetOptions,getOptionsAsync:t.fontFamilyGetOptionsAsync}),fontWeight:new S({title:"Weight",icon:K,default:t.fontWeightDefault??"bold",options:t.fontWeightOptions??[{name:"Regular",value:"400"},{name:"Medium",value:"500"},{name:"Bold",value:"600"}],getOptions:t.fontWeightGetOptions,getOptionsAsync:t.fontWeightGetOptionsAsync}),fontSize:new m({title:"Size",icon:tt,default:t.fontSizeDefault??12,suffix:"px"}),align:new V({title:"Align",default:t.alignDefault??"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,o=this.settings.align.value??"left";return`
|
|
106
106
|
color: ${t};
|
|
107
107
|
opacity: ${e/100};
|
|
108
108
|
font-family: ${i};
|
|
@@ -143,7 +143,7 @@
|
|
|
143
143
|
</svg>
|
|
144
144
|
</span>
|
|
145
145
|
<span class="add-label">Add Tab</span>
|
|
146
|
-
`,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())}))}}class ct extends g{constructor(t){super({title:"Background Image",collapsed:t==null?void 0:t.collapsed,settings:{backgroundImage:new O({...t==null?void 0:t.uploadProps,default:(t==null?void 0:t.backgroundImage)??""}),opacity:new
|
|
146
|
+
`,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())}))}}class ct extends g{constructor(t){super({title:"Background Image",collapsed:t==null?void 0:t.collapsed,settings:{backgroundImage:new O({...t==null?void 0:t.uploadProps,default:(t==null?void 0:t.backgroundImage)??""}),opacity:new b({default:(t==null?void 0:t.opacity)??100}),backgroundColor:new E({default:(t==null?void 0:t.backgroundColor)??"0, 0, 30"}),opacityBG:new b({default:(t==null?void 0:t.opacityBG)??100})}})}draw(){const t=super.draw(),e=t.querySelector(".setting-group-content");if(!e)return t;const i=Array.from(e.children),[n,s,o,a]=i;e.innerHTML="",e.appendChild(n),e.appendChild(s);const l=document.createElement("div");return l.className="bgset-or-label",l.textContent="OR",e.appendChild(l),e.appendChild(o),e.appendChild(a),t}getCssCode(){const t=this.settings.backgroundImage.value||"",e=this.settings.opacity.value??100,i=this.settings.backgroundColor.value||"0, 0, 30",n=this.settings.opacityBG.value??100;return t?`
|
|
147
147
|
background-image: url("${t}");
|
|
148
148
|
background-size: cover;
|
|
149
149
|
background-position: center;
|
|
@@ -151,4 +151,4 @@
|
|
|
151
151
|
`:`
|
|
152
152
|
background-color: ${i};
|
|
153
153
|
opacity: ${n/100};
|
|
154
|
-
`}}exports.AlignSetting=
|
|
154
|
+
`}}exports.AlignSetting=V;exports.BackgroundSettingSet=ct;exports.BorderSettingSet=Q;exports.ButtonSetting=j;exports.ColorSetting=E;exports.DimensionSetting=A;exports.HeaderTypographySettingSet=et;exports.HeightSetting=Z;exports.MarginSettingGroup=it;exports.NumberSetting=m;exports.OpacitySetting=b;exports.SelectApiSettings=P;exports.SelectSetting=S;exports.Setting=d;exports.SettingGroup=g;exports.StringSetting=k;exports.TabsContainerGroup=rt;exports.UploadSetting=O;exports.WidthSetting=U;exports.iterateSettings=T;
|
|
@@ -125,7 +125,7 @@ class u {
|
|
|
125
125
|
return i.className = "input-icon " + (e || ""), i.innerHTML = t, i;
|
|
126
126
|
}
|
|
127
127
|
}
|
|
128
|
-
class
|
|
128
|
+
class L extends u {
|
|
129
129
|
constructor(t = {}) {
|
|
130
130
|
super(t), this.inputType = "text";
|
|
131
131
|
}
|
|
@@ -146,7 +146,7 @@ class y extends u {
|
|
|
146
146
|
}
|
|
147
147
|
}
|
|
148
148
|
const H = "<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>";
|
|
149
|
-
class
|
|
149
|
+
class y extends L {
|
|
150
150
|
constructor(t) {
|
|
151
151
|
super({
|
|
152
152
|
...t,
|
|
@@ -236,7 +236,7 @@ class w extends u {
|
|
|
236
236
|
return n.className = "suffix-label", n.textContent = this.props.suffix, e.appendChild(n), e;
|
|
237
237
|
}
|
|
238
238
|
}
|
|
239
|
-
class
|
|
239
|
+
class x extends w {
|
|
240
240
|
constructor(t) {
|
|
241
241
|
super({
|
|
242
242
|
...t,
|
|
@@ -464,12 +464,12 @@ const R = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBo
|
|
|
464
464
|
<rect width="91" height="71" rx="4" fill="#F2F4F7"/>
|
|
465
465
|
<path d="M37 31.5L39.5 29M39.5 29L42 31.5M39.5 29V34.625M44.5 31.9643C45.2634 31.3338 45.75 30.38 45.75 29.3125C45.75 27.414 44.211 25.875 42.3125 25.875C42.1759 25.875 42.0482 25.8037 41.9788 25.6861C41.1638 24.303 39.659 23.375 37.9375 23.375C35.3487 23.375 33.25 25.4737 33.25 28.0625C33.25 29.3538 33.7721 30.5232 34.6168 31.371" stroke="#475467" stroke-linecap="round" stroke-linejoin="round"/>
|
|
466
466
|
</svg>
|
|
467
|
-
`,
|
|
467
|
+
`, _ = `
|
|
468
468
|
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 12 12" fill="none">
|
|
469
469
|
<path d="M8 3V2.6C8 2.03995 8 1.75992 7.89101 1.54601C7.79513 1.35785 7.64215 1.20487 7.45399 1.10899C7.24008 1 6.96005 1 6.4 1H5.6C5.03995 1 4.75992 1 4.54601 1.10899C4.35785 1.20487 4.20487 1.35785 4.10899 1.54601C4 1.75992 4 2.03995 4 2.6V3M5 5.75V8.25M7 5.75V8.25M1.5 3H10.5M9.5 3V8.6C9.5 9.44008 9.5 9.86012 9.33651 10.181C9.1927 10.4632 8.96323 10.6927 8.68099 10.8365C8.36012 11 7.94008 11 7.1 11H4.9C4.05992 11 3.63988 11 3.31901 10.8365C3.03677 10.6927 2.8073 10.4632 2.66349 10.181C2.5 9.86012 2.5 9.44008 2.5 8.6V3" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
|
|
470
470
|
</svg>
|
|
471
471
|
`;
|
|
472
|
-
class
|
|
472
|
+
class W extends u {
|
|
473
473
|
constructor(t = {}) {
|
|
474
474
|
super(t), this.inputType = "button", this.previewWrapper = null, this.previewEl = null, this.emptyStateEl = null, !this.value && t.defaultUrl && t.defaultUrl !== "" && (this.value = t.defaultUrl);
|
|
475
475
|
}
|
|
@@ -499,7 +499,7 @@ class _ extends u {
|
|
|
499
499
|
}
|
|
500
500
|
t.appendChild(e), this.emptyStateEl = document.createElement("div"), this.emptyStateEl.className = "empty-state", this.emptyStateEl.innerHTML = A, this.previewEl = document.createElement("img"), this.previewEl.className = "upload-preview", this.value && this.value !== "" ? this.updatePreviewState(this.value) : this.updatePreviewState(null);
|
|
501
501
|
const n = document.createElement("button");
|
|
502
|
-
n.className = "delete-button", n.type = "button", n.title = "Delete image", n.innerHTML =
|
|
502
|
+
n.className = "delete-button", n.type = "button", n.title = "Delete image", n.innerHTML = _, this.previewWrapper.appendChild(this.emptyStateEl), this.previewWrapper.appendChild(this.previewEl), this.previewWrapper.appendChild(n);
|
|
503
503
|
const s = document.createElement("button");
|
|
504
504
|
s.className = "upload-button", s.innerHTML = `
|
|
505
505
|
<span class="upload-icon">${E}</span>
|
|
@@ -592,7 +592,7 @@ const G = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBo
|
|
|
592
592
|
class st extends u {
|
|
593
593
|
constructor(t = {}) {
|
|
594
594
|
if (super(t), this.inputType = "select", this._options = [], this.isOpen = !1, this.selectedOptionIndex = null, this.optionsListEl = null, this.svgContainer = null, t.options && (this._options = [...t.options]), t.getOptions && this._options.push(...t.getOptions()), t.getOptionsAsync && t.getOptionsAsync().then((e) => {
|
|
595
|
-
this._options.push(...e);
|
|
595
|
+
this._options.push(...e), this.updateOptionsList();
|
|
596
596
|
}).catch((e) => {
|
|
597
597
|
console.error("Failed to fetch async options:", e);
|
|
598
598
|
}), this.value !== void 0) {
|
|
@@ -646,6 +646,12 @@ class st extends u {
|
|
|
646
646
|
l && (l.checked = !0);
|
|
647
647
|
}
|
|
648
648
|
}
|
|
649
|
+
updateOptionsList() {
|
|
650
|
+
this.optionsListEl && (this.optionsListEl.innerHTML = "", this._options.forEach((t, e) => {
|
|
651
|
+
const i = this.createOption(t, e);
|
|
652
|
+
i.onclick = (n) => this.selectApiOption(n, e, this.optionsListEl), this.optionsListEl.appendChild(i);
|
|
653
|
+
}));
|
|
654
|
+
}
|
|
649
655
|
}
|
|
650
656
|
const z = `
|
|
651
657
|
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
@@ -668,10 +674,10 @@ class ot extends C {
|
|
|
668
674
|
default: (t == null ? void 0 : t.size) ?? 0,
|
|
669
675
|
suffix: "px"
|
|
670
676
|
}),
|
|
671
|
-
color: new
|
|
677
|
+
color: new y({
|
|
672
678
|
default: (t == null ? void 0 : t.color) ?? "0, 0, 30"
|
|
673
679
|
}),
|
|
674
|
-
opacity: new
|
|
680
|
+
opacity: new x({
|
|
675
681
|
default: (t == null ? void 0 : t.opacity) ?? 100,
|
|
676
682
|
minValue: 0,
|
|
677
683
|
maxValue: 100
|
|
@@ -717,10 +723,10 @@ class at extends C {
|
|
|
717
723
|
title: t.title || "Typography",
|
|
718
724
|
collapsed: t.collapsed,
|
|
719
725
|
settings: {
|
|
720
|
-
color: new
|
|
726
|
+
color: new y({
|
|
721
727
|
default: t.colorDefault ?? "0, 0, 30"
|
|
722
728
|
}),
|
|
723
|
-
opacity: new
|
|
729
|
+
opacity: new x({
|
|
724
730
|
default: t.colorOpacityDefault ?? 100
|
|
725
731
|
}),
|
|
726
732
|
fontFamily: new N({
|
|
@@ -772,7 +778,7 @@ class at extends C {
|
|
|
772
778
|
`;
|
|
773
779
|
}
|
|
774
780
|
}
|
|
775
|
-
class
|
|
781
|
+
class b extends u {
|
|
776
782
|
constructor(t) {
|
|
777
783
|
super({
|
|
778
784
|
...t,
|
|
@@ -823,25 +829,25 @@ class lt extends C {
|
|
|
823
829
|
super({
|
|
824
830
|
title: "Margins",
|
|
825
831
|
settings: {
|
|
826
|
-
marginTop: new
|
|
832
|
+
marginTop: new b({
|
|
827
833
|
title: "Top",
|
|
828
834
|
icon: X,
|
|
829
835
|
suffix: "px",
|
|
830
836
|
default: (t == null ? void 0 : t.marginTop) ?? "auto"
|
|
831
837
|
}),
|
|
832
|
-
marginRight: new
|
|
838
|
+
marginRight: new b({
|
|
833
839
|
title: "Right",
|
|
834
840
|
icon: J,
|
|
835
841
|
suffix: "px",
|
|
836
842
|
default: (t == null ? void 0 : t.marginRight) ?? 0
|
|
837
843
|
}),
|
|
838
|
-
marginBottom: new
|
|
844
|
+
marginBottom: new b({
|
|
839
845
|
title: "Bottom",
|
|
840
846
|
icon: Q,
|
|
841
847
|
suffix: "px",
|
|
842
848
|
default: (t == null ? void 0 : t.marginBottom) ?? 0
|
|
843
849
|
}),
|
|
844
|
-
marginLeft: new
|
|
850
|
+
marginLeft: new b({
|
|
845
851
|
title: "Left",
|
|
846
852
|
icon: Y,
|
|
847
853
|
suffix: "px",
|
|
@@ -874,11 +880,11 @@ class K extends C {
|
|
|
874
880
|
super({
|
|
875
881
|
title: `Tab ${t + 1}`,
|
|
876
882
|
settings: {
|
|
877
|
-
name: new
|
|
883
|
+
name: new L({
|
|
878
884
|
title: "Tab Name",
|
|
879
885
|
default: `Tab ${t + 1}`
|
|
880
886
|
}),
|
|
881
|
-
content: new
|
|
887
|
+
content: new L({
|
|
882
888
|
title: "Content",
|
|
883
889
|
default: ""
|
|
884
890
|
})
|
|
@@ -1001,17 +1007,17 @@ class ct extends C {
|
|
|
1001
1007
|
title: "Background Image",
|
|
1002
1008
|
collapsed: t == null ? void 0 : t.collapsed,
|
|
1003
1009
|
settings: {
|
|
1004
|
-
backgroundImage: new
|
|
1010
|
+
backgroundImage: new W({
|
|
1005
1011
|
...t == null ? void 0 : t.uploadProps,
|
|
1006
1012
|
default: (t == null ? void 0 : t.backgroundImage) ?? ""
|
|
1007
1013
|
}),
|
|
1008
|
-
opacity: new
|
|
1014
|
+
opacity: new x({
|
|
1009
1015
|
default: (t == null ? void 0 : t.opacity) ?? 100
|
|
1010
1016
|
}),
|
|
1011
|
-
backgroundColor: new
|
|
1017
|
+
backgroundColor: new y({
|
|
1012
1018
|
default: (t == null ? void 0 : t.backgroundColor) ?? "0, 0, 30"
|
|
1013
1019
|
}),
|
|
1014
|
-
opacityBG: new
|
|
1020
|
+
opacityBG: new x({
|
|
1015
1021
|
default: (t == null ? void 0 : t.opacityBG) ?? 100
|
|
1016
1022
|
})
|
|
1017
1023
|
}
|
|
@@ -1049,20 +1055,20 @@ export {
|
|
|
1049
1055
|
ct as BackgroundSettingSet,
|
|
1050
1056
|
ot as BorderSettingSet,
|
|
1051
1057
|
tt as ButtonSetting,
|
|
1052
|
-
|
|
1058
|
+
y as ColorSetting,
|
|
1053
1059
|
et as DimensionSetting,
|
|
1054
1060
|
at as HeaderTypographySettingSet,
|
|
1055
1061
|
it as HeightSetting,
|
|
1056
1062
|
lt as MarginSettingGroup,
|
|
1057
1063
|
w as NumberSetting,
|
|
1058
|
-
|
|
1064
|
+
x as OpacitySetting,
|
|
1059
1065
|
st as SelectApiSettings,
|
|
1060
1066
|
N as SelectSetting,
|
|
1061
1067
|
u as Setting,
|
|
1062
1068
|
C as SettingGroup,
|
|
1063
|
-
|
|
1069
|
+
L as StringSetting,
|
|
1064
1070
|
rt as TabsContainerGroup,
|
|
1065
|
-
|
|
1071
|
+
W as UploadSetting,
|
|
1066
1072
|
nt as WidthSetting,
|
|
1067
1073
|
T as iterateSettings
|
|
1068
1074
|
};
|
package/dist/index.d.ts
CHANGED
package/package.json
CHANGED