builder-settings-types 0.0.216 → 0.0.217

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,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const T="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let M=(c=21)=>{let t="",e=crypto.getRandomValues(new Uint8Array(c|=0));for(;c--;)t+=T[e[c]&63];return t};function b(c){if(c===null||typeof c!="object")return c;if(c instanceof Date)return new Date(c.getTime());if(Array.isArray(c)){const i=[];for(let s=0;s<c.length;s++)i[s]=b(c[s]);return i}const t={};for(const i in c)Object.prototype.hasOwnProperty.call(c,i)&&(t[i]=b(c[i]));const e=Object.getPrototypeOf(c);return e!==Object.prototype&&Object.setPrototypeOf(t,e),t}function B(c){switch(c){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 p{constructor(t={}){this.props=t,this.id=t.id||M(),this.value=this.props.default,this.desktop=this.props.default,this.title=t.title||"",this.includeGetJson=t.includeGetJson!==void 0?t.includeGetJson:!0}static SetUploadUrl(t){window.DefaultUploadUrl=t,p.DefaultUploadUrl=t}destroy(){throw new Error("Method not implemented.")}setOnChange(t){return this.onChange=t,this}setOnBlur(t){return this.onBlur=t,this}setValue(t){this.value=t,this.inputEl&&(this.inputEl.value=String(t)),this.onChange&&this.onChange(t),this.props.detectChange&&this.props.detectChange(t)}clone(){const t=this.constructor,e=b(this.props),i=new t(e);return i.value=b(this.value),i}createInput(t){t={...this.props.inputProps,...t};const e=document.createElement("div");if(e.className=t.wrapperClassName||"",t.title||t.icon){const a=document.createElement("div");if(a.className="icon-container",t.icon){const l=this.createIcon(t.icon,t.iconClassName);a.appendChild(l)}if(t.title){const l=this.createLabel(t.title,t.labelClassName);a.appendChild(l)}e.appendChild(a)}const i=document.createElement("div");i.className=t.wrapperClassName||"";const s=document.createElement("input");this.inputEl=s,s.value=String(t.value||B(t.inputType)),s.type=t.inputType,s.placeholder=t.placeholder||"",s.className=t.inputClassName||"";const n=a=>{const l=a.target;let h=l.value;switch(t.inputType){case"number":h=Number(l.value);break;case"color":h=l.value;break;case"date":h=l.value;break;case"select":h=l.value;break;case"text":h=l.value;break;case"button":h=l.value;break;default:h=l.value}this.value=h,this.onChange&&this.onChange(this.value),this.props.detectChange&&this.props.detectChange(this.value)},o=a=>{a.target,this.onBlur&&this.onBlur(this.value)};return s.addEventListener("input",n),s.addEventListener("change",n),s.addEventListener("blur",o),t.inputCustomizer&&t.inputCustomizer(s),i.appendChild(s),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}}function A(c){let t=0,e=c.parentElement;for(;e;)e.classList.contains("setting-group")&&e!==c&&t++,e=e.parentElement;return t}function y(c,t){const e=Math.min(Math.max(t,0),5);c.setAttribute("data-nesting-level",e.toString()),e>0?c.style.setProperty("--visual-indent",`${e*2}px`):(c.style.removeProperty("--visual-indent"),c.style.marginLeft="")}function k(c,t=0){c.querySelectorAll(":scope > .setting-group-content > .setting-group").forEach(i=>{const s=i,n=t+1;y(s,n),k(s,n)})}const R={maxLevel:5,spacingMultiplier:1,visualIndentMultiplier:2,enableAutoDetection:!0};class ${constructor(t={}){this.observedElements=new Set,this.config={...R,...t},this.config.enableAutoDetection&&this.setupAutoDetection()}setupAutoDetection(){this.observer=new MutationObserver(t=>{let e=!1;t.forEach(i=>{i.type==="childList"&&i.addedNodes.forEach(s=>{s instanceof HTMLElement&&(s.classList.contains("setting-group")?[s]:Array.from(s.querySelectorAll(".setting-group"))).length>0&&(e=!0)})}),e&&this.updateAllNesting()}),this.observer.observe(document.body,{childList:!0,subtree:!0})}trackElement(t){this.observedElements.add(t),this.updateElementNesting(t)}untrackElement(t){this.observedElements.delete(t)}updateElementNesting(t){const e=A(t);this.applyNestingWithConfig(t,e)}updateAllNesting(){this.observedElements.forEach(t=>{t.isConnected?this.updateElementNesting(t):this.observedElements.delete(t)})}applyNestingWithConfig(t,e){const i=Math.min(Math.max(e,0),this.config.maxLevel);if(t.setAttribute("data-nesting-level",i.toString()),i>0){const s=i*this.config.visualIndentMultiplier;t.style.setProperty("--visual-indent",`${s}px`)}else t.style.removeProperty("--visual-indent"),t.style.marginLeft=""}recalculateNesting(t=document.body){t.querySelectorAll(".setting-group").forEach(i=>{const s=i;this.updateElementNesting(s),this.trackElement(s)})}getNestingStats(){const t={};return this.observedElements.forEach(e=>{const i=parseInt(e.getAttribute("data-nesting-level")||"0",10);t[i]=(t[i]||0)+1}),t}destroy(){this.observer&&(this.observer.disconnect(),this.observer=void 0),this.observedElements.clear()}}const F=new $;function w(c,t){for(const e in c)if(c.hasOwnProperty(e)){const i=c[e];t(e,i)}}const g=class g{constructor(t){this.elementRef=null,this.isHidden=!1,this.custom=!1,this.initialValues={},this.changeTimeout=null,this.isHandlingChange=!1,this.changeHandlers=new Set,this.blurTimeout=null,this.lastChangeTime=0,this.handleBlur=()=>{},this.pendingBlurHandler=null,this.originalDefaultValues={},this.nestingLevel=0,this.parentNestingLevel=0,this.id=t.id||M(),this.title=t.title,this.settings=t.settings,this.description=t.description,this.icon=t.icon,this.isCollapsed=t.collapsed??!1,this.isMain=t.main??!1,this.custom=t.custom??!1,this.hideCondition=t.hideCondition,this.onBlur=t.onBlur,this.parentNestingLevel=t.parentNestingLevel??0,this.nestingLevel=this.parentNestingLevel,Object.assign(this,t.settings),this.initialValues=this.getValues(),this.originalDefaultValues=this.getDefaultValues(),this.propagateNestingLevel()}propagateNestingLevel(){const t=this.nestingLevel+1;w(this.settings,(e,i)=>{i instanceof g&&(i.parentNestingLevel=this.nestingLevel,i.nestingLevel=t,i.propagateNestingLevel())})}getNestingLevel(){return this.nestingLevel}setNestingLevel(t){this.nestingLevel=t,this.propagateNestingLevel(),this.elementRef&&this.updateNestingStyles()}updateNestingStyles(){this.elementRef&&(y(this.elementRef,this.nestingLevel),k(this.elementRef,this.nestingLevel))}static hide(){this.hiddenElements.forEach(t=>{t&&(t.style.display="none")})}static show(){this.hiddenElements.forEach(t=>{t&&(t.style.display="")})}setOnChange(t){this.onChange=t;const e=()=>{this.isHandlingChange||(this.isHandlingChange=!0,this.changeTimeout&&clearTimeout(this.changeTimeout),this.changeTimeout=setTimeout(()=>{const i=this.getValues(),s=this.calculateChanges(this.initialValues,i);Object.keys(s).length>0&&(this.lastChangeTime=Date.now(),this.initialValues=i,t(i),this.updateVisibility()),this.isHandlingChange=!1},50))};return this.changeHandlers.clear(),w(this.settings,(i,s)=>{var n;if(s instanceof g)s.setOnChange(o=>{const a=this.getValues();this.initialValues=a,t(a)}),this.changeHandlers.add(()=>t(this.getValues()));else if(s instanceof p){const o=()=>{e()};this.changeHandlers.add(o),s.setOnChange(o)}else{const o=()=>{e()};this.changeHandlers.add(o),(n=s.setOnChange)==null||n.call(s,o)}}),this}setOnBlur(t){return this.onBlur=t,this.pendingBlurHandler=t,this.handleBlur=e=>{(e==null?void 0:e.target)instanceof HTMLElement&&e.target.closest(".setting-group")!==this.elementRef||(this.blurTimeout&&clearTimeout(this.blurTimeout),this.blurTimeout=setTimeout(()=>{t()},100))},this.elementRef&&this.setupBlurHandlers(),this}setupBlurHandlers(){this.elementRef&&this.elementRef.removeEventListener("focusout",this.handleBlur),this.elementRef&&this.elementRef.addEventListener("focusout",this.handleBlur,!0),w(this.settings,(t,e)=>{e instanceof g&&e.setOnBlur(()=>{this.onBlur&&this.onBlur()})})}cleanup(){this.changeTimeout&&(clearTimeout(this.changeTimeout),this.changeTimeout=null),this.blurTimeout&&(clearTimeout(this.blurTimeout),this.blurTimeout=null),this.elementRef&&this.elementRef.removeEventListener("focusout",this.handleBlur),this.changeHandlers.clear()}clone(){const t={};w(this.settings,(s,n)=>{typeof n.clone=="function"?t[s]=n.clone():(console.warn(`Setting with key '${s}' does not have a clone method. Copying reference.`),t[s]=n)});const e={title:this.title,settings:t,description:this.description,icon:this.icon,collapsed:this.isCollapsed,main:this.isMain,custom:this.custom,hideCondition:this.hideCondition,parentNestingLevel:this.parentNestingLevel},i=V(e);return i.initialValues=this.getValues(),i}setValue(t){if(!t||typeof t!="object")return;Object.entries(t).forEach(([i,s])=>{const n=this.settings[i];n&&(n instanceof g||n instanceof p)&&typeof n.setValue=="function"&&n.setValue(s)}),setTimeout(()=>{this.forceChildUIRefresh()},0);const e=this.getValues();this.initialValues=e,this.onChange&&this.onChange(e)}forceChildUIRefresh(){Object.entries(this.settings).forEach(([t,e])=>{try{if(e instanceof g){const i=e.getValues();e.setValue(i)}else if(typeof e.setValue=="function"){const i=e.value;i!==void 0&&e.setValue(i)}}catch(i){console.warn(`Error refreshing UI for setting ${t}:`,i)}})}calculateChanges(t,e){const i={};return new Set([...Object.keys(t),...Object.keys(e)]).forEach(n=>{const o=t[n],a=e[n];JSON.stringify(o)!==JSON.stringify(a)&&(i[n]={from:o,to:a})}),i}hide(){this.elementRef&&(this.elementRef.style.display="none",this.isHidden=!0)}show(){this.elementRef&&(this.elementRef.style.display="",this.isHidden=!1)}getValues(t){if(t===void 0){const e={};for(const i in this.settings)if(this.settings.hasOwnProperty(i)){const s=this.settings[i];s instanceof g?e[i]=s.getValues():e[i]=s.value}return e}else{const e=this.settings[t];return e?e instanceof g?e.getValues():e.value:void 0}}getValuesForJson(t){if(t===void 0){const e={};for(const i in this.settings)if(this.settings.hasOwnProperty(i)){const s=this.settings[i];s instanceof g?e[i]=s.getValuesForJson():s.includeGetJson===!1?e[i]=null:e[i]=s.value}return e}else{const e=this.settings[t];return e?e instanceof g?e.getValuesForJson():e.includeGetJson===!1?null:e.value:void 0}}getDefaultValues(t){if(t===void 0){const e={};for(const i in this.settings)if(this.settings.hasOwnProperty(i)){const s=this.settings[i];s instanceof g?e[i]=s.getDefaultValues():e[i]=s.default!==void 0?s.default:s.value}return e}else{const e=this.settings[t];return e?e instanceof g?e.getDefaultValues():e.default!==void 0?e.default:e.value:void 0}}getMobileValues(t){if(t===void 0){const e={};for(const i in this.settings)if(this.settings.hasOwnProperty(i)){const s=this.settings[i];if(s instanceof g)e[i]=s.getMobileValues();else if(typeof s.getMobileValue=="function"){const n=s.getMobileValue();e[i]=n!==void 0?n:s.value}else e[i]=s.value}return e}else{const e=this.settings[t];if(!e)return;if(e instanceof g)return e.getMobileValues();if(typeof e.getMobileValue=="function"){const i=e.getMobileValue();return i!==void 0?i:e.value}else return e.value}}setMobileValues(t){if(!(!t||typeof t!="object")&&(Object.entries(t).forEach(([e,i])=>{const s=this.settings[e];s&&(s instanceof g?typeof i=="object"&&i!==null&&s.setMobileValues(i):typeof s.setMobileValue=="function"&&s.setMobileValue(i))}),this.setValue(t),this.onChange)){const e=this.getValues();this.onChange(e)}}resetDefault(){const t=this.originalDefaultValues;if(this.setValue(t),this.onChange){const e=this.getValues();this.onChange(e)}}draw(){const t=document.createElement("div");t.className="setting-group",t.id=`setting-group-${this.id}`,g.hiddenElements.add(t),this.hideCondition&&this.hideCondition()&&(t.style.display="none"),this.isMain&&t.classList.add("main-group"),this.custom&&t.classList.add("custom_class"),y(t,this.nestingLevel);const e=document.createElement("div");e.className="setting-group-title",this.isCollapsed&&e.classList.add("collapsed-view"),e.setAttribute("role","button"),e.setAttribute("aria-expanded",(!this.isCollapsed).toString()),e.setAttribute("tabindex","0");const i=document.createElement("div");if(i.className="title-section",this.icon){const r=document.createElement("span");r.className="group-icon",r.innerHTML=this.icon,i.appendChild(r)}const s=document.createElement("h3");s.textContent=this.title,i.appendChild(s);const n=document.createElement("div");if(n.className="actions-section",this.description&&this.isCollapsed){const r=document.createElement("span");r.className="info-marker",r.innerHTML=`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const T="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let M=(c=21)=>{let t="",e=crypto.getRandomValues(new Uint8Array(c|=0));for(;c--;)t+=T[e[c]&63];return t};function b(c){if(c===null||typeof c!="object")return c;if(c instanceof Date)return new Date(c.getTime());if(Array.isArray(c)){const i=[];for(let s=0;s<c.length;s++)i[s]=b(c[s]);return i}const t={};for(const i in c)Object.prototype.hasOwnProperty.call(c,i)&&(t[i]=b(c[i]));const e=Object.getPrototypeOf(c);return e!==Object.prototype&&Object.setPrototypeOf(t,e),t}function B(c){switch(c){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 p{constructor(t={}){this.props=t,this.id=t.id||M(),this.value=this.props.default,this.desktop=this.props.default,this.title=t.title||"",this.includeGetJson=t.includeGetJson!==void 0?t.includeGetJson:!0}static SetUploadUrl(t){window.DefaultUploadUrl=t,p.DefaultUploadUrl=t}destroy(){throw new Error("Method not implemented.")}setOnChange(t){return this.onChange=t,this}setOnBlur(t){return this.onBlur=t,this}setValue(t){this.value=t,this.inputEl&&(this.inputEl.value=String(t)),this.onChange&&this.onChange(t),this.props.detectChange&&this.props.detectChange(t)}clone(){const t=this.constructor,e=b(this.props),i=new t(e);return i.value=b(this.value),i}createInput(t){t={...this.props.inputProps,...t};const e=document.createElement("div");if(e.className=t.wrapperClassName||"",t.title||t.icon){const a=document.createElement("div");if(a.className="icon-container",t.icon){const l=this.createIcon(t.icon,t.iconClassName);a.appendChild(l)}if(t.title){const l=this.createLabel(t.title,t.labelClassName);a.appendChild(l)}e.appendChild(a)}const i=document.createElement("div");i.className=t.wrapperClassName||"";const s=document.createElement("input");this.inputEl=s,s.value=String(t.value||B(t.inputType)),s.type=t.inputType,s.placeholder=t.placeholder||"",s.className=t.inputClassName||"";const n=a=>{const l=a.target;let h=l.value;switch(t.inputType){case"number":h=Number(l.value);break;case"color":h=l.value;break;case"date":h=l.value;break;case"select":h=l.value;break;case"text":h=l.value;break;case"button":h=l.value;break;default:h=l.value}this.value=h,this.onChange&&this.onChange(this.value),this.props.detectChange&&this.props.detectChange(this.value)},o=a=>{a.target,this.onBlur&&this.onBlur(this.value)};return s.addEventListener("input",n),s.addEventListener("change",n),s.addEventListener("blur",o),t.inputCustomizer&&t.inputCustomizer(s),i.appendChild(s),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}}function A(c){let t=0,e=c.parentElement;for(;e;)e.classList.contains("setting-group")&&e!==c&&t++,e=e.parentElement;return t}function y(c,t){const e=Math.min(Math.max(t,0),5);c.setAttribute("data-nesting-level",e.toString()),e>0?c.style.setProperty("--visual-indent",`${e*2}px`):(c.style.removeProperty("--visual-indent"),c.style.marginLeft="")}function k(c,t=0){c.querySelectorAll(":scope > .setting-group-content > .setting-group").forEach(i=>{const s=i,n=t+1;y(s,n),k(s,n)})}const R={maxLevel:5,spacingMultiplier:1,visualIndentMultiplier:2,enableAutoDetection:!0};class ${constructor(t={}){this.observedElements=new Set,this.config={...R,...t},this.config.enableAutoDetection&&this.setupAutoDetection()}setupAutoDetection(){this.observer=new MutationObserver(t=>{let e=!1;t.forEach(i=>{i.type==="childList"&&i.addedNodes.forEach(s=>{s instanceof HTMLElement&&(s.classList.contains("setting-group")?[s]:Array.from(s.querySelectorAll(".setting-group"))).length>0&&(e=!0)})}),e&&this.updateAllNesting()}),this.observer.observe(document.body,{childList:!0,subtree:!0})}trackElement(t){this.observedElements.add(t),this.updateElementNesting(t)}untrackElement(t){this.observedElements.delete(t)}updateElementNesting(t){const e=A(t);this.applyNestingWithConfig(t,e)}updateAllNesting(){this.observedElements.forEach(t=>{t.isConnected?this.updateElementNesting(t):this.observedElements.delete(t)})}applyNestingWithConfig(t,e){const i=Math.min(Math.max(e,0),this.config.maxLevel);if(t.setAttribute("data-nesting-level",i.toString()),i>0){const s=i*this.config.visualIndentMultiplier;t.style.setProperty("--visual-indent",`${s}px`)}else t.style.removeProperty("--visual-indent"),t.style.marginLeft=""}recalculateNesting(t=document.body){t.querySelectorAll(".setting-group").forEach(i=>{const s=i;this.updateElementNesting(s),this.trackElement(s)})}getNestingStats(){const t={};return this.observedElements.forEach(e=>{const i=parseInt(e.getAttribute("data-nesting-level")||"0",10);t[i]=(t[i]||0)+1}),t}destroy(){this.observer&&(this.observer.disconnect(),this.observer=void 0),this.observedElements.clear()}}const F=new $;function w(c,t){for(const e in c)if(c.hasOwnProperty(e)){const i=c[e];t(e,i)}}const g=class g{constructor(t){this.elementRef=null,this.isHidden=!1,this.custom=!1,this.initialValues={},this.changeTimeout=null,this.isHandlingChange=!1,this.changeHandlers=new Set,this.blurTimeout=null,this.lastChangeTime=0,this.handleBlur=()=>{},this.pendingBlurHandler=null,this.originalDefaultValues={},this.nestingLevel=0,this.parentNestingLevel=0,this.id=t.id||M(),this.title=t.title,this.settings=t.settings,this.description=t.description,this.icon=t.icon,this.isCollapsed=t.collapsed??!1,this.isMain=t.main??!1,this.custom=t.custom??!1,this.hideCondition=t.hideCondition,this.onBlur=t.onBlur,this.parentNestingLevel=t.parentNestingLevel??0,this.nestingLevel=this.parentNestingLevel,this.includeGetJson=t.includeGetJson??!0,Object.assign(this,t.settings),this.initialValues=this.getValues(),this.originalDefaultValues=this.getDefaultValues(),this.propagateNestingLevel()}propagateNestingLevel(){const t=this.nestingLevel+1;w(this.settings,(e,i)=>{i instanceof g&&(i.parentNestingLevel=this.nestingLevel,i.nestingLevel=t,i.propagateNestingLevel())})}getNestingLevel(){return this.nestingLevel}setNestingLevel(t){this.nestingLevel=t,this.propagateNestingLevel(),this.elementRef&&this.updateNestingStyles()}updateNestingStyles(){this.elementRef&&(y(this.elementRef,this.nestingLevel),k(this.elementRef,this.nestingLevel))}static hide(){this.hiddenElements.forEach(t=>{t&&(t.style.display="none")})}static show(){this.hiddenElements.forEach(t=>{t&&(t.style.display="")})}setOnChange(t){this.onChange=t;const e=()=>{this.isHandlingChange||(this.isHandlingChange=!0,this.changeTimeout&&clearTimeout(this.changeTimeout),this.changeTimeout=setTimeout(()=>{const i=this.getValues(),s=this.calculateChanges(this.initialValues,i);Object.keys(s).length>0&&(this.lastChangeTime=Date.now(),this.initialValues=i,t(i),this.updateVisibility()),this.isHandlingChange=!1},50))};return this.changeHandlers.clear(),w(this.settings,(i,s)=>{var n;if(s instanceof g)s.setOnChange(o=>{const a=this.getValues();this.initialValues=a,t(a)}),this.changeHandlers.add(()=>t(this.getValues()));else if(s instanceof p){const o=()=>{e()};this.changeHandlers.add(o),s.setOnChange(o)}else{const o=()=>{e()};this.changeHandlers.add(o),(n=s.setOnChange)==null||n.call(s,o)}}),this}setOnBlur(t){return this.onBlur=t,this.pendingBlurHandler=t,this.handleBlur=e=>{(e==null?void 0:e.target)instanceof HTMLElement&&e.target.closest(".setting-group")!==this.elementRef||(this.blurTimeout&&clearTimeout(this.blurTimeout),this.blurTimeout=setTimeout(()=>{t()},100))},this.elementRef&&this.setupBlurHandlers(),this}setupBlurHandlers(){this.elementRef&&this.elementRef.removeEventListener("focusout",this.handleBlur),this.elementRef&&this.elementRef.addEventListener("focusout",this.handleBlur,!0),w(this.settings,(t,e)=>{e instanceof g&&e.setOnBlur(()=>{this.onBlur&&this.onBlur()})})}cleanup(){this.changeTimeout&&(clearTimeout(this.changeTimeout),this.changeTimeout=null),this.blurTimeout&&(clearTimeout(this.blurTimeout),this.blurTimeout=null),this.elementRef&&this.elementRef.removeEventListener("focusout",this.handleBlur),this.changeHandlers.clear()}clone(){const t={};w(this.settings,(s,n)=>{typeof n.clone=="function"?t[s]=n.clone():(console.warn(`Setting with key '${s}' does not have a clone method. Copying reference.`),t[s]=n)});const e={title:this.title,settings:t,description:this.description,icon:this.icon,collapsed:this.isCollapsed,main:this.isMain,custom:this.custom,hideCondition:this.hideCondition,parentNestingLevel:this.parentNestingLevel},i=V(e);return i.initialValues=this.getValues(),i}setValue(t){if(!t||typeof t!="object")return;Object.entries(t).forEach(([i,s])=>{const n=this.settings[i];n&&(n instanceof g||n instanceof p)&&typeof n.setValue=="function"&&n.setValue(s)}),setTimeout(()=>{this.forceChildUIRefresh()},0);const e=this.getValues();this.initialValues=e,this.onChange&&this.onChange(e)}forceChildUIRefresh(){Object.entries(this.settings).forEach(([t,e])=>{try{if(e instanceof g){const i=e.getValues();e.setValue(i)}else if(typeof e.setValue=="function"){const i=e.value;i!==void 0&&e.setValue(i)}}catch(i){console.warn(`Error refreshing UI for setting ${t}:`,i)}})}calculateChanges(t,e){const i={};return new Set([...Object.keys(t),...Object.keys(e)]).forEach(n=>{const o=t[n],a=e[n];JSON.stringify(o)!==JSON.stringify(a)&&(i[n]={from:o,to:a})}),i}hide(){this.elementRef&&(this.elementRef.style.display="none",this.isHidden=!0)}show(){this.elementRef&&(this.elementRef.style.display="",this.isHidden=!1)}getValues(t){if(t===void 0){const e={};for(const i in this.settings)if(this.settings.hasOwnProperty(i)){const s=this.settings[i];s instanceof g?e[i]=s.getValues():e[i]=s.value}return e}else{const e=this.settings[t];return e?e instanceof g?e.getValues():e.value:void 0}}getValuesForJson(t){if(t===void 0){if(this.includeGetJson===!1)return null;const e={};for(const i in this.settings)if(this.settings.hasOwnProperty(i)){const s=this.settings[i];s instanceof g?e[i]=s.getValuesForJson():s.includeGetJson===!1?e[i]=null:e[i]=s.value}return e}else{const e=this.settings[t];return e?e instanceof g?e.includeGetJson===!1?null:e.getValuesForJson():e.includeGetJson===!1?null:e.value:void 0}}getDefaultValues(t){if(t===void 0){const e={};for(const i in this.settings)if(this.settings.hasOwnProperty(i)){const s=this.settings[i];s instanceof g?e[i]=s.getDefaultValues():e[i]=s.default!==void 0?s.default:s.value}return e}else{const e=this.settings[t];return e?e instanceof g?e.getDefaultValues():e.default!==void 0?e.default:e.value:void 0}}getMobileValues(t){if(t===void 0){const e={};for(const i in this.settings)if(this.settings.hasOwnProperty(i)){const s=this.settings[i];if(s instanceof g)e[i]=s.getMobileValues();else if(typeof s.getMobileValue=="function"){const n=s.getMobileValue();e[i]=n!==void 0?n:s.value}else e[i]=s.value}return e}else{const e=this.settings[t];if(!e)return;if(e instanceof g)return e.getMobileValues();if(typeof e.getMobileValue=="function"){const i=e.getMobileValue();return i!==void 0?i:e.value}else return e.value}}setMobileValues(t){if(!(!t||typeof t!="object")&&(Object.entries(t).forEach(([e,i])=>{const s=this.settings[e];s&&(s instanceof g?typeof i=="object"&&i!==null&&s.setMobileValues(i):typeof s.setMobileValue=="function"&&s.setMobileValue(i))}),this.setValue(t),this.onChange)){const e=this.getValues();this.onChange(e)}}resetDefault(){const t=this.originalDefaultValues;if(this.setValue(t),this.onChange){const e=this.getValues();this.onChange(e)}}draw(){const t=document.createElement("div");t.className="setting-group",t.id=`setting-group-${this.id}`,g.hiddenElements.add(t),this.hideCondition&&this.hideCondition()&&(t.style.display="none"),this.isMain&&t.classList.add("main-group"),this.custom&&t.classList.add("custom_class"),y(t,this.nestingLevel);const e=document.createElement("div");e.className="setting-group-title",this.isCollapsed&&e.classList.add("collapsed-view"),e.setAttribute("role","button"),e.setAttribute("aria-expanded",(!this.isCollapsed).toString()),e.setAttribute("tabindex","0");const i=document.createElement("div");if(i.className="title-section",this.icon){const r=document.createElement("span");r.className="group-icon",r.innerHTML=this.icon,i.appendChild(r)}const s=document.createElement("h3");s.textContent=this.title,i.appendChild(s);const n=document.createElement("div");if(n.className="actions-section",this.description&&this.isCollapsed){const r=document.createElement("span");r.className="info-marker",r.innerHTML=`
2
2
  <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
3
3
  <path d="M8 5.33333V8M8 10.6667H8.00667M14 8C14 11.3137 11.3137 14 8 14C4.68629 14 2 11.3137 2 8C2 4.68629 4.68629 2 8 2C11.3137 2 14 4.68629 14 8Z"
4
4
  stroke="currentColor" stroke-width="1.33333" stroke-linecap="round" stroke-linejoin="round"/>
@@ -17,11 +17,11 @@
17
17
  <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"/>
18
18
  <path d="M9 17C13.4183 17 17 13.4183 17 9C17 4.58172 13.4183 1 9 1C4.58172 1 1 4.58172 1 9C1 13.4183 4.58172 17 9 17Z" stroke="#667085" stroke-width="0.5" stroke-linecap="round" stroke-linejoin="round" opacity="0.5"/>
19
19
  <path d="M9 1V17C4.58172 17 1 13.4183 1 9C1 4.58172 4.58172 1 9 1Z" fill="#667085" stroke="#667085" stroke-width="0.5" stroke-linecap="round" stroke-linejoin="round" opacity="0.5"/>
20
- </svg>`;class C extends p{constructor(t={}){super({...t,icon:t.icon||W,title:t.title||"Color & Opacity",default:t.default||"#000000FF"}),this.inputType="color",this.element=null,this.colorInputEl=null,this.textInputEl=null,this.opacityInputEl=null,this.colorPreviewEl=null,this.detectChange=t.detectChange,this.value&&(this.value=C.normalizeHexWithOpacity(this.value))}static normalizeHexWithOpacity(t){return t=t.replace("#",""),t.length===3&&(t=t.split("").map(e=>e+e).join("")),t.length===6&&(t=t+"FF"),t.length===8&&/^[0-9A-Fa-f]{8}$/.test(t)?`#${t.toUpperCase()}`:(console.warn(`Invalid hex value "${t}", using default "#000000FF"`),"#000000FF")}getRgbColor(){return this.value?this.value.substring(0,7):"#000000"}getOpacityPercent(){if(!this.value)return 100;const t=this.value.substring(7,9),e=parseInt(t,16)/255;return Math.round(e*100)}static combineColorOpacity(t,e){const i=t.replace("#","").substring(0,6),n=Math.round(e/100*255).toString(16).toUpperCase().padStart(2,"0");return`#${i}${n}`}setValue(t){t===void 0||t===""?this.value="#000000FF":this.value=C.normalizeHexWithOpacity(t),this.updateInputElements(),this.updateColorPreview(),this.onChange&&this.onChange(this.value),this.detectChange&&this.detectChange(this.value)}updateInputElements(){this.value&&(this.colorInputEl&&(this.colorInputEl.value=this.getRgbColor()),this.textInputEl&&(this.textInputEl.value=this.value),this.opacityInputEl&&(this.opacityInputEl.value=this.getOpacityPercent().toString()))}updateColorPreview(){if(!this.colorPreviewEl||!this.value)return;const t=this.getRgbColor(),e=this.getOpacityPercent()/100,i=t.replace("#",""),s=parseInt(i.substring(0,2),16),n=parseInt(i.substring(2,4),16),o=parseInt(i.substring(4,6),16);this.colorPreviewEl.style.backgroundColor=`rgba(${s}, ${n}, ${o}, ${e})`}handleColorChange(t){const e=this.getOpacityPercent(),i=C.combineColorOpacity(t,e);this.setValue(i)}handleTextInput(t){const e=/^#[0-9A-Fa-f]{8}$/.test(t.trim()),i=/^#[0-9A-Fa-f]{6}$/.test(t.trim());return e||i?(this.setValue(t),!0):!1}handleOpacityChange(t){const e=this.getRgbColor(),i=Math.max(0,Math.min(100,t)),s=C.combineColorOpacity(e,i);this.setValue(s)}draw(){const t=document.createElement("div");if(t.className="color-with-opacity-setting-wrapper "+(this.props.wrapperClassName||""),this.props.title||this.props.icon){const o=document.createElement("div");if(o.className="icon-container",this.props.icon){const a=document.createElement("span");a.className="input-icon",a.innerHTML=this.props.icon,o.appendChild(a)}if(this.props.title){const a=document.createElement("span");a.className="input-label",a.textContent=this.props.title,o.appendChild(a)}t.appendChild(o)}const e=document.createElement("div");e.className="color-with-opacity-input-wrapper",this.colorInputEl=document.createElement("input"),this.colorInputEl.type="color",this.colorInputEl.className="color-with-opacity-picker",this.colorPreviewEl=document.createElement("div"),this.colorPreviewEl.className="color-with-opacity-preview",this.textInputEl=document.createElement("input"),this.textInputEl.type="text",this.textInputEl.className="color-with-opacity-text-input",this.textInputEl.placeholder="#000000FF",this.updateInputElements(),this.updateColorPreview(),this.colorInputEl.addEventListener("input",o=>{const a=o.target;this.handleColorChange(a.value),this.textInputEl&&(this.textInputEl.value=this.value||"#000000FF"),this.updateColorPreview()}),this.textInputEl.addEventListener("input",o=>{const a=o.target;this.handleTextInput(a.value)?(this.colorInputEl&&(this.colorInputEl.value=this.getRgbColor()),this.updateColorPreview(),e.classList.remove("error")):a.value.trim()===""?e.classList.remove("error"):e.classList.add("error")}),this.textInputEl.addEventListener("blur",o=>{const a=o.target;a.value.trim()===""&&(a.value=this.value||"#000000FF",e.classList.remove("error"))}),this.colorPreviewEl.addEventListener("click",()=>{var o;(o=this.colorInputEl)==null||o.click()}),e.appendChild(this.colorInputEl),e.appendChild(this.colorPreviewEl),e.appendChild(this.textInputEl);const i=document.createElement("div");i.className="color-with-opacity-opacity-wrapper",this.opacityInputEl=document.createElement("input"),this.opacityInputEl.type="number",this.opacityInputEl.className="color-with-opacity-opacity-input",this.opacityInputEl.value=this.getOpacityPercent().toString(),this.opacityInputEl.min="0",this.opacityInputEl.max="100",this.opacityInputEl.step="1",this.opacityInputEl.placeholder="100";const s=document.createElement("span");s.className="color-with-opacity-opacity-suffix",s.textContent="%",this.opacityInputEl.addEventListener("input",o=>{const a=o.target,l=parseFloat(a.value);isNaN(l)||(this.handleOpacityChange(l),this.textInputEl&&(this.textInputEl.value=this.value||"#000000FF"),this.updateColorPreview())}),this.opacityInputEl.addEventListener("blur",o=>{const a=o.target;let l=parseFloat(a.value);isNaN(l)&&(l=this.getOpacityPercent()),l=Math.max(0,Math.min(100,l)),a.value=l.toString(),this.handleOpacityChange(l),this.textInputEl&&(this.textInputEl.value=this.value||"#000000FF"),this.updateColorPreview()}),i.appendChild(this.opacityInputEl),i.appendChild(s);const n=document.createElement("div");return n.className="color-with-opacity-controls-wrapper",n.appendChild(e),n.appendChild(i),t.appendChild(n),this.element=t,this.updateInputElements(),this.updateColorPreview(),t}getElement(){return this.element}getValue(){return this.value}getRgbaValue(){if(!this.value)return"rgba(0, 0, 0, 1)";const t=this.getRgbColor(),e=this.getOpacityPercent()/100,i=t.replace("#",""),s=parseInt(i.substring(0,2),16),n=parseInt(i.substring(2,4),16),o=parseInt(i.substring(4,6),16);return`rgba(${s}, ${n}, ${o}, ${e})`}getColorAndOpacity(){return{color:this.getRgbColor(),opacity:this.getOpacityPercent()}}}class P extends p{constructor(t={}){super(t),this.inputType="text",t.onChange&&this.setOnChange(t.onChange)}setValue(t){this.value=t,this.textareaEl&&(this.textareaEl.value=t),this.onChange&&this.onChange(t),this.props.detectChange&&this.props.detectChange(t)}draw(){const t=document.createElement("div");if(t.className="html-setting-wrapper "+(this.props.wrapperClassName||""),this.props.title||this.props.icon){const n=document.createElement("div");if(n.className="icon-container",this.props.icon){const o=this.createIcon(this.props.icon);n.appendChild(o)}if(this.props.title){const o=this.createLabel(this.props.title);n.appendChild(o)}t.appendChild(n)}const e=document.createElement("textarea");this.textareaEl=e,e.value=this.value||"",e.placeholder=this.props.placeholder||"Paste your HTML here...",e.className="html-setting-textarea "+(this.props.textareaClassName||""),e.rows=this.props.rows||6,this.props.maxLength!==void 0&&(e.maxLength=this.props.maxLength),this.props.className&&e.classList.add(this.props.className);const i=n=>{const a=n.target.value;this.value=a,this.onChange&&this.onChange(this.value),this.props.detectChange&&this.props.detectChange(this.value)},s=n=>{this.onBlur&&this.value!==void 0&&this.onBlur(this.value)};return e.addEventListener("input",i),e.addEventListener("change",i),e.addEventListener("blur",s),t.appendChild(e),t}}class v extends p{constructor(t){super(t),this.inputType="number",this.inputElement=null,this.mobileValue=t.mobile,this.validateProps(),this.value=this.validateValue(this.value)}draw(){const t=document.createElement("div");if(t.className="number-setting-wrapper "+(this.props.wrapperClassName||""),this.props.title||this.props.icon){const s=document.createElement("div");if(s.className="icon-container",this.props.icon){const n=document.createElement("span");n.className="input-icon",n.innerHTML=this.props.icon,s.appendChild(n)}if(this.props.title){const n=document.createElement("span");n.className="input-label",n.textContent=this.props.title,s.appendChild(n)}t.appendChild(s)}const e=document.createElement("div");e.className="number-setting-input-container";const i=document.createElement("input");if(i.type="number",i.className="number-setting-input "+(this.props.inputClassName||""),i.value=String(this.value??""),i.placeholder=this.props.placeholder||"",this.props.minValue!==void 0&&(i.min=String(this.props.minValue)),this.props.maxValue!==void 0&&(i.max=String(this.props.maxValue)),this.props.step!==void 0&&(i.step=String(this.props.step)),i.addEventListener("input",()=>{const s=this.props.minValue??Number.MIN_SAFE_INTEGER,n=this.props.maxValue??Number.MAX_SAFE_INTEGER;let o=Number(i.value);o<s&&(o=s),o>n&&(o=n),String(o)!==i.value&&(i.value=String(o)),this.setValue(o)}),i.addEventListener("blur",()=>{var n,o;const s=this.validateValue(Number(i.value));s!==Number(i.value)&&(i.value=String(s),this.setValue(s)),(o=(n=this.props).onBlur)==null||o.call(n)}),e.appendChild(i),this.props.suffix&&this.props.suffix!=="none"){const s=document.createElement("span");s.className="suffix-label",s.textContent=this.props.suffix,e.appendChild(s)}return t.appendChild(e),this.inputElement=i,t}setValue(t){const e=this.validateValue(t);super.setValue(e),this.inputElement&&this.inputElement.value!==String(e)&&(this.inputElement.value=String(e??""))}validateValue(t){(t==null||isNaN(t))&&(t=this.props.default??0);const e=this.props.minValue??Number.MIN_SAFE_INTEGER,i=this.props.maxValue??Number.MAX_SAFE_INTEGER;let s=Number(t);return s<e&&(s=e),s>i&&(s=i),s}getMobileValue(){return this.mobileValue}setMobileValue(t){this.mobileValue=t,t!==void 0&&this.setValue(t)}validateProps(){this.props.minValue!==void 0&&(this.props.default??0)<this.props.minValue&&console.warn(`Default value ${this.props.default} is less than minValue ${this.props.minValue}`),this.props.maxValue!==void 0&&(this.props.default??0)>this.props.maxValue&&console.warn(`Default value ${this.props.default} is greater than maxValue ${this.props.maxValue}`)}}const j=`
20
+ </svg>`;class C extends p{constructor(t={}){super({...t,icon:t.icon||W,title:t.title||"Color & Opacity",default:t.default||"#000000FF"}),this.inputType="color",this.element=null,this.colorInputEl=null,this.textInputEl=null,this.opacityInputEl=null,this.colorPreviewEl=null,this.detectChange=t.detectChange,this.value&&(this.value=C.normalizeHexWithOpacity(this.value))}static normalizeHexWithOpacity(t){return t=t.replace("#",""),t.length===3&&(t=t.split("").map(e=>e+e).join("")),t.length===6&&(t=t+"FF"),t.length===8&&/^[0-9A-Fa-f]{8}$/.test(t)?`#${t.toUpperCase()}`:(console.warn(`Invalid hex value "${t}", using default "#000000FF"`),"#000000FF")}getRgbColor(){return this.value?this.value.substring(0,7):"#000000"}getOpacityPercent(){if(!this.value)return 100;const t=this.value.substring(7,9),e=parseInt(t,16)/255;return Math.round(e*100)}static combineColorOpacity(t,e){const i=t.replace("#","").substring(0,6),n=Math.round(e/100*255).toString(16).toUpperCase().padStart(2,"0");return`#${i}${n}`}setValue(t){t===void 0||t===""?this.value="#000000FF":this.value=C.normalizeHexWithOpacity(t),this.updateInputElements(),this.updateColorPreview(),this.onChange&&this.onChange(this.value),this.detectChange&&this.detectChange(this.value)}updateInputElements(){this.value&&(this.colorInputEl&&(this.colorInputEl.value=this.getRgbColor()),this.textInputEl&&(this.textInputEl.value=this.value),this.opacityInputEl&&(this.opacityInputEl.value=this.getOpacityPercent().toString()))}updateColorPreview(){if(!this.colorPreviewEl||!this.value)return;const t=this.getRgbColor(),e=this.getOpacityPercent()/100,i=t.replace("#",""),s=parseInt(i.substring(0,2),16),n=parseInt(i.substring(2,4),16),o=parseInt(i.substring(4,6),16);this.colorPreviewEl.style.backgroundColor=`rgba(${s}, ${n}, ${o}, ${e})`}handleColorChange(t){const e=this.getOpacityPercent(),i=C.combineColorOpacity(t,e);this.setValue(i)}handleTextInput(t){const e=/^#[0-9A-Fa-f]{8}$/.test(t.trim()),i=/^#[0-9A-Fa-f]{6}$/.test(t.trim());return e||i?(this.setValue(t),!0):!1}handleOpacityChange(t){const e=this.getRgbColor(),i=Math.max(0,Math.min(100,t)),s=C.combineColorOpacity(e,i);this.setValue(s)}draw(){const t=document.createElement("div");if(t.className="color-with-opacity-setting-wrapper "+(this.props.wrapperClassName||""),this.props.title||this.props.icon){const o=document.createElement("div");if(o.className="icon-container",this.props.icon){const a=document.createElement("span");a.className="input-icon",a.innerHTML=this.props.icon,o.appendChild(a)}if(this.props.title){const a=document.createElement("span");a.className="input-label",a.textContent=this.props.title,o.appendChild(a)}t.appendChild(o)}const e=document.createElement("div");e.className="color-with-opacity-input-wrapper",this.colorInputEl=document.createElement("input"),this.colorInputEl.type="color",this.colorInputEl.className="color-with-opacity-picker",this.colorPreviewEl=document.createElement("div"),this.colorPreviewEl.className="color-with-opacity-preview",this.textInputEl=document.createElement("input"),this.textInputEl.type="text",this.textInputEl.className="color-with-opacity-text-input",this.textInputEl.placeholder="#000000FF",this.updateInputElements(),this.updateColorPreview(),this.colorInputEl.addEventListener("input",o=>{const a=o.target;this.handleColorChange(a.value),this.textInputEl&&(this.textInputEl.value=this.value||"#000000FF"),this.updateColorPreview()}),this.textInputEl.addEventListener("input",o=>{const a=o.target;this.handleTextInput(a.value)?(this.colorInputEl&&(this.colorInputEl.value=this.getRgbColor()),this.updateColorPreview(),e.classList.remove("error")):a.value.trim()===""?e.classList.remove("error"):e.classList.add("error")}),this.textInputEl.addEventListener("blur",o=>{const a=o.target;a.value.trim()===""&&(a.value=this.value||"#000000FF",e.classList.remove("error"))}),this.colorPreviewEl.addEventListener("click",()=>{var o;(o=this.colorInputEl)==null||o.click()}),e.appendChild(this.colorInputEl),e.appendChild(this.colorPreviewEl),e.appendChild(this.textInputEl);const i=document.createElement("div");i.className="color-with-opacity-opacity-wrapper",this.opacityInputEl=document.createElement("input"),this.opacityInputEl.type="number",this.opacityInputEl.className="color-with-opacity-opacity-input",this.opacityInputEl.value=this.getOpacityPercent().toString(),this.opacityInputEl.min="0",this.opacityInputEl.max="100",this.opacityInputEl.step="1",this.opacityInputEl.placeholder="100";const s=document.createElement("span");s.className="color-with-opacity-opacity-suffix",s.textContent="%",this.opacityInputEl.addEventListener("input",o=>{const a=o.target,l=parseFloat(a.value);isNaN(l)||(this.handleOpacityChange(l),this.textInputEl&&(this.textInputEl.value=this.value||"#000000FF"),this.updateColorPreview())}),this.opacityInputEl.addEventListener("blur",o=>{const a=o.target;let l=parseFloat(a.value);isNaN(l)&&(l=this.getOpacityPercent()),l=Math.max(0,Math.min(100,l)),a.value=l.toString(),this.handleOpacityChange(l),this.textInputEl&&(this.textInputEl.value=this.value||"#000000FF"),this.updateColorPreview()}),i.appendChild(this.opacityInputEl),i.appendChild(s);const n=document.createElement("div");return n.className="color-with-opacity-controls-wrapper",n.appendChild(e),n.appendChild(i),t.appendChild(n),this.element=t,this.updateInputElements(),this.updateColorPreview(),t}getElement(){return this.element}getValue(){return this.value}getRgbaValue(){if(!this.value)return"rgba(0, 0, 0, 1)";const t=this.getRgbColor(),e=this.getOpacityPercent()/100,i=t.replace("#",""),s=parseInt(i.substring(0,2),16),n=parseInt(i.substring(2,4),16),o=parseInt(i.substring(4,6),16);return`rgba(${s}, ${n}, ${o}, ${e})`}getColorAndOpacity(){return{color:this.getRgbColor(),opacity:this.getOpacityPercent()}}}class j extends p{constructor(t={}){super(t),this.inputType="text",t.onChange&&this.setOnChange(t.onChange)}setValue(t){this.value=t,this.textareaEl&&(this.textareaEl.value=t),this.onChange&&this.onChange(t),this.props.detectChange&&this.props.detectChange(t)}draw(){const t=document.createElement("div");if(t.className="html-setting-wrapper "+(this.props.wrapperClassName||""),this.props.title||this.props.icon){const n=document.createElement("div");if(n.className="icon-container",this.props.icon){const o=this.createIcon(this.props.icon);n.appendChild(o)}if(this.props.title){const o=this.createLabel(this.props.title);n.appendChild(o)}t.appendChild(n)}const e=document.createElement("textarea");this.textareaEl=e,e.value=this.value||"",e.placeholder=this.props.placeholder||"Paste your HTML here...",e.className="html-setting-textarea "+(this.props.textareaClassName||""),e.rows=this.props.rows||6,this.props.maxLength!==void 0&&(e.maxLength=this.props.maxLength),this.props.className&&e.classList.add(this.props.className);const i=n=>{const a=n.target.value;this.value=a,this.onChange&&this.onChange(this.value),this.props.detectChange&&this.props.detectChange(this.value)},s=n=>{this.onBlur&&this.value!==void 0&&this.onBlur(this.value)};return e.addEventListener("input",i),e.addEventListener("change",i),e.addEventListener("blur",s),t.appendChild(e),t}}class v extends p{constructor(t){super(t),this.inputType="number",this.inputElement=null,this.mobileValue=t.mobile,this.validateProps(),this.value=this.validateValue(this.value)}draw(){const t=document.createElement("div");if(t.className="number-setting-wrapper "+(this.props.wrapperClassName||""),this.props.title||this.props.icon){const s=document.createElement("div");if(s.className="icon-container",this.props.icon){const n=document.createElement("span");n.className="input-icon",n.innerHTML=this.props.icon,s.appendChild(n)}if(this.props.title){const n=document.createElement("span");n.className="input-label",n.textContent=this.props.title,s.appendChild(n)}t.appendChild(s)}const e=document.createElement("div");e.className="number-setting-input-container";const i=document.createElement("input");if(i.type="number",i.className="number-setting-input "+(this.props.inputClassName||""),i.value=String(this.value??""),i.placeholder=this.props.placeholder||"",this.props.minValue!==void 0&&(i.min=String(this.props.minValue)),this.props.maxValue!==void 0&&(i.max=String(this.props.maxValue)),this.props.step!==void 0&&(i.step=String(this.props.step)),i.addEventListener("input",()=>{const s=this.props.minValue??Number.MIN_SAFE_INTEGER,n=this.props.maxValue??Number.MAX_SAFE_INTEGER;let o=Number(i.value);o<s&&(o=s),o>n&&(o=n),String(o)!==i.value&&(i.value=String(o)),this.setValue(o)}),i.addEventListener("blur",()=>{var n,o;const s=this.validateValue(Number(i.value));s!==Number(i.value)&&(i.value=String(s),this.setValue(s)),(o=(n=this.props).onBlur)==null||o.call(n)}),e.appendChild(i),this.props.suffix&&this.props.suffix!=="none"){const s=document.createElement("span");s.className="suffix-label",s.textContent=this.props.suffix,e.appendChild(s)}return t.appendChild(e),this.inputElement=i,t}setValue(t){const e=this.validateValue(t);super.setValue(e),this.inputElement&&this.inputElement.value!==String(e)&&(this.inputElement.value=String(e??""))}validateValue(t){(t==null||isNaN(t))&&(t=this.props.default??0);const e=this.props.minValue??Number.MIN_SAFE_INTEGER,i=this.props.maxValue??Number.MAX_SAFE_INTEGER;let s=Number(t);return s<e&&(s=e),s>i&&(s=i),s}getMobileValue(){return this.mobileValue}setMobileValue(t){this.mobileValue=t,t!==void 0&&this.setValue(t)}validateProps(){this.props.minValue!==void 0&&(this.props.default??0)<this.props.minValue&&console.warn(`Default value ${this.props.default} is less than minValue ${this.props.minValue}`),this.props.maxValue!==void 0&&(this.props.default??0)>this.props.maxValue&&console.warn(`Default value ${this.props.default} is greater than maxValue ${this.props.maxValue}`)}}const P=`
21
21
  <svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
22
22
  <path d="M9 17C13.4183 17 17 13.4183 17 9C17 4.58172 13.4183 1 9 1C4.58172 1 1 4.58172 1 9C1 13.4183 4.58172 17 9 17Z" stroke="#667085" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
23
23
  <path d="M9 1V17C4.58172 17 1 13.4183 1 9C1 4.58172 4.58172 1 9 1Z" fill="#667085" stroke="#667085" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
24
- </svg>`;class I extends v{constructor(t={}){const e={title:"Opacity",suffix:"%",minValue:0,maxValue:100,step:1,default:t.default??100,icon:j,...t};super(e),this.inputType="number",this.mobileValue=t.mobile}getMobileValue(){return this.mobileValue}setMobileValue(t){this.mobileValue=t,t!==void 0&&this.setValue(t)}}const D=`
24
+ </svg>`;class I extends v{constructor(t={}){const e={title:"Opacity",suffix:"%",minValue:0,maxValue:100,step:1,default:t.default??100,icon:P,...t};super(e),this.inputType="number",this.mobileValue=t.mobile}getMobileValue(){return this.mobileValue}setMobileValue(t){this.mobileValue=t,t!==void 0&&this.setValue(t)}}const D=`
25
25
  <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">
26
26
  <polyline points="6 9 12 15 18 9"></polyline>
27
27
  </svg>
@@ -181,4 +181,4 @@
181
181
  opacity: ${e/100};
182
182
  `:`
183
183
  background-color: ${i};
184
- `}}function Vt(c){return c instanceof f}function Nt(c){return c instanceof p}exports.AlignSetting=O;exports.AnimationSetting=gt;exports.BackgroundSettingSet=St;exports.BorderSettingSet=vt;exports.ButtonSetting=U;exports.ColorSetting=m;exports.ColorWithOpacitySetting=C;exports.DimensionSetting=_;exports.GapSetting=ot;exports.HeaderTypographySettingSet=bt;exports.HeightSetting=Q;exports.HtmlSetting=P;exports.MarginBottomSetting=rt;exports.MarginSettingGroup=Lt;exports.MarginTopSetting=ct;exports.MultiLanguageSetting=pt;exports.NumberSetting=v;exports.OpacitySetting=I;exports.SelectApiSettings=st;exports.SelectSetting=L;exports.Setting=p;exports.SettingGroup=f;exports.StringSetting=N;exports.TabSettingGroup=S;exports.TabsSettingGroup=S;exports.Toggle=nt;exports.UploadSetting=H;exports.WidthSetting=tt;exports.asSettingGroupWithSettings=G;exports.createSettingGroup=V;exports.isSetting=Nt;exports.isSettingGroup=Vt;exports.iterateSettings=w;
184
+ `}}function Vt(c){return c instanceof f}function Nt(c){return c instanceof p}exports.AlignSetting=O;exports.AnimationSetting=gt;exports.BackgroundSettingSet=St;exports.BorderSettingSet=vt;exports.ButtonSetting=U;exports.ColorSetting=m;exports.ColorWithOpacitySetting=C;exports.DimensionSetting=_;exports.GapSetting=ot;exports.HeaderTypographySettingSet=bt;exports.HeightSetting=Q;exports.HtmlSetting=j;exports.MarginBottomSetting=rt;exports.MarginSettingGroup=Lt;exports.MarginTopSetting=ct;exports.MultiLanguageSetting=pt;exports.NumberSetting=v;exports.OpacitySetting=I;exports.SelectApiSettings=st;exports.SelectSetting=L;exports.Setting=p;exports.SettingGroup=f;exports.StringSetting=N;exports.TabSettingGroup=S;exports.TabsSettingGroup=S;exports.Toggle=nt;exports.UploadSetting=H;exports.WidthSetting=tt;exports.asSettingGroupWithSettings=G;exports.createSettingGroup=V;exports.isSetting=Nt;exports.isSettingGroup=Vt;exports.iterateSettings=w;
@@ -239,7 +239,7 @@ function w(c, t) {
239
239
  const g = class g {
240
240
  constructor(t) {
241
241
  this.elementRef = null, this.isHidden = !1, this.custom = !1, this.initialValues = {}, this.changeTimeout = null, this.isHandlingChange = !1, this.changeHandlers = /* @__PURE__ */ new Set(), this.blurTimeout = null, this.lastChangeTime = 0, this.handleBlur = () => {
242
- }, this.pendingBlurHandler = null, this.originalDefaultValues = {}, this.nestingLevel = 0, this.parentNestingLevel = 0, this.id = t.id || M(), this.title = t.title, this.settings = t.settings, this.description = t.description, this.icon = t.icon, this.isCollapsed = t.collapsed ?? !1, this.isMain = t.main ?? !1, this.custom = t.custom ?? !1, this.hideCondition = t.hideCondition, this.onBlur = t.onBlur, this.parentNestingLevel = t.parentNestingLevel ?? 0, this.nestingLevel = this.parentNestingLevel, Object.assign(this, t.settings), this.initialValues = this.getValues(), this.originalDefaultValues = this.getDefaultValues(), this.propagateNestingLevel();
242
+ }, this.pendingBlurHandler = null, this.originalDefaultValues = {}, this.nestingLevel = 0, this.parentNestingLevel = 0, this.id = t.id || M(), this.title = t.title, this.settings = t.settings, this.description = t.description, this.icon = t.icon, this.isCollapsed = t.collapsed ?? !1, this.isMain = t.main ?? !1, this.custom = t.custom ?? !1, this.hideCondition = t.hideCondition, this.onBlur = t.onBlur, this.parentNestingLevel = t.parentNestingLevel ?? 0, this.nestingLevel = this.parentNestingLevel, this.includeGetJson = t.includeGetJson ?? !0, Object.assign(this, t.settings), this.initialValues = this.getValues(), this.originalDefaultValues = this.getDefaultValues(), this.propagateNestingLevel();
243
243
  }
244
244
  propagateNestingLevel() {
245
245
  const t = this.nestingLevel + 1;
@@ -408,6 +408,8 @@ const g = class g {
408
408
  }
409
409
  getValuesForJson(t) {
410
410
  if (t === void 0) {
411
+ if (this.includeGetJson === !1)
412
+ return null;
411
413
  const e = {};
412
414
  for (const i in this.settings)
413
415
  if (this.settings.hasOwnProperty(i)) {
@@ -417,7 +419,7 @@ const g = class g {
417
419
  return e;
418
420
  } else {
419
421
  const e = this.settings[t];
420
- return e ? e instanceof g ? e.getValuesForJson() : e.includeGetJson === !1 ? null : e.value : void 0;
422
+ return e ? e instanceof g ? e.includeGetJson === !1 ? null : e.getValuesForJson() : e.includeGetJson === !1 ? null : e.value : void 0;
421
423
  }
422
424
  }
423
425
  getDefaultValues(t) {
@@ -1227,14 +1229,14 @@ class gt extends p {
1227
1229
  suffix: "px",
1228
1230
  minValue: this.minWidth,
1229
1231
  maxValue: this.maxWidth,
1230
- icon: P
1232
+ icon: W
1231
1233
  }), this.heightSetting = new v({
1232
1234
  title: "Height",
1233
1235
  default: this.value.height,
1234
1236
  suffix: "px",
1235
1237
  minValue: this.minHeight,
1236
1238
  maxValue: this.maxHeight,
1237
- icon: W
1239
+ icon: j
1238
1240
  }), this.widthSetting.setOnChange(this.handleWidthChange.bind(this)), this.heightSetting.setOnChange(this.handleHeightChange.bind(this));
1239
1241
  }
1240
1242
  handleWidthChange(t) {
@@ -1328,15 +1330,15 @@ class gt extends p {
1328
1330
  }
1329
1331
  }
1330
1332
  }
1331
- const P = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
1333
+ const W = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
1332
1334
  <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="currentColor" stroke-linecap="round" stroke-linejoin="round"/>
1333
- </svg>`, W = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
1335
+ </svg>`, j = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
1334
1336
  <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="currentColor" stroke-linecap="round" stroke-linejoin="round"/>
1335
1337
  </svg>`, b = `
1336
1338
  <svg xmlns="http://www.w3.org/2000/svg" width="15" height="16" viewBox="0 0 15 16" fill="none">
1337
1339
  <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"/>
1338
1340
  </svg>
1339
- `, j = `
1341
+ `, P = `
1340
1342
  <svg width="91" height="71" viewBox="0 0 91 71" fill="none" xmlns="http://www.w3.org/2000/svg">
1341
1343
  <rect width="91" height="71" rx="4" fill="#F2F4F7"/>
1342
1344
  <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"/>
@@ -1459,7 +1461,7 @@ class U extends p {
1459
1461
  const s = this.value && this.value !== "";
1460
1462
  s || i.classList.add("no-image");
1461
1463
  const n = document.createElement("div");
1462
- if (n.className = "preview-placeholder", n.innerHTML = j, this.previewWrapper = document.createElement("div"), this.previewWrapper.className = "preview-wrapper", this.loadingSpinner = document.createElement("div"), this.loadingSpinner.className = "loading-spinner", this.loadingSpinner.innerHTML = _, this.loadingSpinner.style.display = "none", this.previewWrapper.appendChild(this.loadingSpinner), this.previewEl = document.createElement("img"), this.previewEl.className = "upload-preview", this.props.delete) {
1464
+ if (n.className = "preview-placeholder", n.innerHTML = P, this.previewWrapper = document.createElement("div"), this.previewWrapper.className = "preview-wrapper", this.loadingSpinner = document.createElement("div"), this.loadingSpinner.className = "loading-spinner", this.loadingSpinner.innerHTML = _, this.loadingSpinner.style.display = "none", this.previewWrapper.appendChild(this.loadingSpinner), this.previewEl = document.createElement("img"), this.previewEl.className = "upload-preview", this.props.delete) {
1463
1465
  const a = document.createElement("button");
1464
1466
  a.className = "delete-button", a.type = "button", a.title = "Delete image", a.innerHTML = D, this.previewWrapper.appendChild(a), a.onclick = (l) => {
1465
1467
  var h;
package/dist/index.d.ts CHANGED
@@ -583,6 +583,7 @@ export declare class SettingGroup<T extends Record<string, Setting<any, any> | S
583
583
  onBlur?: () => void;
584
584
  private isCollapsed;
585
585
  private isMain;
586
+ private includeGetJson;
586
587
  private elementRef;
587
588
  private hideCondition?;
588
589
  private static hiddenElements;
@@ -646,6 +647,7 @@ export declare type SettingGroupProps<T> = {
646
647
  onBlur?: () => void;
647
648
  custom?: boolean;
648
649
  parentNestingLevel?: number;
650
+ includeGetJson?: boolean;
649
651
  };
650
652
 
651
653
  export declare type SettingGroupWithSettings<T extends Record<string, Setting<any, any> | SettingGroup<any>>> = SettingGroup<T> & T;
@@ -694,6 +696,7 @@ export declare type TabGroupProps<T> = {
694
696
  onBlur?: () => void;
695
697
  custom?: boolean;
696
698
  parentNestingLevel?: number;
699
+ includeGetJson?: boolean;
697
700
  };
698
701
 
699
702
  declare class TabSettingGroup<T extends TabSettingsGroupGenericType> extends SettingGroup<T> {
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.216",
4
+ "version": "0.0.217",
5
5
  "type": "module",
6
6
  "main": "dist/builder-settings-types.cjs.js",
7
7
  "module": "dist/builder-settings-types.es.js",