builder-settings-types 0.0.266 → 0.0.267

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.
@@ -21,6 +21,7 @@ export type SettingGroupProps<TSettings extends SettingsMap> = {
21
21
  addItem?: AddItemConfig;
22
22
  deleteItem?: DeleteItemConfig;
23
23
  dataProps?: string;
24
+ hide?: boolean;
24
25
  };
25
26
  export declare function iterateSettings<TSettings extends SettingsMap>(settings: TSettings, callback: SettingIteratorCallback<TSettings>): void;
26
27
  export type SettingGroupWithSettings<TSettings extends SettingsMap> = SettingGroup<TSettings> & TSettings;
@@ -52,6 +53,7 @@ export declare class SettingGroup<TSettings extends SettingsMap> implements IDra
52
53
  private deleteItemCfg?;
53
54
  private dataProps?;
54
55
  private dataPropsPath;
56
+ private hide;
55
57
  constructor(groupProps: SettingGroupProps<TSettings>);
56
58
  private propagateNestingLevel;
57
59
  getNestingLevel(): number;
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const ut="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let lt=(p=21)=>{let t="",e=crypto.getRandomValues(new Uint8Array(p|=0));for(;p--;)t+=ut[e[p]&63];return t};function gt(p){let t=0,e=p.parentElement;for(;e;)e.classList.contains("setting-group")&&e!==p&&t++,e=e.parentElement;return t}function Z(p,t){const e=Math.min(Math.max(t,0),5);p.setAttribute("data-nesting-level",e.toString()),e>0?p.style.setProperty("--visual-indent",`${e*2}px`):(p.style.removeProperty("--visual-indent"),p.style.marginLeft="")}function et(p,t=0){p.querySelectorAll(":scope > .setting-group-content > .setting-group").forEach(i=>{const s=i,n=t+1;Z(s,n),et(s,n)})}const mt={maxLevel:5,spacingMultiplier:1,visualIndentMultiplier:2,enableAutoDetection:!0};class ft{constructor(t={}){this.observedElements=new Set,this.config={...mt,...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=gt(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 ot=new ft;function X(p){if(p===null||typeof p!="object")return p;if(p instanceof Date)return new Date(p.getTime());if(p instanceof Array)return p.map(t=>X(t));if(typeof p=="object"){const t={};for(const e in p)Object.prototype.hasOwnProperty.call(p,e)&&(t[e]=X(p[e]));return t}return p}function vt(p){switch(p){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 S{constructor(t={}){this.props=t,this.dataPropsPath="",this.id=t.id||lt(),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){globalThis.DefaultUploadUrl=t,S.DefaultUploadUrl=t}static SetDefaultLanguage(t){globalThis.DefaultLanguage=t,S.DefaultLanguage=t}destroy(){throw new Error("Method not implemented.")}setOnChange(t){return this.onChange=t,this}setOnBlur(t){return this.onBlur=t,this}setDataPropsPath(t){this.dataPropsPath=t}getDataPropsPath(){return this.dataPropsPath}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=X(this.props),i=new t(e);return i.value=X(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||vt(t.inputType)),s.type=t.inputType,s.placeholder=t.placeholder||"",s.className=t.inputClassName||"",this.dataPropsPath&&s.setAttribute("data-test-id",this.dataPropsPath);const n=a=>{const l=a.target;let r=l.value;switch(t.inputType){case"number":r=Number(l.value);break;case"color":r=l.value;break;case"date":r=l.value;break;case"select":r=l.value;break;case"text":r=l.value;break;case"button":r=l.value;break;default:r=l.value}this.value=r,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 j(p){return p instanceof S}function N(p){return p instanceof W}function it(p){return j(p)||N(p)}function q(p,t){for(const e in p)if(Object.prototype.hasOwnProperty.call(p,e)){const i=p[e];t(e,i)}}const K=class K{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.dataPropsPath="",this.id=t.id||lt(),this.title=t.title,this.settings=t.settings,this.isCollapsed=t.collapsed??!1,this.isMain=t.main??!1,this.custom=t.custom??!1,this.nestingLevel=0,this.includeGetJson=t.includeGetJson??!0,this.addItemCfg=t.addItem,this.deleteItemCfg=t.deleteItem,this.dataProps=t.dataProps,this.dataPropsPath=t.dataProps||"",Object.assign(this,t.settings),this.initialValues=this.getValues(),this.originalDefaultValues=this.getDefaultValues(),this.propagateNestingLevel(),this.propagateDataPropsPath()}propagateNestingLevel(){const t=this.nestingLevel+1;q(this.settings,(e,i)=>{N(i)&&(i.nestingLevel=t,i.propagateNestingLevel())})}getNestingLevel(){return this.nestingLevel}setNestingLevel(t){this.nestingLevel=t,this.propagateNestingLevel(),this.elementRef&&this.updateNestingStyles()}getDataPropsPath(){return this.dataPropsPath}setDataPropsPath(t){this.dataPropsPath=t,this.propagateDataPropsPath()}propagateDataPropsPath(){q(this.settings,(t,e)=>{const i=String(t),s=this.dataPropsPath?`${this.dataPropsPath}_${i}`:i;(N(e)||j(e)&&typeof e.setDataPropsPath=="function")&&e.setDataPropsPath(s)})}updateNestingStyles(){this.elementRef&&(Z(this.elementRef,this.nestingLevel),et(this.elementRef,this.nestingLevel))}forceChildUIRefresh(){Object.entries(this.settings).forEach(([t,e])=>{try{if(N(e)){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)}})}removeSetting(t){var s;const e=this.settings[t];if(!e)return;if(delete this.settings[t],this.elementRef){const n=this.elementRef.querySelector(".setting-group-content");if(n){const o=Array.from(n.querySelectorAll(".setting-group, .setting"));for(const a of o){const l=a.id;if(l&&"id"in e&&typeof e.id=="string"&&l.includes(e.id)){a.remove();break}}}}typeof e.cleanup=="function"&&e.cleanup(),this.updateNestingStyles();const i=this.getValues();this.initialValues=i,(s=this.onChange)==null||s.call(this,i)}updateVisibility(){this.elementRef}clone(){const t={};q(this.settings,(s,n)=>{const o=String(s);typeof n.clone=="function"?t[o]=n.clone():(console.warn(`Setting with key '${o}' does not have a clone method. Copying reference.`),t[o]=n)});const e={title:this.title,settings:t,collapsed:this.isCollapsed,main:this.isMain,custom:this.custom,includeGetJson:this.includeGetJson,addItem:this.addItemCfg,deleteItem:this.deleteItemCfg,dataProps:this.dataProps},i=rt(e);return i.initialValues=this.getValues(),i}resetDefault(){const t=this.originalDefaultValues;this.setValue(t),this.onChange&&this.onChange(this.getValues())}setMobileValues(t){!t||typeof t!="object"||(Object.entries(t).forEach(([e,i])=>{const s=this.settings[e];s&&(N(s)||j(s))&&typeof s.setMobileValue=="function"&&s.setMobileValue(i)}),this.setValue(t),this.onChange&&this.onChange(this.getValues()))}getMobileValues(t){if(t===void 0){const e={};for(const i in this.settings)if(Object.prototype.hasOwnProperty.call(this.settings,i)){const s=this.settings[i];if(N(s))e[i]=s.getMobileValues();else{const n=s;e[i]=n.mobileValue!==void 0?n.mobileValue:n.value}}return e}else{const e=this.settings[t];if(!e)return;if(N(e))return e.getMobileValues();const i=e;return i.mobileValue!==void 0?i.mobileValue:i.value}}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(),q(this.settings,(i,s)=>{var n;if(N(s))s.setOnChange(()=>{const o=this.getValues();this.initialValues=o,t(o)}),this.changeHandlers.add(()=>t(this.getValues()));else if(j(s)){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}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()}setValue(t){if(!t||typeof t!="object")return;Object.entries(t).forEach(([i,s])=>{let n=this.settings[i];if(!n&&this.addItemCfg&&i.startsWith(this.addItemCfg.keyPrefix)){const o=i.slice(this.addItemCfg.keyPrefix.length),a=Number(o);if(Number.isFinite(a)){const l=this.addItemCfg.createItem(a);it(l)&&(this.addSetting(i,l),n=l)}}n&&(N(n)||j(n))&&typeof n.setValue=="function"&&n.setValue(s)}),setTimeout(()=>{this.forceChildUIRefresh()},0);const e=this.getValues();this.initialValues=e,this.onChange&&this.onChange(e)}wireChild(t){var i;const e=()=>{var n;const s=this.getValues();this.initialValues=s,(n=this.onChange)==null||n.call(this,s),this.updateVisibility()};N(t)?t.setOnChange(()=>e()):j(t)?t.setOnChange(()=>e()):(i=t.setOnChange)==null||i.call(t,()=>e())}addSetting(t,e){var s,n;if(this.settings[t]=e,this.wireChild(e),this.elementRef){const o=this.elementRef.querySelector(".setting-group-content");if(o){N(e)&&typeof e.setNestingLevel=="function"&&e.setNestingLevel(this.nestingLevel+1);const a=e.draw(),l=this.deleteItemCfg??this.addItemCfg;if(l){const h=l.keyPrefix??((s=this.addItemCfg)==null?void 0:s.keyPrefix);h&&t.startsWith(h)&&this.addDeleteButtonToElement(a,t)}const r=o.querySelector(".sg-add-button-bottom");r?o.insertBefore(a,r):o.appendChild(a),ot.trackElement(a),Z(a,this.nestingLevel+1),et(a,this.nestingLevel+1);const c=a.style.display;a.style.display="none",a.offsetHeight,a.style.display=c,this.updateNestingStyles()}}const i=this.getValues();this.initialValues=i,(n=this.onChange)==null||n.call(this,i)}addDeleteButtonToElement(t,e,i){let s=null;try{s=t.querySelector(":scope > .setting-group-title")}catch{s=null}if(!s){const r=Array.from(t.querySelectorAll(".setting-group-title"));for(const c of r)if(c.closest(".setting-group")===t){s=c;break}s||(s=r[0]??null)}if(!s)return;const n=s.querySelector(".actions-section");if(!n)return;const o=document.createElement("button");o.type="button",o.className="sg-delete-button",i?i.deleteItemCfg:this.deleteItemCfg??this.addItemCfg,o.title="Delete",o.style.cssText=`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const ut="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let lt=(p=21)=>{let t="",e=crypto.getRandomValues(new Uint8Array(p|=0));for(;p--;)t+=ut[e[p]&63];return t};function gt(p){let t=0,e=p.parentElement;for(;e;)e.classList.contains("setting-group")&&e!==p&&t++,e=e.parentElement;return t}function Z(p,t){const e=Math.min(Math.max(t,0),5);p.setAttribute("data-nesting-level",e.toString()),e>0?p.style.setProperty("--visual-indent",`${e*2}px`):(p.style.removeProperty("--visual-indent"),p.style.marginLeft="")}function et(p,t=0){p.querySelectorAll(":scope > .setting-group-content > .setting-group").forEach(i=>{const s=i,n=t+1;Z(s,n),et(s,n)})}const mt={maxLevel:5,spacingMultiplier:1,visualIndentMultiplier:2,enableAutoDetection:!0};class ft{constructor(t={}){this.observedElements=new Set,this.config={...mt,...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=gt(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 ot=new ft;function X(p){if(p===null||typeof p!="object")return p;if(p instanceof Date)return new Date(p.getTime());if(p instanceof Array)return p.map(t=>X(t));if(typeof p=="object"){const t={};for(const e in p)Object.prototype.hasOwnProperty.call(p,e)&&(t[e]=X(p[e]));return t}return p}function vt(p){switch(p){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 S{constructor(t={}){this.props=t,this.dataPropsPath="",this.id=t.id||lt(),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){globalThis.DefaultUploadUrl=t,S.DefaultUploadUrl=t}static SetDefaultLanguage(t){globalThis.DefaultLanguage=t,S.DefaultLanguage=t}destroy(){throw new Error("Method not implemented.")}setOnChange(t){return this.onChange=t,this}setOnBlur(t){return this.onBlur=t,this}setDataPropsPath(t){this.dataPropsPath=t}getDataPropsPath(){return this.dataPropsPath}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=X(this.props),i=new t(e);return i.value=X(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||vt(t.inputType)),s.type=t.inputType,s.placeholder=t.placeholder||"",s.className=t.inputClassName||"",this.dataPropsPath&&s.setAttribute("data-test-id",this.dataPropsPath);const n=a=>{const l=a.target;let r=l.value;switch(t.inputType){case"number":r=Number(l.value);break;case"color":r=l.value;break;case"date":r=l.value;break;case"select":r=l.value;break;case"text":r=l.value;break;case"button":r=l.value;break;default:r=l.value}this.value=r,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 j(p){return p instanceof S}function N(p){return p instanceof W}function it(p){return j(p)||N(p)}function q(p,t){for(const e in p)if(Object.prototype.hasOwnProperty.call(p,e)){const i=p[e];t(e,i)}}const K=class K{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.dataPropsPath="",this.hide=!1,this.id=t.id||lt(),this.title=t.title,this.settings=t.settings,this.isCollapsed=t.collapsed??!1,this.isMain=t.main??!1,this.custom=t.custom??!1,this.nestingLevel=0,this.includeGetJson=t.includeGetJson??!0,this.addItemCfg=t.addItem,this.deleteItemCfg=t.deleteItem,this.dataProps=t.dataProps,this.dataPropsPath=t.dataProps||"",this.hide=t.hide??!1,Object.assign(this,t.settings),this.initialValues=this.getValues(),this.originalDefaultValues=this.getDefaultValues(),this.propagateNestingLevel(),this.propagateDataPropsPath()}propagateNestingLevel(){const t=this.nestingLevel+1;q(this.settings,(e,i)=>{N(i)&&(i.nestingLevel=t,i.propagateNestingLevel())})}getNestingLevel(){return this.nestingLevel}setNestingLevel(t){this.nestingLevel=t,this.propagateNestingLevel(),this.elementRef&&this.updateNestingStyles()}getDataPropsPath(){return this.dataPropsPath}setDataPropsPath(t){this.dataPropsPath=t,this.propagateDataPropsPath()}propagateDataPropsPath(){q(this.settings,(t,e)=>{const i=String(t),s=this.dataPropsPath?`${this.dataPropsPath}_${i}`:i;(N(e)||j(e)&&typeof e.setDataPropsPath=="function")&&e.setDataPropsPath(s)})}updateNestingStyles(){this.elementRef&&(Z(this.elementRef,this.nestingLevel),et(this.elementRef,this.nestingLevel))}forceChildUIRefresh(){Object.entries(this.settings).forEach(([t,e])=>{try{if(N(e)){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)}})}removeSetting(t){var s;const e=this.settings[t];if(!e)return;if(delete this.settings[t],this.elementRef){const n=this.elementRef.querySelector(".setting-group-content");if(n){const o=Array.from(n.querySelectorAll(".setting-group, .setting"));for(const a of o){const l=a.id;if(l&&"id"in e&&typeof e.id=="string"&&l.includes(e.id)){a.remove();break}}}}typeof e.cleanup=="function"&&e.cleanup(),this.updateNestingStyles();const i=this.getValues();this.initialValues=i,(s=this.onChange)==null||s.call(this,i)}updateVisibility(){this.elementRef}clone(){const t={};q(this.settings,(s,n)=>{const o=String(s);typeof n.clone=="function"?t[o]=n.clone():(console.warn(`Setting with key '${o}' does not have a clone method. Copying reference.`),t[o]=n)});const e={title:this.title,settings:t,collapsed:this.isCollapsed,main:this.isMain,custom:this.custom,includeGetJson:this.includeGetJson,addItem:this.addItemCfg,deleteItem:this.deleteItemCfg,dataProps:this.dataProps},i=rt(e);return i.initialValues=this.getValues(),i}resetDefault(){const t=this.originalDefaultValues;this.setValue(t),this.onChange&&this.onChange(this.getValues())}setMobileValues(t){!t||typeof t!="object"||(Object.entries(t).forEach(([e,i])=>{const s=this.settings[e];s&&(N(s)||j(s))&&typeof s.setMobileValue=="function"&&s.setMobileValue(i)}),this.setValue(t),this.onChange&&this.onChange(this.getValues()))}getMobileValues(t){if(t===void 0){const e={};for(const i in this.settings)if(Object.prototype.hasOwnProperty.call(this.settings,i)){const s=this.settings[i];if(N(s))e[i]=s.getMobileValues();else{const n=s;e[i]=n.mobileValue!==void 0?n.mobileValue:n.value}}return e}else{const e=this.settings[t];if(!e)return;if(N(e))return e.getMobileValues();const i=e;return i.mobileValue!==void 0?i.mobileValue:i.value}}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(),q(this.settings,(i,s)=>{var n;if(N(s))s.setOnChange(()=>{const o=this.getValues();this.initialValues=o,t(o)}),this.changeHandlers.add(()=>t(this.getValues()));else if(j(s)){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}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()}setValue(t){if(!t||typeof t!="object")return;Object.entries(t).forEach(([i,s])=>{let n=this.settings[i];if(!n&&this.addItemCfg&&i.startsWith(this.addItemCfg.keyPrefix)){const o=i.slice(this.addItemCfg.keyPrefix.length),a=Number(o);if(Number.isFinite(a)){const l=this.addItemCfg.createItem(a);it(l)&&(this.addSetting(i,l),n=l)}}n&&(N(n)||j(n))&&typeof n.setValue=="function"&&n.setValue(s)}),setTimeout(()=>{this.forceChildUIRefresh()},0);const e=this.getValues();this.initialValues=e,this.onChange&&this.onChange(e)}wireChild(t){var i;const e=()=>{var n;const s=this.getValues();this.initialValues=s,(n=this.onChange)==null||n.call(this,s),this.updateVisibility()};N(t)?t.setOnChange(()=>e()):j(t)?t.setOnChange(()=>e()):(i=t.setOnChange)==null||i.call(t,()=>e())}addSetting(t,e){var s,n;if(this.settings[t]=e,this.wireChild(e),this.elementRef){const o=this.elementRef.querySelector(".setting-group-content");if(o){N(e)&&typeof e.setNestingLevel=="function"&&e.setNestingLevel(this.nestingLevel+1);const a=e.draw(),l=this.deleteItemCfg??this.addItemCfg;if(l){const h=l.keyPrefix??((s=this.addItemCfg)==null?void 0:s.keyPrefix);h&&t.startsWith(h)&&this.addDeleteButtonToElement(a,t)}const r=o.querySelector(".sg-add-button-bottom");r?o.insertBefore(a,r):o.appendChild(a),ot.trackElement(a),Z(a,this.nestingLevel+1),et(a,this.nestingLevel+1);const c=a.style.display;a.style.display="none",a.offsetHeight,a.style.display=c,this.updateNestingStyles()}}const i=this.getValues();this.initialValues=i,(n=this.onChange)==null||n.call(this,i)}addDeleteButtonToElement(t,e,i){let s=null;try{s=t.querySelector(":scope > .setting-group-title")}catch{s=null}if(!s){const r=Array.from(t.querySelectorAll(".setting-group-title"));for(const c of r)if(c.closest(".setting-group")===t){s=c;break}s||(s=r[0]??null)}if(!s)return;const n=s.querySelector(".actions-section");if(!n)return;const o=document.createElement("button");o.type="button",o.className="sg-delete-button",i?i.deleteItemCfg:this.deleteItemCfg??this.addItemCfg,o.title="Delete",o.style.cssText=`
2
2
  background: none;
3
3
  border: none;
4
4
  cursor: pointer;
@@ -70,7 +70,7 @@
70
70
  font-weight: 500;
71
71
  cursor: pointer;
72
72
  transition: all 0.2s;
73
- `,a.addEventListener("mouseenter",()=>{a.style.backgroundColor="#f9fafb",a.style.borderColor="#9ca3af"}),a.addEventListener("mouseleave",()=>{a.style.backgroundColor="white",a.style.borderColor="#d1d5db"}),l.addEventListener("mouseenter",()=>{l.style.backgroundColor="#dc2626"}),l.addEventListener("mouseleave",()=>{l.style.backgroundColor="#ef4444"});const r=()=>{e.style.opacity="0",i.style.transform="scale(0.95)",setTimeout(()=>{e.parentNode&&e.parentNode.removeChild(e)},200)};a.addEventListener("click",()=>{r(),t(!1)}),l.addEventListener("click",()=>{r(),t(!0)}),e.addEventListener("click",h=>{h.target===e&&(r(),t(!1))});const c=h=>{h.key==="Escape"&&(r(),t(!1),document.removeEventListener("keydown",c))};document.addEventListener("keydown",c),o.appendChild(a),o.appendChild(l),i.appendChild(s),i.appendChild(n),i.appendChild(o),e.appendChild(i),document.body.appendChild(e),requestAnimationFrame(()=>{e.style.opacity="1",i.style.transform="scale(1)"}),setTimeout(()=>l.focus(),100)})}getNextIndexFromPrefix(t){const e=Object.keys(this.settings).filter(i=>i.startsWith(t)).map(i=>{const s=Number(i.slice(t.length));return Number.isFinite(s)?s:-1}).filter(i=>i>=0);return e.length?Math.max(...e)+1:0}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}getValues(t){if(t===void 0){const e={};for(const i in this.settings)if(Object.prototype.hasOwnProperty.call(this.settings,i)){const s=this.settings[i];if(N(s))e[i]=s.getValues();else{const n=s;e[i]=n.getValue?n.getValue():n.value}}return e}else{const e=this.settings[t];if(!e)return;if(N(e))return e.getValues();const i=e;return i.getValue?i.getValue():i.value}}getValuesForJson(t){if(t===void 0){if(this.includeGetJson===!1)return null;const e={};for(const i in this.settings)if(Object.prototype.hasOwnProperty.call(this.settings,i)){const s=this.settings[i];if(N(s)){const n=s.getValuesForJson();n!==null&&(e[i]=n)}else{const n=s;n.includeGetJson!==!1&&(e[i]=n.value)}}return e}else{const e=this.settings[t];if(!e)return;if(N(e))return e.includeGetJson===!1?null:e.getValuesForJson();{const i=e;return i.includeGetJson===!1?null:i.value}}}getDefaultValues(t){if(t===void 0){const e={};for(const i in this.settings)if(Object.prototype.hasOwnProperty.call(this.settings,i)){const s=this.settings[i];if(N(s))e[i]=s.getDefaultValues();else{const n=s;e[i]=n.default!==void 0?n.default:n.value}}return e}else{const e=this.settings[t];if(!e)return;if(N(e))return e.getDefaultValues();const i=e;return i.default!==void 0?i.default:i.value}}draw(){const t=document.createElement("div");t.className="setting-group",t.id=`setting-group-${this.id}`,K.hiddenElements.add(t),this.isMain&&t.classList.add("main-group"),this.custom&&t.classList.add("custom_class"),Z(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");i.className="title-section";const s=document.createElement("h3");s.textContent=this.title,i.appendChild(s);const n=document.createElement("div");n.className="actions-section";const o=document.createElement("span");o.className="setting-group-arrow",o.innerHTML=`
73
+ `,a.addEventListener("mouseenter",()=>{a.style.backgroundColor="#f9fafb",a.style.borderColor="#9ca3af"}),a.addEventListener("mouseleave",()=>{a.style.backgroundColor="white",a.style.borderColor="#d1d5db"}),l.addEventListener("mouseenter",()=>{l.style.backgroundColor="#dc2626"}),l.addEventListener("mouseleave",()=>{l.style.backgroundColor="#ef4444"});const r=()=>{e.style.opacity="0",i.style.transform="scale(0.95)",setTimeout(()=>{e.parentNode&&e.parentNode.removeChild(e)},200)};a.addEventListener("click",()=>{r(),t(!1)}),l.addEventListener("click",()=>{r(),t(!0)}),e.addEventListener("click",h=>{h.target===e&&(r(),t(!1))});const c=h=>{h.key==="Escape"&&(r(),t(!1),document.removeEventListener("keydown",c))};document.addEventListener("keydown",c),o.appendChild(a),o.appendChild(l),i.appendChild(s),i.appendChild(n),i.appendChild(o),e.appendChild(i),document.body.appendChild(e),requestAnimationFrame(()=>{e.style.opacity="1",i.style.transform="scale(1)"}),setTimeout(()=>l.focus(),100)})}getNextIndexFromPrefix(t){const e=Object.keys(this.settings).filter(i=>i.startsWith(t)).map(i=>{const s=Number(i.slice(t.length));return Number.isFinite(s)?s:-1}).filter(i=>i>=0);return e.length?Math.max(...e)+1:0}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}getValues(t){if(t===void 0){const e={};for(const i in this.settings)if(Object.prototype.hasOwnProperty.call(this.settings,i)){const s=this.settings[i];if(N(s))e[i]=s.getValues();else{const n=s;e[i]=n.getValue?n.getValue():n.value}}return e}else{const e=this.settings[t];if(!e)return;if(N(e))return e.getValues();const i=e;return i.getValue?i.getValue():i.value}}getValuesForJson(t){if(t===void 0){if(this.includeGetJson===!1)return null;const e={};for(const i in this.settings)if(Object.prototype.hasOwnProperty.call(this.settings,i)){const s=this.settings[i];if(N(s)){const n=s.getValuesForJson();n!==null&&(e[i]=n)}else{const n=s;n.includeGetJson!==!1&&(e[i]=n.value)}}return this.hide&&(e.hide=!0),e}else{const e=this.settings[t];if(!e)return;if(N(e))return e.includeGetJson===!1?null:e.getValuesForJson();{const i=e;return i.includeGetJson===!1?null:i.value}}}getDefaultValues(t){if(t===void 0){const e={};for(const i in this.settings)if(Object.prototype.hasOwnProperty.call(this.settings,i)){const s=this.settings[i];if(N(s))e[i]=s.getDefaultValues();else{const n=s;e[i]=n.default!==void 0?n.default:n.value}}return e}else{const e=this.settings[t];if(!e)return;if(N(e))return e.getDefaultValues();const i=e;return i.default!==void 0?i.default:i.value}}draw(){const t=document.createElement("div");t.className="setting-group",t.id=`setting-group-${this.id}`,K.hiddenElements.add(t),this.hide&&(t.style.display="none"),this.isMain&&t.classList.add("main-group"),this.custom&&t.classList.add("custom_class"),Z(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");i.className="title-section";const s=document.createElement("h3");s.textContent=this.title,i.appendChild(s);const n=document.createElement("div");n.className="actions-section";const o=document.createElement("span");o.className="setting-group-arrow",o.innerHTML=`
74
74
  <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
75
75
  <path d="M4 6L8 10L12 6" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
76
76
  </svg>
@@ -252,7 +252,7 @@ function q(p, t) {
252
252
  const Y = class Y {
253
253
  constructor(t) {
254
254
  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 = () => {
255
- }, this.pendingBlurHandler = null, this.originalDefaultValues = {}, this.nestingLevel = 0, this.dataPropsPath = "", this.id = t.id || ot(), this.title = t.title, this.settings = t.settings, this.isCollapsed = t.collapsed ?? !1, this.isMain = t.main ?? !1, this.custom = t.custom ?? !1, this.nestingLevel = 0, this.includeGetJson = t.includeGetJson ?? !0, this.addItemCfg = t.addItem, this.deleteItemCfg = t.deleteItem, this.dataProps = t.dataProps, this.dataPropsPath = t.dataProps || "", Object.assign(this, t.settings), this.initialValues = this.getValues(), this.originalDefaultValues = this.getDefaultValues(), this.propagateNestingLevel(), this.propagateDataPropsPath();
255
+ }, this.pendingBlurHandler = null, this.originalDefaultValues = {}, this.nestingLevel = 0, this.dataPropsPath = "", this.hide = !1, this.id = t.id || ot(), this.title = t.title, this.settings = t.settings, this.isCollapsed = t.collapsed ?? !1, this.isMain = t.main ?? !1, this.custom = t.custom ?? !1, this.nestingLevel = 0, this.includeGetJson = t.includeGetJson ?? !0, this.addItemCfg = t.addItem, this.deleteItemCfg = t.deleteItem, this.dataProps = t.dataProps, this.dataPropsPath = t.dataProps || "", this.hide = t.hide ?? !1, Object.assign(this, t.settings), this.initialValues = this.getValues(), this.originalDefaultValues = this.getDefaultValues(), this.propagateNestingLevel(), this.propagateDataPropsPath();
256
256
  }
257
257
  propagateNestingLevel() {
258
258
  const t = this.nestingLevel + 1;
@@ -667,7 +667,7 @@ const Y = class Y {
667
667
  n.includeGetJson !== !1 && (e[i] = n.value);
668
668
  }
669
669
  }
670
- return e;
670
+ return this.hide && (e.hide = !0), e;
671
671
  } else {
672
672
  const e = this.settings[t];
673
673
  if (!e) return;
@@ -703,7 +703,7 @@ const Y = class Y {
703
703
  }
704
704
  draw() {
705
705
  const t = document.createElement("div");
706
- t.className = "setting-group", t.id = `setting-group-${this.id}`, Y.hiddenElements.add(t), this.isMain && t.classList.add("main-group"), this.custom && t.classList.add("custom_class"), Z(t, this.nestingLevel);
706
+ t.className = "setting-group", t.id = `setting-group-${this.id}`, Y.hiddenElements.add(t), this.hide && (t.style.display = "none"), this.isMain && t.classList.add("main-group"), this.custom && t.classList.add("custom_class"), Z(t, this.nestingLevel);
707
707
  const e = document.createElement("div");
708
708
  e.className = "setting-group-title", this.isCollapsed && e.classList.add("collapsed-view"), e.setAttribute("role", "button"), e.setAttribute(
709
709
  "aria-expanded",
@@ -1217,7 +1217,7 @@ const Ct = `
1217
1217
  <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"/>
1218
1218
  <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"/>
1219
1219
  </svg>`;
1220
- class Et extends G {
1220
+ class yt extends G {
1221
1221
  constructor(t = {}) {
1222
1222
  const e = {
1223
1223
  title: "Opacity",
@@ -1238,7 +1238,7 @@ class Et extends G {
1238
1238
  this.mobileValue = t, t !== void 0 && this.setValue(t);
1239
1239
  }
1240
1240
  }
1241
- const yt = `
1241
+ const Et = `
1242
1242
  <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">
1243
1243
  <polyline points="6 9 12 15 18 9"></polyline>
1244
1244
  </svg>
@@ -1287,7 +1287,7 @@ class et extends I {
1287
1287
  a.onclick = (l) => this.selectOption(l, o, e), i.appendChild(a);
1288
1288
  }), document.body.appendChild(i);
1289
1289
  const s = document.createElement("div");
1290
- return s.classList.add("svg-container"), s.innerHTML = yt, t.appendChild(s), this.optionsListEl = i, this.svgContainer = s, this.props.getOptionsAsync && (this.isLoading = !0, this.updateButtonText(), this.props.getOptionsAsync().then((n) => {
1290
+ return s.classList.add("svg-container"), s.innerHTML = Et, t.appendChild(s), this.optionsListEl = i, this.svgContainer = s, this.props.getOptionsAsync && (this.isLoading = !0, this.updateButtonText(), this.props.getOptionsAsync().then((n) => {
1291
1291
  this._options.push(...n), this.isLoading = !1, this.updateOptionsList(), this.updateButtonText();
1292
1292
  }).catch((n) => {
1293
1293
  console.error("Failed to fetch async options:", n), this.isLoading = !1, this.updateButtonText("Failed to load options");
@@ -2261,23 +2261,23 @@ function nt(p) {
2261
2261
  }
2262
2262
  for (let u = 0; u < d.length; u++) {
2263
2263
  const g = d[u];
2264
- let C = "", m = 0, E = 100;
2264
+ let C = "", m = 0, y = 100;
2265
2265
  const f = g.match(
2266
2266
  /rgba?\(([^)]+)\)(?:\s*(\d+(?:\.\d+)?)%)?/
2267
2267
  );
2268
2268
  if (f) {
2269
- const y = f[1].split(",").map((b) => b.trim()), V = parseInt(y[0]), A = parseInt(y[1]), B = parseInt(y[2]), L = y[3] ? parseFloat(y[3]) : 1;
2270
- C = `#${V.toString(16).padStart(2, "0")}${A.toString(16).padStart(2, "0")}${B.toString(16).padStart(2, "0")}`, E = Math.round(L * 100), f[2] ? m = parseFloat(f[2]) : m = d.length === 1 ? 0 : Math.round(u / (d.length - 1) * 100);
2269
+ const E = f[1].split(",").map((b) => b.trim()), V = parseInt(E[0]), A = parseInt(E[1]), B = parseInt(E[2]), L = E[3] ? parseFloat(E[3]) : 1;
2270
+ C = `#${V.toString(16).padStart(2, "0")}${A.toString(16).padStart(2, "0")}${B.toString(16).padStart(2, "0")}`, y = Math.round(L * 100), f[2] ? m = parseFloat(f[2]) : m = d.length === 1 ? 0 : Math.round(u / (d.length - 1) * 100);
2271
2271
  } else {
2272
- const y = g.match(
2272
+ const E = g.match(
2273
2273
  /#([a-fA-F0-9]{3,8})(?:\s*(\d+(?:\.\d+)?)%)?/
2274
2274
  );
2275
- y && (C = `#${y[1]}`, y[2] ? m = parseFloat(y[2]) : m = d.length === 1 ? 0 : Math.round(u / (d.length - 1) * 100));
2275
+ E && (C = `#${E[1]}`, E[2] ? m = parseFloat(E[2]) : m = d.length === 1 ? 0 : Math.round(u / (d.length - 1) * 100));
2276
2276
  }
2277
2277
  C && h.push({
2278
2278
  color: C,
2279
2279
  position: m,
2280
- opacity: E
2280
+ opacity: y
2281
2281
  });
2282
2282
  }
2283
2283
  if (h.length === 0) {
@@ -2285,14 +2285,14 @@ function nt(p) {
2285
2285
  /(#[a-fA-F0-9]{3,8}|rgba?\([^)]+\))/g
2286
2286
  );
2287
2287
  u && u.forEach((g, C) => {
2288
- let m = "", E = 100;
2288
+ let m = "", y = 100;
2289
2289
  if (g.startsWith("#"))
2290
2290
  m = g;
2291
2291
  else {
2292
2292
  const f = g.match(/rgba?\(([^)]+)\)/);
2293
2293
  if (f) {
2294
- const y = f[1].split(",").map((b) => b.trim()), V = parseInt(y[0]), A = parseInt(y[1]), B = parseInt(y[2]), L = y[3] ? parseFloat(y[3]) : 1;
2295
- m = `#${V.toString(16).padStart(2, "0")}${A.toString(16).padStart(2, "0")}${B.toString(16).padStart(2, "0")}`, E = Math.round(L * 100);
2294
+ const E = f[1].split(",").map((b) => b.trim()), V = parseInt(E[0]), A = parseInt(E[1]), B = parseInt(E[2]), L = E[3] ? parseFloat(E[3]) : 1;
2295
+ m = `#${V.toString(16).padStart(2, "0")}${A.toString(16).padStart(2, "0")}${B.toString(16).padStart(2, "0")}`, y = Math.round(L * 100);
2296
2296
  }
2297
2297
  }
2298
2298
  if (m) {
@@ -2300,7 +2300,7 @@ function nt(p) {
2300
2300
  h.push({
2301
2301
  color: m,
2302
2302
  position: f,
2303
- opacity: E
2303
+ opacity: y
2304
2304
  });
2305
2305
  }
2306
2306
  });
@@ -2359,14 +2359,14 @@ class Pt {
2359
2359
  C.value = "hex", C.textContent = "HEX";
2360
2360
  const m = document.createElement("option");
2361
2361
  m.value = "rgb", m.textContent = "RGB";
2362
- const E = document.createElement("option");
2363
- E.value = "hsl", E.textContent = "HSL", g.appendChild(C), g.appendChild(m), g.appendChild(E);
2362
+ const y = document.createElement("option");
2363
+ y.value = "hsl", y.textContent = "HSL", g.appendChild(C), g.appendChild(m), g.appendChild(y);
2364
2364
  const f = document.createElement("input");
2365
2365
  f.type = "text", f.className = "color-picker-color-input", f.value = this.currentColor, this.hexInput = f;
2366
- const y = document.createElement("div");
2367
- y.className = "color-picker-input-container";
2366
+ const E = document.createElement("div");
2367
+ E.className = "color-picker-input-container";
2368
2368
  const V = document.createElement("button");
2369
- return V.className = "color-picker-copy-inside", V.textContent = "Copy", V.addEventListener("click", () => this.copyToClipboard()), y.appendChild(f), y.appendChild(V), u.appendChild(g), u.appendChild(y), t.appendChild(e), t.appendChild(n), t.appendChild(a), t.appendChild(h), t.appendChild(u), this.setupEyedropper(l), this.setupEventListeners(), t.addEventListener("click", (A) => {
2369
+ return V.className = "color-picker-copy-inside", V.textContent = "Copy", V.addEventListener("click", () => this.copyToClipboard()), E.appendChild(f), E.appendChild(V), u.appendChild(g), u.appendChild(E), t.appendChild(e), t.appendChild(n), t.appendChild(a), t.appendChild(h), t.appendChild(u), this.setupEyedropper(l), this.setupEventListeners(), t.addEventListener("click", (A) => {
2370
2370
  A.stopPropagation();
2371
2371
  }), t;
2372
2372
  }
@@ -2564,8 +2564,8 @@ class Pt {
2564
2564
  h.preventDefault(), h.stopPropagation();
2565
2565
  const d = h.clientX - s, u = h.clientY - n;
2566
2566
  let g = o + d, C = a + u;
2567
- const m = window.innerWidth, E = window.innerHeight, f = e.offsetWidth, y = e.offsetHeight;
2568
- g = Math.max(8, Math.min(m - f - 8, g)), C = Math.max(8, Math.min(E - y - 8, C)), e.style.left = `${g}px`, e.style.top = `${C}px`;
2567
+ const m = window.innerWidth, y = window.innerHeight, f = e.offsetWidth, E = e.offsetHeight;
2568
+ g = Math.max(8, Math.min(m - f - 8, g)), C = Math.max(8, Math.min(y - E - 8, C)), e.style.left = `${g}px`, e.style.top = `${C}px`;
2569
2569
  }, c = (h) => {
2570
2570
  i && (i = !1, h.preventDefault(), h.stopPropagation(), e.classList.remove("dragging"), document.removeEventListener("mousemove", r), document.removeEventListener("mouseup", c), document.body.style.userSelect = "");
2571
2571
  };
@@ -2902,14 +2902,14 @@ class se extends I {
2902
2902
  C.value = "hex", C.textContent = "HEX";
2903
2903
  const m = document.createElement("option");
2904
2904
  m.value = "rgb", m.textContent = "RGB";
2905
- const E = document.createElement("option");
2906
- E.value = "hsl", E.textContent = "HSL", g.appendChild(C), g.appendChild(m), g.appendChild(E);
2905
+ const y = document.createElement("option");
2906
+ y.value = "hsl", y.textContent = "HSL", g.appendChild(C), g.appendChild(m), g.appendChild(y);
2907
2907
  const f = document.createElement("input");
2908
2908
  f.type = "text", f.className = "color-picker-color-input", f.value = t;
2909
- const y = document.createElement("div");
2910
- y.className = "color-picker-input-container";
2909
+ const E = document.createElement("div");
2910
+ E.className = "color-picker-input-container";
2911
2911
  const V = document.createElement("button");
2912
- return V.className = "color-picker-copy-inside", V.textContent = "Copy", y.appendChild(f), y.appendChild(V), u.appendChild(g), u.appendChild(y), s.appendChild(n), s.appendChild(a), s.appendChild(h), s.appendChild(u), this.setupEmbeddedColorPicker(
2912
+ return V.className = "color-picker-copy-inside", V.textContent = "Copy", E.appendChild(f), E.appendChild(V), u.appendChild(g), u.appendChild(E), s.appendChild(n), s.appendChild(a), s.appendChild(h), s.appendChild(u), this.setupEmbeddedColorPicker(
2913
2913
  n,
2914
2914
  o,
2915
2915
  r,
@@ -2958,10 +2958,10 @@ class se extends I {
2958
2958
  C.value = "hsl", C.textContent = "HSL", d.appendChild(u), d.appendChild(g), d.appendChild(C);
2959
2959
  const m = document.createElement("input");
2960
2960
  m.type = "text", m.className = "color-picker-color-input", m.value = t;
2961
- const E = document.createElement("div");
2962
- E.className = "color-picker-input-container";
2961
+ const y = document.createElement("div");
2962
+ y.className = "color-picker-input-container";
2963
2963
  const f = document.createElement("button");
2964
- return f.className = "color-picker-copy-inside", f.textContent = "Copy", E.appendChild(m), E.appendChild(f), h.appendChild(d), h.appendChild(E), s.appendChild(n), s.appendChild(a), s.appendChild(h), this.setupEmbeddedColorPicker(
2964
+ return f.className = "color-picker-copy-inside", f.textContent = "Copy", y.appendChild(m), y.appendChild(f), h.appendChild(d), h.appendChild(y), s.appendChild(n), s.appendChild(a), s.appendChild(h), this.setupEmbeddedColorPicker(
2965
2965
  n,
2966
2966
  o,
2967
2967
  r,
@@ -2980,7 +2980,7 @@ class se extends I {
2980
2980
  const { h: u, s: g, v: C } = this.hexToHsv(r);
2981
2981
  let m = c;
2982
2982
  s.style.left = `${u / 360 * 100}%`, e.style.left = `${g * 100}%`, e.style.top = `${(1 - C) * 100}%`, t.style.background = `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(${u}, 100%, 50%))`;
2983
- const E = (v, w = m) => {
2983
+ const y = (v, w = m) => {
2984
2984
  d = v, m = Math.round(w), f(), h(v, m);
2985
2985
  }, f = () => {
2986
2986
  const v = n.value, { h: w, s: x, v: k } = this.hexToHsv(d);
@@ -2999,15 +2999,15 @@ class se extends I {
2999
2999
  )}%, ${Math.round(K * 100)}%)`;
3000
3000
  break;
3001
3001
  }
3002
- }, y = () => parseFloat(s.style.left || "0%") / 100 * 360, V = (v, w) => {
3003
- const x = y(), k = this.hsvToHex(x, v, w);
3004
- E(k, m);
3002
+ }, E = () => parseFloat(s.style.left || "0%") / 100 * 360, V = (v, w) => {
3003
+ const x = E(), k = this.hsvToHex(x, v, w);
3004
+ y(k, m);
3005
3005
  }, A = (v) => {
3006
3006
  v = Math.max(0.1, Math.min(358.9, v));
3007
3007
  const w = parseFloat(e.style.left || "50%") / 100, x = parseFloat(e.style.top || "50%") / 100;
3008
3008
  t.style.background = `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(${v}, 100%, 50%))`;
3009
3009
  const k = w, T = 1 - x, $ = this.hsvToHex(v, k, T);
3010
- E($, m);
3010
+ y($, m);
3011
3011
  }, B = (v) => {
3012
3012
  v.stopPropagation();
3013
3013
  const w = t.getBoundingClientRect(), x = Math.max(0, Math.min(1, (v.clientX - w.left) / w.width)), k = Math.max(0, Math.min(1, (v.clientY - w.top) / w.height));
@@ -3054,7 +3054,7 @@ class se extends I {
3054
3054
  }
3055
3055
  if (k) {
3056
3056
  const { h: T, s: $, v: W } = this.hexToHsv(k);
3057
- s.style.left = `${T / 360 * 100}%`, e.style.left = `${$ * 100}%`, e.style.top = `${(1 - W) * 100}%`, t.style.background = `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(${T}, 100%, 50%))`, E(k, m);
3057
+ s.style.left = `${T / 360 * 100}%`, e.style.left = `${$ * 100}%`, e.style.top = `${(1 - W) * 100}%`, t.style.background = `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(${T}, 100%, 50%))`, y(k, m);
3058
3058
  }
3059
3059
  }, O = (v) => {
3060
3060
  f();
@@ -3070,7 +3070,7 @@ class se extends I {
3070
3070
  if ("EyeDropper" in window)
3071
3071
  try {
3072
3072
  const x = (await new window.EyeDropper().open()).sRGBHex, { h: k, s: T, v: $ } = this.hexToHsv(x);
3073
- s.style.left = `${k / 360 * 100}%`, e.style.left = `${T * 100}%`, e.style.top = `${(1 - $) * 100}%`, t.style.background = `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(${k}, 100%, 50%))`, E(x, m);
3073
+ s.style.left = `${k / 360 * 100}%`, e.style.left = `${T * 100}%`, e.style.top = `${(1 - $) * 100}%`, t.style.background = `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(${k}, 100%, 50%))`, y(x, m);
3074
3074
  } catch (v) {
3075
3075
  console.log("User cancelled eyedropper or error occurred:", v);
3076
3076
  }
@@ -3137,22 +3137,22 @@ class se extends I {
3137
3137
  <path d="M14.1333 12.4667H0.8M0.8 12.4667L4.13333 9.13332M0.8 12.4667L4.13333 15.8M0.8 4.13332H14.1333M14.1333 4.13332L10.8 0.799988M14.1333 4.13332L10.8 7.46665" stroke="#919EAB" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/>
3138
3138
  </svg>
3139
3139
  `, l.title = "Flip gradient", i.addEventListener("change", (m) => {
3140
- const E = m.target.value;
3141
- this.switchType(E === "radial" ? "radial" : "linear");
3140
+ const y = m.target.value;
3141
+ this.switchType(y === "radial" ? "radial" : "linear");
3142
3142
  }), o.addEventListener("input", (m) => {
3143
- const E = m.target.value, f = parseInt(E);
3143
+ const y = m.target.value, f = parseInt(y);
3144
3144
  if (this.value && !isNaN(f)) {
3145
- const y = Math.max(0, Math.min(360, f));
3146
- this.value.angle = y, this.updateGradientPreview(), this.updateUI(), this.triggerChange();
3145
+ const E = Math.max(0, Math.min(360, f));
3146
+ this.value.angle = E, this.updateGradientPreview(), this.updateUI(), this.triggerChange();
3147
3147
  }
3148
3148
  }), o.addEventListener("focus", (m) => {
3149
- const E = m.target;
3150
- E.value = E.value.replace(/[^0-9-]/g, ""), setTimeout(() => E.select(), 0);
3149
+ const y = m.target;
3150
+ y.value = y.value.replace(/[^0-9-]/g, ""), setTimeout(() => y.select(), 0);
3151
3151
  }), o.addEventListener("blur", (m) => {
3152
- var y;
3153
- const E = m.target;
3154
- let f = parseInt(E.value);
3155
- isNaN(f) && (f = ((y = this.value) == null ? void 0 : y.angle) ?? 0), f = Math.max(0, Math.min(360, f)), this.value && (this.value.angle = f), E.value = `${f}°`, this.updateGradientPreview(), this.updateUI(), this.triggerChange();
3152
+ var E;
3153
+ const y = m.target;
3154
+ let f = parseInt(y.value);
3155
+ isNaN(f) && (f = ((E = this.value) == null ? void 0 : E.angle) ?? 0), f = Math.max(0, Math.min(360, f)), this.value && (this.value.angle = f), y.value = `${f}°`, this.updateGradientPreview(), this.updateUI(), this.triggerChange();
3156
3156
  }), l.addEventListener("click", () => {
3157
3157
  this.value && (this.value.stops = this.value.stops.map((m) => ({
3158
3158
  ...m,
@@ -3198,8 +3198,8 @@ class se extends I {
3198
3198
  passive: !1
3199
3199
  }), document.addEventListener("touchend", h), d.preventDefault();
3200
3200
  }, c = (d) => {
3201
- var E, f;
3202
- if (!s || !((f = (E = this.value) == null ? void 0 : E.stops) != null && f[i])) return;
3201
+ var y, f;
3202
+ if (!s || !((f = (y = this.value) == null ? void 0 : y.stops) != null && f[i])) return;
3203
3203
  const u = e.getBoundingClientRect(), C = (l(d) - n) / u.width * 100;
3204
3204
  let m = o + C;
3205
3205
  m = Math.max(0, Math.min(100, m)), this.value.stops[i].position = Math.round(m), t.style.left = `${m}%`, a && cancelAnimationFrame(a), a = requestAnimationFrame(() => {
@@ -3346,14 +3346,14 @@ class se extends I {
3346
3346
  C.className = "gstop-opacity-row";
3347
3347
  const m = document.createElement("span");
3348
3348
  m.className = "gstop-opacity-label", m.textContent = "Opacity";
3349
- const E = document.createElement("div");
3350
- E.className = "gstop-opacity-group";
3349
+ const y = document.createElement("div");
3350
+ y.className = "gstop-opacity-group";
3351
3351
  const f = document.createElement("input");
3352
3352
  f.type = "range", f.className = "gstop-opacity-slider", f.min = "0", f.max = "100", f.value = (s.opacity !== void 0 ? s.opacity : 100).toString();
3353
- const y = this.hexToRgb(s.color);
3353
+ const E = this.hexToRgb(s.color);
3354
3354
  f.style.setProperty(
3355
3355
  "--slider-color",
3356
- `rgb(${y.r}, ${y.g}, ${y.b})`
3356
+ `rgb(${E.r}, ${E.g}, ${E.b})`
3357
3357
  );
3358
3358
  const V = document.createElement("span");
3359
3359
  V.className = "gstop-opacity-value", V.textContent = `${s.opacity !== void 0 ? s.opacity : 100}%`;
@@ -3864,7 +3864,7 @@ class le extends z {
3864
3864
  ...t == null ? void 0 : t.uploadProps,
3865
3865
  default: (t == null ? void 0 : t.backgroundImage) ?? ""
3866
3866
  }),
3867
- opacity: new Et({
3867
+ opacity: new yt({
3868
3868
  default: (t == null ? void 0 : t.opacity) ?? 100
3869
3869
  }),
3870
3870
  backgroundColor: new U({
@@ -3912,7 +3912,7 @@ export {
3912
3912
  te as MarginTopSetting,
3913
3913
  ee as MultiLanguageSetting,
3914
3914
  G as NumberSetting,
3915
- Et as OpacitySetting,
3915
+ yt as OpacitySetting,
3916
3916
  Xt as SelectApiSettings,
3917
3917
  et as SelectSetting,
3918
3918
  I as Setting,
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.266",
4
+ "version": "0.0.267",
5
5
  "type": "module",
6
6
  "main": "dist/builder-settings-types.cjs.js",
7
7
  "module": "dist/builder-settings-types.es.js",