builder-settings-types 0.0.175 → 0.0.177
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.
- package/dist/builder-settings-types.cjs.js +23 -26
- package/dist/builder-settings-types.es.js +100 -115
- package/dist/index.d.ts +3 -9
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const G="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let N=(c=21)=>{let t="",e=crypto.getRandomValues(new Uint8Array(c|=0));for(;c--;)t+=G[e[c]&63];return t};function V(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]=V(c[s]);return i}const t={};for(const i in c)Object.prototype.hasOwnProperty.call(c,i)&&(t[i]=V(c[i]));const e=Object.getPrototypeOf(c);return e!==Object.prototype&&Object.setPrototypeOf(t,e),t}function P(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||N(),this.value=this.props.default,this.desktop=this.props.default,this.title=t.title||""}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=V(this.props),i=new t(e);return i.value=V(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 o=document.createElement("div");if(o.className="icon-container",t.icon){const l=this.createIcon(t.icon,t.iconClassName);o.appendChild(l)}if(t.title){const l=this.createLabel(t.title,t.labelClassName);o.appendChild(l)}e.appendChild(o)}const i=document.createElement("div");i.className=t.wrapperClassName||"";const s=document.createElement("input");this.inputEl=s,s.value=String(t.value||P(t.inputType)),s.type=t.inputType,s.placeholder=t.placeholder||"",s.className=t.inputClassName||"";const n=o=>{const l=o.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)},a=o=>{o.target,this.onBlur&&this.onBlur(this.value)};return s.addEventListener("input",n),s.addEventListener("change",n),s.addEventListener("blur",a),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 O(c){let t=0,e=c.parentElement;for(;e;)e.classList.contains("setting-group")&&e!==c&&t++,e=e.parentElement;return t}function S(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 H(c,t=0){c.querySelectorAll(":scope > .setting-group-content > .setting-group").forEach(i=>{const s=i,n=t+1;S(s,n),H(s,n)})}const W={maxLevel:5,spacingMultiplier:1,visualIndentMultiplier:2,enableAutoDetection:!0};class D{constructor(t={}){this.observedElements=new Set,this.config={...W,...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=O(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 _=new D;function E(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.lastValues={},this.lastChangeTime=0,this.CHANGE_DEBOUNCE=100,this.handleBlur=()=>{},this.pendingBlurHandler=null,this.originalDefaultValues={},this.nestingLevel=0,this.parentNestingLevel=0,this.id=t.id||N(),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;E(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&&(S(this.elementRef,this.nestingLevel),H(this.elementRef,this.nestingLevel))}autoDetectNestingLevel(){if(!this.elementRef)return;const t=O(this.elementRef);t!==this.nestingLevel&&this.setNestingLevel(t)}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(),E(this.settings,(i,s)=>{var n;if(s instanceof g)s.setOnChange(a=>{const o=this.getValues();this.initialValues=o,t(o)}),this.changeHandlers.add(()=>t(this.getValues()));else if(s instanceof p){const a=()=>{e()};this.changeHandlers.add(a),s.setOnChange(a)}else{const a=()=>{e()};this.changeHandlers.add(a),(n=s.setOnChange)==null||n.call(s,a)}}),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),E(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={};E(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=B(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)});const e=this.getValues();this.initialValues=e,this.onChange&&this.onChange(e)}calculateChanges(t,e){const i={};return new Set([...Object.keys(t),...Object.keys(e)]).forEach(n=>{const a=t[n],o=e[n];JSON.stringify(a)!==JSON.stringify(o)&&(i[n]={from:a,to:o})}),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}}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"),S(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 G="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let T=(c=21)=>{let t="",e=crypto.getRandomValues(new Uint8Array(c|=0));for(;c--;)t+=G[e[c]&63];return t};function L(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]=L(c[s]);return i}const t={};for(const i in c)Object.prototype.hasOwnProperty.call(c,i)&&(t[i]=L(c[i]));const e=Object.getPrototypeOf(c);return e!==Object.prototype&&Object.setPrototypeOf(t,e),t}function P(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||T(),this.value=this.props.default,this.desktop=this.props.default,this.title=t.title||""}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=L(this.props),i=new t(e);return i.value=L(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 o=document.createElement("div");if(o.className="icon-container",t.icon){const l=this.createIcon(t.icon,t.iconClassName);o.appendChild(l)}if(t.title){const l=this.createLabel(t.title,t.labelClassName);o.appendChild(l)}e.appendChild(o)}const i=document.createElement("div");i.className=t.wrapperClassName||"";const s=document.createElement("input");this.inputEl=s,s.value=String(t.value||P(t.inputType)),s.type=t.inputType,s.placeholder=t.placeholder||"",s.className=t.inputClassName||"";const n=o=>{const l=o.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)},a=o=>{o.target,this.onBlur&&this.onBlur(this.value)};return s.addEventListener("input",n),s.addEventListener("change",n),s.addEventListener("blur",a),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 N(c){let t=0,e=c.parentElement;for(;e;)e.classList.contains("setting-group")&&e!==c&&t++,e=e.parentElement;return t}function M(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 H(c,t=0){c.querySelectorAll(":scope > .setting-group-content > .setting-group").forEach(i=>{const s=i,n=t+1;M(s,n),H(s,n)})}const W={maxLevel:5,spacingMultiplier:1,visualIndentMultiplier:2,enableAutoDetection:!0};class D{constructor(t={}){this.observedElements=new Set,this.config={...W,...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=N(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 _=new D;function x(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.lastValues={},this.lastChangeTime=0,this.CHANGE_DEBOUNCE=100,this.handleBlur=()=>{},this.pendingBlurHandler=null,this.originalDefaultValues={},this.nestingLevel=0,this.parentNestingLevel=0,this.id=t.id||T(),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;x(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&&(M(this.elementRef,this.nestingLevel),H(this.elementRef,this.nestingLevel))}autoDetectNestingLevel(){if(!this.elementRef)return;const t=N(this.elementRef);t!==this.nestingLevel&&this.setNestingLevel(t)}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(),x(this.settings,(i,s)=>{var n;if(s instanceof g)s.setOnChange(a=>{const o=this.getValues();this.initialValues=o,t(o)}),this.changeHandlers.add(()=>t(this.getValues()));else if(s instanceof p){const a=()=>{e()};this.changeHandlers.add(a),s.setOnChange(a)}else{const a=()=>{e()};this.changeHandlers.add(a),(n=s.setOnChange)==null||n.call(s,a)}}),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),x(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={};x(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=O(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)});const e=this.getValues();this.initialValues=e,this.onChange&&this.onChange(e)}calculateChanges(t,e){const i={};return new Set([...Object.keys(t),...Object.keys(e)]).forEach(n=>{const a=t[n],o=e[n];JSON.stringify(a)!==JSON.stringify(o)&&(i[n]={from:a,to:o})}),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}}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"),M(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"/>
|
|
@@ -12,20 +12,20 @@
|
|
|
12
12
|
<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"
|
|
13
13
|
stroke="currentColor" stroke-width="1.33333" stroke-linecap="round" stroke-linejoin="round"/>
|
|
14
14
|
</svg>
|
|
15
|
-
`,d.title=this.description,n.insertBefore(d,a)}}else{if(!r){const d=document.createElement("div");d.className="setting-group-description",d.textContent=this.description,o.insertBefore(d,o.firstChild)}u&&u.remove()}};if(e.onclick=l,e.onkeydown=r=>{(r.key==="Enter"||r.key===" ")&&(r.preventDefault(),l())},Object.keys(this.settings).length>0){for(const r in this.settings)if(this.settings.hasOwnProperty(r)){const u=this.settings[r];u instanceof g&&u.setNestingLevel(this.nestingLevel+1),o.appendChild(u.draw())}}else{const r=document.createElement("div");r.className="setting-group-empty",r.textContent="No settings in this group",o.appendChild(r)}return e.appendChild(i),e.appendChild(n),t.appendChild(e),t.appendChild(o),this.elementRef=t,_.trackElement(t),setTimeout(()=>{this.updateNestingStyles()},0),this.pendingBlurHandler&&(this.setupBlurHandlers(),this.pendingBlurHandler=null),t}collapse(){if(!this.elementRef||this.isCollapsed)return;const t=this.elementRef.querySelector(".setting-group-content"),e=this.elementRef.querySelector(".setting-group-arrow"),i=this.elementRef.querySelector(".setting-group-title");t&&e&&i&&(this.isCollapsed=!0,t.classList.add("collapsed"),e.classList.add("rotated"),i.setAttribute("aria-expanded","false"))}expand(){if(!this.elementRef||!this.isCollapsed)return;const t=this.elementRef.querySelector(".setting-group-content"),e=this.elementRef.querySelector(".setting-group-arrow"),i=this.elementRef.querySelector(".setting-group-title");t&&e&&i&&(this.isCollapsed=!1,t.classList.remove("collapsed"),e.classList.remove("rotated"),i.setAttribute("aria-expanded","true"))}updateVisibility(){this.elementRef&&this.hideCondition&&(this.elementRef.style.display=this.hideCondition()?"none":"")}toggle(){this.isHidden?this.show():this.hide()}getJson(){return JSON.stringify(this.getValues(),null,2)}setJson(t){try{const e=JSON.parse(t);let i=e;const s=Object.keys(this.settings),n=Object.keys(e);if(!s.some(o=>n.includes(o))&&n.length===1){const o=n[0];i=e[o]}this.setValue(i)}catch(e){throw console.error("Invalid JSON provided to setJson:",e),new Error("Invalid JSON format")}}};g.hiddenElements=new Set;let m=g;function
|
|
15
|
+
`,d.title=this.description,n.insertBefore(d,a)}}else{if(!r){const d=document.createElement("div");d.className="setting-group-description",d.textContent=this.description,o.insertBefore(d,o.firstChild)}u&&u.remove()}};if(e.onclick=l,e.onkeydown=r=>{(r.key==="Enter"||r.key===" ")&&(r.preventDefault(),l())},Object.keys(this.settings).length>0){for(const r in this.settings)if(this.settings.hasOwnProperty(r)){const u=this.settings[r];u instanceof g&&u.setNestingLevel(this.nestingLevel+1),o.appendChild(u.draw())}}else{const r=document.createElement("div");r.className="setting-group-empty",r.textContent="No settings in this group",o.appendChild(r)}return e.appendChild(i),e.appendChild(n),t.appendChild(e),t.appendChild(o),this.elementRef=t,_.trackElement(t),setTimeout(()=>{this.updateNestingStyles()},0),this.pendingBlurHandler&&(this.setupBlurHandlers(),this.pendingBlurHandler=null),t}collapse(){if(!this.elementRef||this.isCollapsed)return;const t=this.elementRef.querySelector(".setting-group-content"),e=this.elementRef.querySelector(".setting-group-arrow"),i=this.elementRef.querySelector(".setting-group-title");t&&e&&i&&(this.isCollapsed=!0,t.classList.add("collapsed"),e.classList.add("rotated"),i.setAttribute("aria-expanded","false"))}expand(){if(!this.elementRef||!this.isCollapsed)return;const t=this.elementRef.querySelector(".setting-group-content"),e=this.elementRef.querySelector(".setting-group-arrow"),i=this.elementRef.querySelector(".setting-group-title");t&&e&&i&&(this.isCollapsed=!1,t.classList.remove("collapsed"),e.classList.remove("rotated"),i.setAttribute("aria-expanded","true"))}updateVisibility(){this.elementRef&&this.hideCondition&&(this.elementRef.style.display=this.hideCondition()?"none":"")}toggle(){this.isHidden?this.show():this.hide()}getJson(){return JSON.stringify(this.getValues(),null,2)}setJson(t){try{const e=JSON.parse(t);let i=e;const s=Object.keys(this.settings),n=Object.keys(e);if(!s.some(o=>n.includes(o))&&n.length===1){const o=n[0];i=e[o]}this.setValue(i)}catch(e){throw console.error("Invalid JSON provided to setJson:",e),new Error("Invalid JSON format")}}};g.hiddenElements=new Set;let m=g;function O(c){return new m(c)}function z(c){return c}class V extends p{constructor(t={}){super(t),this.inputType="text",t.onChange&&this.setOnChange(t.onChange)}draw(){const t=e=>{this.props.maxLength!==void 0&&(e.maxLength=this.props.maxLength),this.props.className&&e.classList.add(this.props.className)};return this.createInput({value:this.value,inputType:this.inputType,title:this.props.title,placeholder:this.props.placeholder,icon:this.props.icon,inputClassName:"string-setting-input "+(this.props.inputClassName||""),wrapperClassName:"string-setting-wrapper "+(this.props.wrapperClassName||""),inputCustomizer:t})}}const q="<svg xmlns='http://www.w3.org/2000/svg' width='18' height='19' viewBox='0 0 18 19' fill='none'><path d='M8.99999 15.8542C9.79613 16.5667 10.8475 17 12 17C14.4853 17 16.5 14.9853 16.5 12.5C16.5 10.4248 15.0953 8.67769 13.1849 8.15763M4.81513 8.15762C2.9047 8.67768 1.5 10.4248 1.5 12.5C1.5 14.9853 3.51472 17 6 17C8.48528 17 10.5 14.9853 10.5 12.5C10.5 11.9146 10.3882 11.3554 10.1849 10.8424M13.5 6.5C13.5 8.98528 11.4853 11 9 11C6.51472 11 4.5 8.98528 4.5 6.5C4.5 4.01472 6.51472 2 9 2C11.4853 2 13.5 4.01472 13.5 6.5Z' stroke='#667085' stroke-linecap='round' stroke-linejoin='round'/></svg>";class f extends V{constructor(t){super({...t,icon:t.icon||q,title:t.title||"Color",default:t.default?f.normalizeColorValue(t.default):"#000000"}),this.inputType="color",this.element=null,this.colorInputEl=null,this.textInputEl=null,this.detectChange=t.detectChange}static normalizeColorValue(t){return t.startsWith("#")?f.normalizeHexValue(t):t.includes(",")?f.rgbToHexStatic(t):f.normalizeHexValue(t)}static normalizeHexValue(t){return t=t.replace("#",""),t.length===3&&(t=t.split("").map(e=>e+e).join("")),t.length!==6?(console.warn(`Invalid hex value "${t}", using default "#000000"`),"#000000"):/^[0-9A-Fa-f]{6}$/.test(t)?`#${t.toLowerCase()}`:(console.warn(`Invalid hex value "${t}", using default "#000000"`),"#000000")}static rgbToHexStatic(t){const e=t.split(",").map(r=>parseInt(r.trim()));if(e.length!==3||e.some(isNaN))return console.warn(`Invalid RGB value "${t}", using default "#000000"`),"#000000";const[i,s,n]=e,a=Math.max(0,Math.min(255,i)),o=Math.max(0,Math.min(255,s)),l=Math.max(0,Math.min(255,n)),h=r=>{const u=r.toString(16);return u.length===1?"0"+u:u};return`#${h(a)}${h(o)}${h(l)}`}setValue(t){if(t===void 0){this.value="#000000",this.colorInputEl&&(this.colorInputEl.value="#000000"),this.textInputEl&&(this.textInputEl.value="#000000"),this.onChange&&this.onChange("#000000"),this.props.detectChange&&this.props.detectChange("#000000");return}if(typeof t=="string"){const e=f.normalizeColorValue(t);this.value=e,this.colorInputEl&&(this.colorInputEl.value=e),this.textInputEl&&(this.textInputEl.value=e),this.onChange&&this.onChange(e),this.props.detectChange&&this.props.detectChange(e)}else this.value="#000000",this.colorInputEl&&(this.colorInputEl.value="#000000"),this.textInputEl&&(this.textInputEl.value="#000000"),this.onChange&&this.onChange("#000000"),this.props.detectChange&&this.props.detectChange("#000000")}hexToRgb(t){t=t.replace("#","");const e=parseInt(t.substring(0,2),16),i=parseInt(t.substring(2,4),16),s=parseInt(t.substring(4,6),16);return`${e}, ${i}, ${s}`}draw(){const t=document.createElement("div");if(t.className="color-setting-wrapper "+(this.props.wrapperClassName||""),this.props.title||this.props.icon){const l=document.createElement("div");if(l.className="icon-container",this.props.icon){const h=document.createElement("span");h.className="input-icon",h.innerHTML=this.props.icon,l.appendChild(h)}if(this.props.title){const h=document.createElement("span");h.className="input-label",h.textContent=this.props.title,l.appendChild(h)}t.appendChild(l)}const e=document.createElement("div");e.className="color-input-wrapper";const i=l=>{const h=l.value.trim();if(!h)return e.classList.remove("error"),!0;const u=/^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/.test(h);return u?e.classList.remove("error"):e.classList.add("error"),u},s=document.createElement("input");s.type="color",s.className="color-picker",s.value=this.value||"#000000",s.setAttribute("aria-label","Choose color"),s.setAttribute("title","Click to open color picker"),this.colorInputEl=s;const n=document.createElement("div");n.className="color-preview";const a=this.value||"#000000";n.style.backgroundColor=a;const o=document.createElement("input");return o.type="text",o.className="color-text-input",o.value=this.value||"",o.placeholder="#000000",o.setAttribute("pattern","#[0-9A-Fa-f]{6}"),o.setAttribute("title","Enter a hex color value (e.g., #ff0000)"),o.setAttribute("aria-label","Hex color value"),o.setAttribute("maxlength","7"),this.textInputEl=o,this.textInputEl.addEventListener("input",l=>{var r,u;let h=l.target.value.trim();if(this.textInputEl&&i(this.textInputEl)){const d=f.normalizeColorValue(h);this.value=d,(r=this.onChange)==null||r.call(this,d),(u=this.detectChange)==null||u.call(this,d),this.colorInputEl&&(this.colorInputEl.value=d),n.style.backgroundColor=d}}),this.colorInputEl.addEventListener("input",l=>{var u,d;const h=l.target.value,r=f.normalizeColorValue(h);this.value=r,(u=this.onChange)==null||u.call(this,r),(d=this.detectChange)==null||d.call(this,r),this.textInputEl&&(this.textInputEl.value=r),n.style.backgroundColor=r,e.classList.remove("error")}),this.colorInputEl.addEventListener("change",l=>{var u,d;const h=l.target.value,r=f.normalizeColorValue(h);this.value=r,(u=this.onChange)==null||u.call(this,r),(d=this.detectChange)==null||d.call(this,r),this.textInputEl&&(this.textInputEl.value=r),n.style.backgroundColor=r}),e.appendChild(s),e.appendChild(n),e.appendChild(o),t.appendChild(e),this.element=t,t}getElement(){return this.element}getNormalizedValue(){return this.value?f.normalizeColorValue(this.value):"#000000"}isValidHex(){return this.value?/^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/.test(this.value):!1}toRgb(){return this.isValidHex()?this.hexToRgb(this.value):"0, 0, 0"}}const U=`
|
|
16
16
|
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
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
|
|
20
|
+
</svg>`;class v extends p{constructor(t={}){super({...t,icon:t.icon||U,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}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=v.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),a=parseInt(i.substring(4,6),16);this.colorPreviewEl.style.backgroundColor=`rgba(${s}, ${n}, ${a}, ${e})`}handleColorChange(t){const e=this.getOpacityPercent(),i=v.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=v.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 a=document.createElement("div");if(a.className="icon-container",this.props.icon){const o=document.createElement("span");o.className="input-icon",o.innerHTML=this.props.icon,a.appendChild(o)}if(this.props.title){const o=document.createElement("span");o.className="input-label",o.textContent=this.props.title,a.appendChild(o)}t.appendChild(a)}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.colorInputEl.value=this.getRgbColor(),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.value=this.value||"#000000FF",this.textInputEl.placeholder="#000000FF",this.colorInputEl.addEventListener("input",a=>{const o=a.target;this.handleColorChange(o.value),this.textInputEl&&(this.textInputEl.value=this.value||"#000000FF"),this.updateColorPreview()}),this.textInputEl.addEventListener("input",a=>{const o=a.target;this.handleTextInput(o.value)?(this.colorInputEl&&(this.colorInputEl.value=this.getRgbColor()),this.updateColorPreview(),e.classList.remove("error")):o.value.trim()===""?e.classList.remove("error"):e.classList.add("error")}),this.textInputEl.addEventListener("blur",a=>{const o=a.target;o.value.trim()===""&&(o.value=this.value||"#000000FF",e.classList.remove("error"))}),this.colorPreviewEl.addEventListener("click",()=>{var a;(a=this.colorInputEl)==null||a.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",a=>{const o=a.target,l=parseFloat(o.value);isNaN(l)||(this.handleOpacityChange(l),this.textInputEl&&(this.textInputEl.value=this.value||"#000000FF"),this.updateColorPreview())}),this.opacityInputEl.addEventListener("blur",a=>{const o=a.target;let l=parseFloat(o.value);isNaN(l)&&(l=this.getOpacityPercent()),l=Math.max(0,Math.min(100,l)),o.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(),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),a=parseInt(i.substring(4,6),16);return`rgba(${s}, ${n}, ${a}, ${e})`}getColorAndOpacity(){return{color:this.getRgbColor(),opacity:this.getOpacityPercent()}}}class C 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 a=Number(i.value);a<s&&(a=s),a>n&&(a=n),String(a)!==i.value&&(i.value=String(a)),this.setValue(a)}),i.addEventListener("blur",()=>{var n,a;const s=this.validateValue(Number(i.value));s!==Number(i.value)&&(i.value=String(s),this.setValue(s)),(a=(n=this.props).onBlur)==null||a.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=`
|
|
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
|
|
24
|
+
</svg>`;class A extends C{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 Z=`
|
|
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>
|
|
28
|
-
`;class
|
|
28
|
+
`;class S extends p{constructor(t={}){if(super(t),this.inputType="select",this._options=[],this.isOpen=!1,this.selectedOptionIndex=null,this.optionsListEl=null,this.svgContainer=null,this.buttonEl=null,this.isLoading=!1,this.container=null,this.clickOutsideListener=null,t.options&&(this._options=[...t.options]),t.getOptions&&this._options.push(...t.getOptions()),t.getOptionsAsync&&(this.isLoading=!0),this.value!==void 0){const e=this._options.findIndex(i=>i.value===this.value);e>=0&&(this.selectedOptionIndex=e)}}createOption(t,e){const i=document.createElement("li");return i.classList.add("select-option"),i.textContent=t.name,i.dataset.index=String(e),this.selectedOptionIndex===e&&i.classList.add("selected"),i}draw(){const t=document.createElement("div");if(t.classList.add("select-container"),this.container=t,this.props.icon||this.props.title){const n=document.createElement("div");if(n.className="icon-container",this.props.icon){const a=this.createIcon(this.props.icon);n.appendChild(a)}if(this.props.title){const a=this.createLabel(this.props.title);n.appendChild(a)}t.appendChild(n)}else{const n=document.createElement("div");t.appendChild(n)}const e=document.createElement("div");e.classList.add("select-button"),this.isLoading?e.classList.add("loading"):e.textContent=this.selectedOptionIndex!==null?this._options[this.selectedOptionIndex].name:this.props.placeholder||"Select an option",e.onclick=()=>{var n,a;this.isLoading||(this.isOpen=!this.isOpen,(n=this.optionsListEl)==null||n.classList.toggle("open",this.isOpen),(a=this.svgContainer)==null||a.classList.toggle("open",this.isOpen))},t.appendChild(e),this.buttonEl=e;const i=document.createElement("ul");i.classList.add("select-options"),this._options.forEach((n,a)=>{const o=this.createOption(n,a);o.onclick=l=>this.selectOption(l,a,e),i.appendChild(o)}),t.appendChild(i);const s=document.createElement("div");return s.classList.add("svg-container"),s.innerHTML=Z,t.appendChild(s),this.optionsListEl=i,this.svgContainer=s,this.props.getOptionsAsync&&(this.isLoading=!0,this.updateButtonText(),this.props.getOptionsAsync().then(n=>{this._options.push(...n),this.isLoading=!1,this.updateOptionsList(),this.updateButtonText()}).catch(n=>{console.error("Failed to fetch async options:",n),this.isLoading=!1,this.updateButtonText("Failed to load options")})),this.clickOutsideListener&&document.removeEventListener("click",this.clickOutsideListener),this.clickOutsideListener=n=>{var a,o;this.isOpen&&!t.contains(n.target)&&(this.isOpen=!1,(a=this.optionsListEl)==null||a.classList.remove("open"),(o=this.svgContainer)==null||o.classList.remove("open"))},document.addEventListener("click",this.clickOutsideListener),t}selectOption(t,e,i){var n,a,o;const s=this._options[e];s&&(this.value=s.value,(n=this.onChange)==null||n.call(this,this.value),this.selectedOptionIndex=e,this.isOpen=!1,i.textContent=s.name,(a=this.optionsListEl)==null||a.classList.remove("open"),(o=this.svgContainer)==null||o.classList.remove("open"),this.optionsListEl&&this.optionsListEl.querySelectorAll(".select-option").forEach((h,r)=>{r===e?h.classList.add("selected"):h.classList.remove("selected")}))}updateOptionsList(){if(this.optionsListEl){if(this.optionsListEl.innerHTML="",this._options.length===0){const t=document.createElement("li");t.classList.add("select-option","empty-message"),t.textContent="No options available",this.optionsListEl.appendChild(t);return}this._options.forEach((t,e)=>{const i=this.createOption(t,e);i.onclick=s=>{this.buttonEl&&this.selectOption(s,e,this.buttonEl)},this.optionsListEl.appendChild(i)})}}updateButtonText(t){if(!this.buttonEl)return;if(this.isLoading){this.buttonEl.classList.add("loading"),this.buttonEl.textContent=this.props.loadingText||"Loading options...";return}this.buttonEl.classList.remove("loading","error");let e;t?((t.includes("Failed")||t.includes("Error"))&&this.buttonEl.classList.add("error"),e=t):this.selectedOptionIndex!==null&&this._options[this.selectedOptionIndex]?e=this._options[this.selectedOptionIndex].name:e=this.props.placeholder||"Select an option",this.buttonEl.textContent=e}destroy(){this.clickOutsideListener&&(document.removeEventListener("click",this.clickOutsideListener),this.clickOutsideListener=null),super.destroy()}}class B extends p{constructor(t={}){super(t),this.inputType="button",this.value||(this.value="center")}draw(){const t=document.createElement("div");t.className="align-setting-wrapper";const e=document.createElement("label");e.className="align-setting-label",e.textContent=this.title||"Align",t.appendChild(e);const i=document.createElement("div");return i.className="align-options-container",[{name:"left",icon:`
|
|
29
29
|
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" fill="none">
|
|
30
30
|
<path d="M10.5 7.5C11.1989 7.5 11.5484 7.5 11.824 7.38582C12.1916 7.23358 12.4836 6.94157 12.6358 6.57402C12.75 6.29837 12.75 5.94891 12.75 5.25C12.75 4.55109 12.75 4.20163 12.6358 3.92598C12.4836 3.55843 12.1916 3.26642 11.824 3.11418C11.5484 3 11.1989 3 10.5 3L4.5 3C3.80109 3 3.45163 3 3.17598 3.11418C2.80843 3.26642 2.51642 3.55843 2.36418 3.92597C2.25 4.20163 2.25 4.55109 2.25 5.25C2.25 5.94891 2.25 6.29837 2.36418 6.57402C2.51642 6.94157 2.80843 7.23358 3.17598 7.38582C3.45163 7.5 3.80109 7.5 4.5 7.5L10.5 7.5Z"
|
|
31
31
|
stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"/>
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
<path d="M4.5 9.5H13.5M4.5 9.5L6 7.25M4.5 9.5L6 11.75M13.5 9.5L12 7.25M13.5 9.5L12 11.75M15.75 16.25V2.75M2.25 16.25V2.75" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"/>
|
|
57
57
|
</svg>`,Y=`<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
58
58
|
<path d="M9 14L9 5M9 14L6.75 12.5M9 14L11.25 12.5M9 5L6.75 6.5M9 5L11.25 6.5M15.75 2.75H2.25M15.75 16.25H2.25" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"/>
|
|
59
|
-
</svg>`,
|
|
59
|
+
</svg>`,k=`
|
|
60
60
|
<svg xmlns="http://www.w3.org/2000/svg" width="15" height="16" viewBox="0 0 15 16" fill="none">
|
|
61
61
|
<path d="M5 10.5L7.5 8M7.5 8L10 10.5M7.5 8V13.625M12.5 10.9643C13.2634 10.3338 13.75 9.37996 13.75 8.3125C13.75 6.41402 12.211 4.875 10.3125 4.875C10.1759 4.875 10.0482 4.80375 9.97882 4.68609C9.16379 3.30302 7.65902 2.375 5.9375 2.375C3.34867 2.375 1.25 4.47367 1.25 7.0625C1.25 8.35381 1.77215 9.52317 2.61684 10.371" stroke="#475467" stroke-linecap="round" stroke-linejoin="round"/>
|
|
62
62
|
</svg>
|
|
@@ -70,15 +70,15 @@
|
|
|
70
70
|
<path d="M8 3V2.6C8 2.03995 8 1.75992 7.89101 1.54601C7.79513 1.35785 7.64215 1.20487 7.45399 1.10899C7.24008 1 6.96005 1 6.4 1H5.6C5.03995 1 4.75992 1 4.54601 1.10899C4.35785 1.20487 4.20487 1.35785 4.10899 1.54601C4 1.75992 4 2.03995 4 2.6V3M5 5.75V8.25M7 5.75V8.25M1.5 3H10.5M9.5 3V8.6C9.5 9.44008 9.5 9.86012 9.33651 10.181C9.1927 10.4632 8.96323 10.6927 8.68099 10.8365C8.36012 11 7.94008 11 7.1 11H4.9C4.05992 11 3.63988 11 3.31901 10.8365C3.03677 10.6927 2.8073 10.4632 2.66349 10.181C2.5 9.86012 2.5 9.44008 2.5 8.6V3" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
|
|
71
71
|
</svg>
|
|
72
72
|
`;class R extends p{constructor(t={}){super(t),this.inputType="button",this.previewWrapper=null,this.previewEl=null,this.emptyStateEl=null,this.props.delete===void 0&&(this.props.delete=!0),!this.value&&t.defaultUrl&&t.defaultUrl!==""&&(this.value=t.defaultUrl)}updatePreviewState(t=null){if(!this.previewWrapper||!this.previewEl)return;const e=this.previewWrapper.parentElement,i=e==null?void 0:e.querySelector(".upload-button"),s=e==null?void 0:e.querySelector(".preview-placeholder");t&&t!==""?(this.previewWrapper.classList.add("has-image"),this.previewEl.src=t,this.previewWrapper.style.display="block",this.previewEl.style.display="block",s&&s instanceof HTMLElement&&(s.style.display="none"),e&&e.classList.remove("no-image"),i&&(i.innerHTML=`
|
|
73
|
-
<span class="upload-icon">${
|
|
73
|
+
<span class="upload-icon">${k}</span>
|
|
74
74
|
<span class="upload-label">Replace</span>
|
|
75
75
|
`)):(this.previewWrapper.classList.remove("has-image"),this.previewEl.src="",this.previewEl.style.display="none",this.previewWrapper.style.display="none",s&&s instanceof HTMLElement&&(s.style.display="block"),e&&e.classList.add("no-image"),i&&(i.innerHTML=`
|
|
76
|
-
<span class="upload-icon">${
|
|
76
|
+
<span class="upload-icon">${k}</span>
|
|
77
77
|
<span class="upload-label">Upload</span>
|
|
78
78
|
`))}draw(){const t=document.createElement("div");t.className="upload-setting-wrapper",t.setAttribute("data-setting-id",this.id),t.addEventListener("focusout",l=>{var h;l.relatedTarget&&t.contains(l.relatedTarget)||(h=this.onBlur)==null||h.call(this,this.value??"")},!0);const e=!!(this.props.title||this.props.icon);if(e||t.classList.add("no-label"),e){const l=document.createElement("div");if(l.className="icon-title-container",this.props.icon){const h=this.createIcon(this.props.icon);l.appendChild(h)}if(this.props.title){const h=this.createLabel(this.props.title);l.appendChild(h)}t.appendChild(l)}const i=document.createElement("div");i.className="preview-button-container";const s=this.value&&this.value!=="";s||i.classList.add("no-image");const n=document.createElement("div");if(n.className="preview-placeholder",n.innerHTML=tt,this.previewWrapper=document.createElement("div"),this.previewWrapper.className="preview-wrapper",this.previewEl=document.createElement("img"),this.previewEl.className="upload-preview",this.props.delete){const l=document.createElement("button");l.className="delete-button",l.type="button",l.title="Delete image",l.innerHTML=et,this.previewWrapper.appendChild(l),l.onclick=h=>{var r;h.stopPropagation(),this.value="",o.value="",this.updatePreviewState(null),(r=this.onChange)==null||r.call(this,"")}}this.previewWrapper.appendChild(this.previewEl);const a=document.createElement("button");a.className="upload-button",a.innerHTML=`
|
|
79
|
-
<span class="upload-icon">${
|
|
79
|
+
<span class="upload-icon">${k}</span>
|
|
80
80
|
<span class="upload-label">Upload</span>
|
|
81
|
-
`;const o=document.createElement("input");return o.type="file",o.accept="image/*",o.style.display="none",i.appendChild(n),i.appendChild(this.previewWrapper),i.appendChild(a),t.appendChild(i),t.appendChild(o),s?this.updatePreviewState(this.value):this.updatePreviewState(null),a.onclick=()=>{o.click()},o.onchange=async()=>{var h,r,u;const l=(h=o.files)==null?void 0:h[0];if(l)try{a.classList.add("loading"),a.disabled=!0;const d=new FormData,$=this.props.formFieldName||"file";d.append($,l,l.name);const
|
|
81
|
+
`;const o=document.createElement("input");return o.type="file",o.accept="image/*",o.style.display="none",i.appendChild(n),i.appendChild(this.previewWrapper),i.appendChild(a),t.appendChild(i),t.appendChild(o),s?this.updatePreviewState(this.value):this.updatePreviewState(null),a.onclick=()=>{o.click()},o.onchange=async()=>{var h,r,u;const l=(h=o.files)==null?void 0:h[0];if(l)try{a.classList.add("loading"),a.disabled=!0;const d=new FormData,$=this.props.formFieldName||"file";d.append($,l,l.name);const I=this.props.uploadUrl;if(!I)throw new Error("No uploadUrl provided to UploadSetting.");const F=this.props.requestMethod||"POST",j={...this.props.requestHeaders||{}},E=await(await fetch(I,{method:F,body:d,headers:j})).json();console.log("Upload response:",E);let b;if(this.props.parseResponse)b=this.props.parseResponse(E);else if(b=(r=E==null?void 0:E.data)==null?void 0:r.url,!b)throw new Error("No URL found in response. Provide a parseResponse if needed.");console.log("Final URL:",b),this.value=b,this.updatePreviewState(b),(u=this.onChange)==null||u.call(this,b)}catch(d){console.error("Error uploading file:",d)}finally{a.classList.remove("loading"),a.disabled=!1,o.value=""}else o.value=""},t}}class it extends C{constructor(t={}){const e={title:t.title||"Height",suffix:"px",minValue:t.minValue??0,maxValue:t.maxValue,icon:t.icon||st,...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 st=`<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
82
82
|
<path d="M9 14L9 5M9 14L6.75 12.5M9 14L11.25 12.5M9 5L6.75 6.5M9 5L11.25 6.5M15.75 2.75H2.25M15.75 16.25H2.25" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
|
|
83
83
|
</svg>`;class nt extends C{constructor(t={}){super({title:t.title||"Width",suffix:"px",minValue:t.minValue??0,maxValue:t.maxValue,icon:t.icon||at,...t}),this.inputType="number",this.mobileValue=t.mobile}getMobileValue(){return this.mobileValue}}const at=`<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
84
84
|
<path d="M4.5 9.5H13.5M4.5 9.5L6 7.25M4.5 9.5L6 11.75M13.5 9.5L12 7.25M13.5 9.5L12 11.75M15.75 16.25V2.75M2.25 16.25V2.75" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
|
|
@@ -95,7 +95,7 @@
|
|
|
95
95
|
}
|
|
96
96
|
`,document.head.appendChild(l)}return i.appendChild(s),i.appendChild(n),t.appendChild(i),t}setDetectChange(t){this.detectChangeCallback=t}}const ht=`<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
97
97
|
<path d="M13.3334 5.99996H2.66675M13.3334 9.99996H2.66675M5.33341 12.6666V3.33329M10.6667 12.6666V3.33329" stroke="#667085" stroke-width="1.33333" stroke-linecap="round" stroke-linejoin="round"/>
|
|
98
|
-
</svg>`;class ct extends p{constructor(t={}){t.rowGap=t.rowGap??!0,t.columnGap=t.columnGap??!0,t.title=t.title??"Gap",t.icon=t.icon??ht,t.suffix=t.suffix??"px",t.minValue=t.minValue??0,super(t),this.inputType="number",this.inputValues={},this.mobileValue=t.mobile,this.value=this.validateValue(t.default??0),t.rowGap&&(this.inputValues.row=this.value),t.columnGap&&(this.inputValues.column=this.value)}draw(){const t=document.createElement("div");t.className=`setting-container ${this.props.className||""}`,t.id=this.id;const e=document.createElement("div");e.className="setting-label-input-wrapper";const i=document.createElement("label");i.className="setting-label",i.setAttribute("for",this.id+"-input");const s=document.createElement("span");if(s.textContent=this.props.title??"Gap",i.appendChild(s),this.props.icon){const o=document.createElement("span");o.className="setting-icon",o.innerHTML=this.props.icon,i.insertBefore(o,s)}const n=document.createElement("div");n.className=`setting-input-wrapper ${this.props.wrapperClassName||""}`,n.classList.add("gap-setting-wrapper");const a=document.createElement("div");return a.className="gap-inputs-container",this.props.rowGap&&a.appendChild(this.createGapInput("row","Row")),this.props.columnGap&&a.appendChild(this.createGapInput("column","Col")),n.appendChild(a),e.appendChild(i),e.appendChild(n),t.appendChild(e),t}createGapInput(t,e){const i=document.createElement("div");i.className="gap-input-wrapper";const s=document.createElement("input");if(s.type="number",s.className=`gap-input gap-${t}-input ${this.props.inputClassName||""}`,s.id=`${this.id}-${t}-input`,s.min=String(this.props.minValue??0),this.props.maxValue!==void 0&&(s.max=String(this.props.maxValue)),s.step=String(this.props.step??1),s.value=String(this.inputValues[t]??this.value),s.title=e,s.addEventListener("input",n=>{const a=n.target;let o=parseFloat(a.value);o=this.validateValue(o),String(o)!==a.value&&(a.value=String(o)),this.inputValues[t]=o,this.setValue(o)}),s.addEventListener("blur",n=>{var l,h;const a=n.target;let o=parseFloat(a.value);o=this.validateValue(o),String(o)!==a.value&&(a.value=String(o),this.inputValues[t]=o,this.setValue(o)),(h=(l=this.props).onBlur)==null||h.call(l)}),i.appendChild(s),this.props.suffix&&this.props.suffix!=="none"){const n=document.createElement("span");n.className="gap-suffix",n.textContent=this.props.suffix,i.appendChild(n),s.style.paddingRight="30px"}return i}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)}}class b extends m{constructor(t){var o;if(!t.tabs)throw new Error("Tabs array is required for TabsSettings");const e=t.tabs,i=t.activeTabId||((o=e[0])==null?void 0:o.id)||"",s=e.find(l=>l.id===i),n=s?s.settings:{},a={title:t.title||"",settings:n,collapsed:t.collapsed,main:t.main,description:t.description,icon:t.icon,custom:t.custom,hideCondition:t.hideCondition,onBlur:t.onBlur};super(a),this.tabs=[],this.activeTabId="",this.tabsContainer=null,this.previousTabId="",this.container=null,this.tabValues={},this.internalChangeTimeout=null,this.isHandlingInternalChange=!1,this.INTERNAL_CHANGE_DEBOUNCE=50,this.tabs=e,this.activeTabId=i,this.previousTabId=i,this.onStateChangeCallback=t.onStateChange,this.detectChangeCallback=t.detectChange,this.initializeTabValues(),this.connectChildChangeHandlers()}updateSettingsFromTab(t){const e=this.tabs.find(i=>i.id===t);e&&(this.settings=e.settings,this.tabValues[t]=this.getTabValues(e),this.initialValues={tabs:this.tabValues,activeTabId:this.activeTabId},Object.values(e.settings).forEach(i=>{i instanceof b&&(i._parentTabsSettings=this)}),this.connectChildChangeHandlers())}connectChildChangeHandlers(){if(!this.settings)return;const t=()=>{Promise.resolve().then(()=>{if(this.activeTabId){const e=this.tabs.find(i=>i.id===this.activeTabId);e&&(this.tabValues[this.activeTabId]=this.getTabValues(e))}this.initialValues={tabs:this.tabValues,activeTabId:this.activeTabId},this.triggerDebouncedChange()})};Object.values(this.settings).forEach(e=>{e instanceof m?e.setOnChange(()=>{t()}):e instanceof p&&e.setOnChange(()=>{t()})}),this.tabs.forEach(e=>{Object.entries(e.settings).forEach(([i,s])=>{(s instanceof m||s instanceof p)&&(s instanceof b?(s._parentTabsSettings=this,s.setOnChange(n=>{Promise.resolve().then(()=>{this.tabValues[e.id]=this.getTabValues(e),this.triggerDebouncedChange()})})):s instanceof m?s.setOnChange(()=>{Promise.resolve().then(()=>{this.tabValues[e.id]=this.getTabValues(e),this.triggerDebouncedChange()})}):s instanceof p&&s.setOnChange(()=>{Promise.resolve().then(()=>{this.tabValues[e.id]=this.getTabValues(e),this.triggerDebouncedChange()})}))})})}draw(){const t=super.draw();this.container=t,t.classList.add("tabs-settings-container");const e=document.createElement("div");e.classList.add("tabs-header"),this.main&&e.classList.add("main-header"),this.tabsContainer=e,this.tabs.forEach(s=>{const n=document.createElement("button");n.classList.add("tab-button"),s.id===this.activeTabId&&n.classList.add("active"),n.textContent=s.label,n.onclick=()=>this.handleTabClick(s.id),e.appendChild(n)});const i=t.querySelector(".setting-group-content");return i&&t.insertBefore(e,i),t}handleTabClick(t){var o,l;if(t===this.activeTabId)return;const e=this.tabs.find(h=>h.id===this.activeTabId);e&&(this.tabValues[this.activeTabId]=this.getTabValues(e)),this.previousTabId=this.activeTabId,this.activeTabId=t;const i=(o=this.tabsContainer)==null?void 0:o.querySelectorAll(".tab-button");i==null||i.forEach(h=>{if(h instanceof HTMLElement){const r=this.tabs.find(u=>u.label===h.textContent);h.classList.toggle("active",(r==null?void 0:r.id)===t)}}),this.updateSettingsFromTab(t);const s=(l=this.container)==null?void 0:l.querySelector(".setting-group-content");if(s){s.innerHTML="";const h=this.settings;Object.values(h).forEach(r=>{s.appendChild(r.draw())})}const n=this.getValues();this.initialValues={tabs:this.tabValues,activeTabId:this.activeTabId},this.connectChildChangeHandlers(),this.onStateChangeCallback&&this.onStateChangeCallback(t,n),this.detectChangeCallback&&this.detectChangeCallback(t,n),this.onChange&&this.onChange(n);const a=this.findParentTabsSettings();a&&a.onChange&&a.onChange(a.getValues())}findParentTabsSettings(){return this._parentTabsSettings||null}setOnStateChange(t){return this.onStateChangeCallback=t,this}setDetectChange(t){return this.detectChangeCallback=t,this}getActiveTabId(){return this.activeTabId}getValues(){return this.updateTabValues(),{tabs:this.tabValues,activeTabId:this.activeTabId}}updateTabValues(){!this.tabs||this.tabs.length===0||this.tabs.forEach(t=>{this.tabValues[t.id]=this.getTabValues(t)})}propagateChanges(){const t=this.findParentTabsSettings();t&&(t.updateTabValues(),t.triggerDebouncedChange())}triggerDebouncedChange(){this.isHandlingInternalChange||(this.isHandlingInternalChange=!0,this.internalChangeTimeout&&clearTimeout(this.internalChangeTimeout),this.internalChangeTimeout=setTimeout(()=>{this.onChange&&this.onChange(this.getValues()),this.isHandlingInternalChange=!1,this.internalChangeTimeout=null;const t=this.findParentTabsSettings();t&&t.triggerDebouncedChange()},this.INTERNAL_CHANGE_DEBOUNCE))}updateInitialValues(){!this.tabs||this.tabs.length===0||(this.updateTabValues(),this.initialValues={tabs:this.tabValues,activeTabId:this.activeTabId},this.tabs.forEach(t=>{Object.values(t.settings).forEach(e=>{e instanceof b&&e.updateInitialValues()})}))}setOnChange(t){return this.onChange=t,this.connectChildChangeHandlers(),this.updateTabValues(),this}initializeTabValues(){!this.tabs||this.tabs.length===0||(this.tabs.forEach(t=>{this.tabValues[t.id]=this.getTabValues(t)}),this.initialValues={tabs:this.tabValues,activeTabId:this.activeTabId})}getTabValues(t){const e={};return Object.entries(t.settings).forEach(([i,s])=>{s instanceof b||s instanceof m?e[i]=s.getValues():(s instanceof p,e[i]=s.value)}),e}clone(){const t=this.tabs.map(i=>{const s={};return Object.entries(i.settings).forEach(([n,a])=>{typeof a.clone=="function"?s[n]=a.clone():(console.warn(`Setting with key '${n}' in tab '${i.id}' does not have a clone method. Copying reference.`),s[n]=a)}),{...i,settings:s}}),e={title:this.title,tabs:t,activeTabId:this.activeTabId,collapsed:this.isCollapsed,main:this.isMain,description:this.description,icon:this.icon,custom:this.custom,hideCondition:this.hideCondition,settings:{}};return new b(e)}setValue(t){if(t&&typeof t=="object"){let e=!1;if(t.activeTabId&&t.activeTabId!==this.activeTabId&&(this.previousTabId=this.activeTabId,this.activeTabId=t.activeTabId,e=!0),t.tabs&&typeof t.tabs=="object"&&Object.entries(t.tabs).forEach(([i,s])=>{const n=this.tabs.find(a=>a.id===i);n&&s&&typeof s=="object"&&Object.entries(s).forEach(([a,o])=>{n.settings[a]&&typeof n.settings[a].setValue=="function"&&n.settings[a].setValue(o)})}),this.updateTabValues(),this.triggerDebouncedChange(),this.container){if(this.updateSettingsFromTab(this.activeTabId),this.tabsContainer){const s=this.tabsContainer.querySelectorAll(".tab-button");s==null||s.forEach(n=>{if(n instanceof HTMLElement){const a=this.tabs.find(o=>o.label===n.textContent);n.classList.toggle("active",(a==null?void 0:a.id)===this.activeTabId)}})}const i=this.container.querySelector(".setting-group-content");if(i){i.innerHTML="";const s=this.settings;Object.values(s).forEach(n=>{i.appendChild(n.draw())})}e&&this.onStateChangeCallback&&this.onStateChangeCallback(this.activeTabId,this.getValues())}this.initialValues={tabs:this.tabValues,activeTabId:this.activeTabId}}}updateTabSetting(t,e,i){const s=this.tabs.find(a=>a.id===t);if(!s||!s.settings[e])return;const n=s.settings[e];typeof n.setValue=="function"&&(n.setValue(i),this.tabValues[t]=this.getTabValues(s),t!==this.activeTabId&&this.onChange&&this.onChange(this.getValues()))}getTabsConfiguration(){return this.tabs}}const ut=`<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
98
|
+
</svg>`;class ct extends p{constructor(t={}){t.rowGap=t.rowGap??!0,t.columnGap=t.columnGap??!0,t.title=t.title??"Gap",t.icon=t.icon??ht,t.suffix=t.suffix??"px",t.minValue=t.minValue??0,super(t),this.inputType="number",this.inputValues={},this.mobileValue=t.mobile,this.value=this.validateValue(t.default??0),t.rowGap&&(this.inputValues.row=this.value),t.columnGap&&(this.inputValues.column=this.value)}draw(){const t=document.createElement("div");t.className=`setting-container ${this.props.className||""}`,t.id=this.id;const e=document.createElement("div");e.className="setting-label-input-wrapper";const i=document.createElement("label");i.className="setting-label",i.setAttribute("for",this.id+"-input");const s=document.createElement("span");if(s.textContent=this.props.title??"Gap",i.appendChild(s),this.props.icon){const o=document.createElement("span");o.className="setting-icon",o.innerHTML=this.props.icon,i.insertBefore(o,s)}const n=document.createElement("div");n.className=`setting-input-wrapper ${this.props.wrapperClassName||""}`,n.classList.add("gap-setting-wrapper");const a=document.createElement("div");return a.className="gap-inputs-container",this.props.rowGap&&a.appendChild(this.createGapInput("row","Row")),this.props.columnGap&&a.appendChild(this.createGapInput("column","Col")),n.appendChild(a),e.appendChild(i),e.appendChild(n),t.appendChild(e),t}createGapInput(t,e){const i=document.createElement("div");i.className="gap-input-wrapper";const s=document.createElement("input");if(s.type="number",s.className=`gap-input gap-${t}-input ${this.props.inputClassName||""}`,s.id=`${this.id}-${t}-input`,s.min=String(this.props.minValue??0),this.props.maxValue!==void 0&&(s.max=String(this.props.maxValue)),s.step=String(this.props.step??1),s.value=String(this.inputValues[t]??this.value),s.title=e,s.addEventListener("input",n=>{const a=n.target;let o=parseFloat(a.value);o=this.validateValue(o),String(o)!==a.value&&(a.value=String(o)),this.inputValues[t]=o,this.setValue(o)}),s.addEventListener("blur",n=>{var l,h;const a=n.target;let o=parseFloat(a.value);o=this.validateValue(o),String(o)!==a.value&&(a.value=String(o),this.inputValues[t]=o,this.setValue(o)),(h=(l=this.props).onBlur)==null||h.call(l)}),i.appendChild(s),this.props.suffix&&this.props.suffix!=="none"){const n=document.createElement("span");n.className="gap-suffix",n.textContent=this.props.suffix,i.appendChild(n),s.style.paddingRight="30px"}return i}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)}}class w extends m{constructor(t){var o;if(!t.tabs)throw new Error("Tabs array is required for TabsSettings");const e=t.tabs,i=t.activeTabId||((o=e[0])==null?void 0:o.id)||"",s=e.find(l=>l.id===i),n=s?s.settings:{},a={title:t.title||"",settings:n,collapsed:t.collapsed,main:t.main,description:t.description,icon:t.icon,custom:t.custom,hideCondition:t.hideCondition,onBlur:t.onBlur};super(a),this.tabs=[],this.activeTabId="",this.tabsContainer=null,this.previousTabId="",this.container=null,this.tabValues={},this.internalChangeTimeout=null,this.isHandlingInternalChange=!1,this.INTERNAL_CHANGE_DEBOUNCE=50,this.tabs=e,this.activeTabId=i,this.previousTabId=i,this.onStateChangeCallback=t.onStateChange,this.detectChangeCallback=t.detectChange,this.initializeTabValues(),this.connectChildChangeHandlers()}updateSettingsFromTab(t){const e=this.tabs.find(i=>i.id===t);e&&(this.settings=e.settings,this.tabValues[t]=this.getTabValues(e),this.initialValues={tabs:this.tabValues,activeTabId:this.activeTabId},Object.values(e.settings).forEach(i=>{i instanceof w&&(i._parentTabsSettings=this)}),this.connectChildChangeHandlers())}connectChildChangeHandlers(){if(!this.settings)return;const t=()=>{Promise.resolve().then(()=>{if(this.activeTabId){const e=this.tabs.find(i=>i.id===this.activeTabId);e&&(this.tabValues[this.activeTabId]=this.getTabValues(e))}this.initialValues={tabs:this.tabValues,activeTabId:this.activeTabId},this.triggerDebouncedChange()})};Object.values(this.settings).forEach(e=>{e instanceof m?e.setOnChange(()=>{t()}):e instanceof p&&e.setOnChange(()=>{t()})}),this.tabs.forEach(e=>{Object.entries(e.settings).forEach(([i,s])=>{(s instanceof m||s instanceof p)&&(s instanceof w?(s._parentTabsSettings=this,s.setOnChange(n=>{Promise.resolve().then(()=>{this.tabValues[e.id]=this.getTabValues(e),this.triggerDebouncedChange()})})):s instanceof m?s.setOnChange(()=>{Promise.resolve().then(()=>{this.tabValues[e.id]=this.getTabValues(e),this.triggerDebouncedChange()})}):s instanceof p&&s.setOnChange(()=>{Promise.resolve().then(()=>{this.tabValues[e.id]=this.getTabValues(e),this.triggerDebouncedChange()})}))})})}draw(){const t=super.draw();this.container=t,t.classList.add("tabs-settings-container");const e=document.createElement("div");e.classList.add("tabs-header"),this.main&&e.classList.add("main-header"),this.tabsContainer=e,this.tabs.forEach(s=>{const n=document.createElement("button");n.classList.add("tab-button"),s.id===this.activeTabId&&n.classList.add("active"),n.textContent=s.label,n.onclick=()=>this.handleTabClick(s.id),e.appendChild(n)});const i=t.querySelector(".setting-group-content");return i&&t.insertBefore(e,i),t}handleTabClick(t){var o,l;if(t===this.activeTabId)return;const e=this.tabs.find(h=>h.id===this.activeTabId);e&&(this.tabValues[this.activeTabId]=this.getTabValues(e)),this.previousTabId=this.activeTabId,this.activeTabId=t;const i=(o=this.tabsContainer)==null?void 0:o.querySelectorAll(".tab-button");i==null||i.forEach(h=>{if(h instanceof HTMLElement){const r=this.tabs.find(u=>u.label===h.textContent);h.classList.toggle("active",(r==null?void 0:r.id)===t)}}),this.updateSettingsFromTab(t);const s=(l=this.container)==null?void 0:l.querySelector(".setting-group-content");if(s){s.innerHTML="";const h=this.settings;Object.values(h).forEach(r=>{s.appendChild(r.draw())})}const n=this.getValues();this.initialValues={tabs:this.tabValues,activeTabId:this.activeTabId},this.connectChildChangeHandlers(),this.onStateChangeCallback&&this.onStateChangeCallback(t,n),this.detectChangeCallback&&this.detectChangeCallback(t,n),this.onChange&&this.onChange(n);const a=this.findParentTabsSettings();a&&a.onChange&&a.onChange(a.getValues())}findParentTabsSettings(){return this._parentTabsSettings||null}setOnStateChange(t){return this.onStateChangeCallback=t,this}setDetectChange(t){return this.detectChangeCallback=t,this}getActiveTabId(){return this.activeTabId}getValues(){return this.updateTabValues(),{tabs:this.tabValues,activeTabId:this.activeTabId}}updateTabValues(){!this.tabs||this.tabs.length===0||this.tabs.forEach(t=>{this.tabValues[t.id]=this.getTabValues(t)})}propagateChanges(){const t=this.findParentTabsSettings();t&&(t.updateTabValues(),t.triggerDebouncedChange())}triggerDebouncedChange(){this.isHandlingInternalChange||(this.isHandlingInternalChange=!0,this.internalChangeTimeout&&clearTimeout(this.internalChangeTimeout),this.internalChangeTimeout=setTimeout(()=>{this.onChange&&this.onChange(this.getValues()),this.isHandlingInternalChange=!1,this.internalChangeTimeout=null;const t=this.findParentTabsSettings();t&&t.triggerDebouncedChange()},this.INTERNAL_CHANGE_DEBOUNCE))}updateInitialValues(){!this.tabs||this.tabs.length===0||(this.updateTabValues(),this.initialValues={tabs:this.tabValues,activeTabId:this.activeTabId},this.tabs.forEach(t=>{Object.values(t.settings).forEach(e=>{e instanceof w&&e.updateInitialValues()})}))}setOnChange(t){return this.onChange=t,this.connectChildChangeHandlers(),this.updateTabValues(),this}initializeTabValues(){!this.tabs||this.tabs.length===0||(this.tabs.forEach(t=>{this.tabValues[t.id]=this.getTabValues(t)}),this.initialValues={tabs:this.tabValues,activeTabId:this.activeTabId})}getTabValues(t){const e={};return Object.entries(t.settings).forEach(([i,s])=>{s instanceof w||s instanceof m?e[i]=s.getValues():(s instanceof p,e[i]=s.value)}),e}clone(){const t=this.tabs.map(i=>{const s={};return Object.entries(i.settings).forEach(([n,a])=>{typeof a.clone=="function"?s[n]=a.clone():(console.warn(`Setting with key '${n}' in tab '${i.id}' does not have a clone method. Copying reference.`),s[n]=a)}),{...i,settings:s}}),e={title:this.title,tabs:t,activeTabId:this.activeTabId,collapsed:this.isCollapsed,main:this.isMain,description:this.description,icon:this.icon,custom:this.custom,hideCondition:this.hideCondition,settings:{}};return new w(e)}setValue(t){if(t&&typeof t=="object"){let e=!1;if(t.activeTabId&&t.activeTabId!==this.activeTabId&&(this.previousTabId=this.activeTabId,this.activeTabId=t.activeTabId,e=!0),t.tabs&&typeof t.tabs=="object"&&Object.entries(t.tabs).forEach(([i,s])=>{const n=this.tabs.find(a=>a.id===i);n&&s&&typeof s=="object"&&Object.entries(s).forEach(([a,o])=>{n.settings[a]&&typeof n.settings[a].setValue=="function"&&n.settings[a].setValue(o)})}),this.updateTabValues(),this.triggerDebouncedChange(),this.container){if(this.updateSettingsFromTab(this.activeTabId),this.tabsContainer){const s=this.tabsContainer.querySelectorAll(".tab-button");s==null||s.forEach(n=>{if(n instanceof HTMLElement){const a=this.tabs.find(o=>o.label===n.textContent);n.classList.toggle("active",(a==null?void 0:a.id)===this.activeTabId)}})}const i=this.container.querySelector(".setting-group-content");if(i){i.innerHTML="";const s=this.settings;Object.values(s).forEach(n=>{i.appendChild(n.draw())})}e&&this.onStateChangeCallback&&this.onStateChangeCallback(this.activeTabId,this.getValues())}this.initialValues={tabs:this.tabValues,activeTabId:this.activeTabId}}}updateTabSetting(t,e,i){const s=this.tabs.find(a=>a.id===t);if(!s||!s.settings[e])return;const n=s.settings[e];typeof n.setValue=="function"&&(n.setValue(i),this.tabValues[t]=this.getTabValues(s),t!==this.activeTabId&&this.onChange&&this.onChange(this.getValues()))}getTabsConfiguration(){return this.tabs}}const ut=`<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
99
99
|
<path d="M2.25 11.75H15.75M5.85 2.75H12.15C13.4101 2.75 14.0402 2.75 14.5215 2.99524C14.9448 3.21095 15.289 3.55516 15.5048 3.97852C15.75 4.45982 15.75 5.08988 15.75 6.35V12.65C15.75 13.9101 15.75 14.5402 15.5048 15.0215C15.289 15.4448 14.9448 15.789 14.5215 16.0048C14.0402 16.25 13.4101 16.25 12.15 16.25H5.85C4.58988 16.25 3.95982 16.25 3.47852 16.0048C3.05516 15.789 2.71095 15.4448 2.49524 15.0215C2.25 14.5402 2.25 13.9101 2.25 12.65V6.35C2.25 5.08988 2.25 4.45982 2.49524 3.97852C2.71095 3.55516 3.05516 3.21095 3.47852 2.99524C3.95982 2.75 4.58988 2.75 5.85 2.75Z" stroke="#667085" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
100
100
|
</svg>`;class dt extends C{constructor(t={}){super({...t,minValue:t.minValue??0,maxValue:t.maxValue??1e3,icon:t.icon||ut,title:t.title||"Margin Bottom",default:t.default??20,wrapperClassName:"margin-bottom-wrapper "+(t.wrapperClassName||"")}),this.inputType="number"}}const pt=`
|
|
101
101
|
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
@@ -105,11 +105,10 @@
|
|
|
105
105
|
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
106
106
|
<path d="M6 2.75H5.85C4.58988 2.75 3.95982 2.75 3.47852 2.99524C3.05516 3.21095 2.71095 3.55516 2.49524 3.97852C2.25 4.45982 2.25 5.08988 2.25 6.35V6.5M6 16.25H5.85C4.58988 16.25 3.95982 16.25 3.47852 16.0048C3.05516 15.789 2.71095 15.4448 2.49524 15.0215C2.25 14.5402 2.25 13.9101 2.25 12.65V12.5M15.75 6.5V6.35C15.75 5.08988 15.75 4.45982 15.5048 3.97852C15.289 3.55516 14.9448 3.21095 14.5215 2.99524C14.0402 2.75 13.4101 2.75 12.15 2.75H12M15.75 12.5V12.65C15.75 13.9101 15.75 14.5402 15.5048 15.0215C15.289 15.4448 14.9448 15.789 14.5215 16.0048C14.0402 16.25 13.4101 16.25 12.15 16.25H12" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
|
|
107
107
|
</svg>
|
|
108
|
-
`;class mt extends m{constructor(t){super({title:"Border",collapsed:t==null?void 0:t.collapsed,hideCondition:t==null?void 0:t.hideCondition,settings:{size:new C({title:"Size",icon:gt,default:(t==null?void 0:t.size)??0,suffix:"px"}),color:new
|
|
108
|
+
`;class mt extends m{constructor(t){super({title:"Border",collapsed:t==null?void 0:t.collapsed,hideCondition:t==null?void 0:t.hideCondition,settings:{size:new C({title:"Size",icon:gt,default:(t==null?void 0:t.size)??0,suffix:"px"}),color:new v({default:(t==null?void 0:t.color)??"0, 0, 30"}),radius:new C({title:"Radius",icon:pt,default:(t==null?void 0:t.radius)??12,suffix:"px"})}})}getCssCode(){const t=this.settings.color.value??"#000000",e=this.settings.radius.value??0,i=this.settings.size.value??0;return`
|
|
109
109
|
border-color: ${t};
|
|
110
|
-
border-width: ${
|
|
111
|
-
border-radius: ${
|
|
112
|
-
opacity: ${e/100};
|
|
110
|
+
border-width: ${i}px;
|
|
111
|
+
border-radius: ${e}px;
|
|
113
112
|
`}}const ft=`
|
|
114
113
|
<svg xmlns="http://www.w3.org/2000/svg" width="14" height="13" viewBox="0 0 14 13" fill="none">
|
|
115
114
|
<path d="M1 2.75C1 2.05109 1 1.70163 1.11418 1.42597C1.26642 1.05843 1.55843 0.766422 1.92597 0.614181C2.20163 0.5 2.55109 0.5 3.25 0.5H10.75C11.4489 0.5 11.7984 0.5 12.074 0.614181C12.4416 0.766422 12.7336 1.05843 12.8858 1.42597C13 1.70163 13 2.05109 13 2.75M4.75 12.5H9.25M7 0.5V12.5" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
|
|
@@ -122,14 +121,13 @@
|
|
|
122
121
|
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
123
122
|
<path d="M6 5.75H12M9 5.75V13.25M5.85 16.25H12.15C13.4101 16.25 14.0402 16.25 14.5215 16.0048C14.9448 15.789 15.289 15.4448 15.5048 15.0215C15.75 14.5402 15.75 13.9101 15.75 12.65V6.35C15.75 5.08988 15.75 4.45982 15.5048 3.97852C15.289 3.55516 14.9448 3.21095 14.5215 2.99524C14.0402 2.75 13.4101 2.75 12.15 2.75H5.85C4.58988 2.75 3.95982 2.75 3.47852 2.99524C3.05516 3.21095 2.71095 3.55516 2.49524 3.97852C2.25 4.45982 2.25 5.08988 2.25 6.35V12.65C2.25 13.9101 2.25 14.5402 2.49524 15.0215C2.71095 15.4448 3.05516 15.789 3.47852 16.0048C3.95982 16.25 4.58988 16.25 5.85 16.25Z" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
|
|
124
123
|
</svg>
|
|
125
|
-
`;class bt extends m{constructor(t={}){super({title:t.title||"Typography",collapsed:t.collapsed,hideCondition:t.hideCondition,settings:{color:new
|
|
124
|
+
`;class bt extends m{constructor(t={}){super({title:t.title||"Typography",collapsed:t.collapsed,hideCondition:t.hideCondition,settings:{color:new v({default:t.colorDefault??"0, 0, 30"}),fontFamily:new S({title:"Font",icon:ft,default:t.fontFamilyDefault??"Satoshi",options:t.fontFamilyOptions??[{name:"Alt",value:"Croco Sans Black Caps Alt"},{name:"Regular",value:"Croco Sans Caps Regular"},{name:"Caps",value:"Croco Sans Black Caps"}],getOptions:t.fontFamilyGetOptions,getOptionsAsync:t.fontFamilyGetOptionsAsync}),fontWeight:new S({title:"Weight",icon:Ct,default:t.fontWeightDefault??"400",options:t.fontWeightOptions??[{name:"Regular",value:"400"},{name:"Medium",value:"500"},{name:"Bold",value:"600"}],getOptions:t.fontWeightGetOptions,getOptionsAsync:t.fontWeightGetOptionsAsync}),fontSize:new C({title:"Size",icon:vt,default:t.fontSizeDefault??12,suffix:"px",mobile:t.fontSizeMobileDefault}),align:new B({title:"Align",default:t.alignDefault??"center"})}})}getCssCode(){const t=this.settings.color.value??"#000000",e=this.settings.fontFamily.value??"Satoshi",i=this.settings.fontWeight.value??"bold",s=this.settings.fontSize.value??12,n=this.settings.align.value??"left";return`
|
|
126
125
|
color: ${t};
|
|
127
|
-
|
|
128
|
-
font-
|
|
129
|
-
font-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
`}}class L extends p{constructor(t){super({...t,default:t.default!==void 0?t.default:"auto"}),this.inputType="number",this.value=t.default!==void 0?t.default:"auto"}draw(){const t=this.value==="auto"?"text":"number",e=o=>{this.value!=="auto"&&(this.props.minValue!==void 0&&(o.min=String(this.props.minValue)),this.props.maxValue!==void 0&&(o.max=String(this.props.maxValue)),this.props.className&&o.classList.add(this.props.className),o.addEventListener("input",()=>{const l=this.props.minValue??Number.MIN_SAFE_INTEGER,h=this.props.maxValue??Number.MAX_SAFE_INTEGER;let r=Number(o.value);r<l&&(r=l),r>h&&(r=h),o.value=String(r)}))},i=this.createInput({value:this.value,inputType:t,title:this.props.title,icon:this.props.icon,inputClassName:"number-setting-input "+(this.props.inputClassName||""),wrapperClassName:"number-setting-wrapper "+(this.props.wrapperClassName||""),inputCustomizer:e,placeholder:this.value==="auto"?"auto":""});if(!this.props.suffix||this.props.suffix==="none")return i;i.classList.add("suffix-wrapper");const s=i.querySelector("input.number-setting-input");s&&(s.style.paddingRight="35px");const n=document.createElement("span");n.className="suffix-label",n.textContent=this.props.suffix,i.appendChild(n);const a=i.querySelector("input");return a&&(a.oninput=o=>{const l=o.target.value.trim();if(l.toLowerCase()==="auto")this.value="auto";else{const h=Number(l);isNaN(h)||(this.value=h)}this.onChange&&this.onChange(this.value)}),i}}class wt extends m{constructor(t){super({title:"Margins",collapsed:t==null?void 0:t.collapsed,hideCondition:t==null?void 0:t.hideCondition,settings:{marginTop:new L({title:"Top",icon:Et,suffix:"px",default:(t==null?void 0:t.marginTop)??"auto"}),marginRight:new L({title:"Right",icon:xt,suffix:"px",default:(t==null?void 0:t.marginRight)??0}),marginBottom:new L({title:"Bottom",icon:yt,suffix:"px",default:(t==null?void 0:t.marginBottom)??0}),marginLeft:new L({title:"Left",icon:Lt,suffix:"px",default:(t==null?void 0:t.marginLeft)??0})}})}getCssCode(){const t=typeof this.settings.marginTop.value=="number"?`${this.settings.marginTop.value}px`:this.settings.marginTop.value,e=typeof this.settings.marginRight.value=="number"?`${this.settings.marginRight.value}px`:this.settings.marginRight.value,i=typeof this.settings.marginBottom.value=="number"?`${this.settings.marginBottom.value}px`:this.settings.marginBottom.value,s=typeof this.settings.marginLeft.value=="number"?`${this.settings.marginLeft.value}px`:this.settings.marginLeft.value;return`
|
|
126
|
+
font-family: ${e};
|
|
127
|
+
font-weight: ${i};
|
|
128
|
+
font-size: ${s}px;
|
|
129
|
+
text-align: ${n};
|
|
130
|
+
`}}class y extends p{constructor(t){super({...t,default:t.default!==void 0?t.default:"auto"}),this.inputType="number",this.value=t.default!==void 0?t.default:"auto"}draw(){const t=this.value==="auto"?"text":"number",e=o=>{this.value!=="auto"&&(this.props.minValue!==void 0&&(o.min=String(this.props.minValue)),this.props.maxValue!==void 0&&(o.max=String(this.props.maxValue)),this.props.className&&o.classList.add(this.props.className),o.addEventListener("input",()=>{const l=this.props.minValue??Number.MIN_SAFE_INTEGER,h=this.props.maxValue??Number.MAX_SAFE_INTEGER;let r=Number(o.value);r<l&&(r=l),r>h&&(r=h),o.value=String(r)}))},i=this.createInput({value:this.value,inputType:t,title:this.props.title,icon:this.props.icon,inputClassName:"number-setting-input "+(this.props.inputClassName||""),wrapperClassName:"number-setting-wrapper "+(this.props.wrapperClassName||""),inputCustomizer:e,placeholder:this.value==="auto"?"auto":""});if(!this.props.suffix||this.props.suffix==="none")return i;i.classList.add("suffix-wrapper");const s=i.querySelector("input.number-setting-input");s&&(s.style.paddingRight="35px");const n=document.createElement("span");n.className="suffix-label",n.textContent=this.props.suffix,i.appendChild(n);const a=i.querySelector("input");return a&&(a.oninput=o=>{const l=o.target.value.trim();if(l.toLowerCase()==="auto")this.value="auto";else{const h=Number(l);isNaN(h)||(this.value=h)}this.onChange&&this.onChange(this.value)}),i}}class wt extends m{constructor(t){super({title:"Margins",collapsed:t==null?void 0:t.collapsed,hideCondition:t==null?void 0:t.hideCondition,settings:{marginTop:new y({title:"Top",icon:Et,suffix:"px",default:(t==null?void 0:t.marginTop)??"auto"}),marginRight:new y({title:"Right",icon:xt,suffix:"px",default:(t==null?void 0:t.marginRight)??0}),marginBottom:new y({title:"Bottom",icon:yt,suffix:"px",default:(t==null?void 0:t.marginBottom)??0}),marginLeft:new y({title:"Left",icon:Lt,suffix:"px",default:(t==null?void 0:t.marginLeft)??0})}})}getCssCode(){const t=typeof this.settings.marginTop.value=="number"?`${this.settings.marginTop.value}px`:this.settings.marginTop.value,e=typeof this.settings.marginRight.value=="number"?`${this.settings.marginRight.value}px`:this.settings.marginRight.value,i=typeof this.settings.marginBottom.value=="number"?`${this.settings.marginBottom.value}px`:this.settings.marginBottom.value,s=typeof this.settings.marginLeft.value=="number"?`${this.settings.marginLeft.value}px`:this.settings.marginLeft.value;return`
|
|
133
131
|
margin-top: ${t};
|
|
134
132
|
margin-right: ${e};
|
|
135
133
|
margin-bottom: ${i};
|
|
@@ -142,15 +140,14 @@
|
|
|
142
140
|
<path d="M2.25 2.75H2.2575M2.25 9.5H2.2575M2.25 12.875H2.2575M2.25 6.125H2.2575M5.625 2.75H5.6325M5.625 9.5H5.6325M12.375 2.75H12.3825M12.375 9.5H12.3825M9 2.75H9.0075M9 9.5H9.0075M9 12.875H9.0075M9 6.125H9.0075M15.75 2.75H15.7575M15.75 9.5H15.7575M15.75 12.875H15.7575M15.75 6.125H15.7575M15.75 16.25H2.25" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
|
|
143
141
|
</svg>`,Lt=`<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
144
142
|
<path d="M5.625 2.75H5.6325M5.625 9.5H5.6325M5.625 16.25H5.6325M12.375 2.75H12.3825M12.375 9.5H12.3825M12.375 16.25H12.3825M9 2.75H9.0075M9 9.5H9.0075M9 16.25H9.0075M9 12.875H9.0075M9 6.125H9.0075M15.75 2.75H15.7575M15.75 9.5H15.7575M15.75 16.25H15.7575M15.75 12.875H15.7575M15.75 6.125H15.7575M2.25 16.25V2.75" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
|
|
145
|
-
</svg>`;class Vt extends m{constructor(t){super({title:"Background Image",collapsed:t==null?void 0:t.collapsed,hideCondition:t==null?void 0:t.hideCondition,settings:{backgroundImage:new R({...t==null?void 0:t.uploadProps,default:(t==null?void 0:t.backgroundImage)??""}),opacity:new
|
|
143
|
+
</svg>`;class Vt extends m{constructor(t){super({title:"Background Image",collapsed:t==null?void 0:t.collapsed,hideCondition:t==null?void 0:t.hideCondition,settings:{backgroundImage:new R({...t==null?void 0:t.uploadProps,default:(t==null?void 0:t.backgroundImage)??""}),opacity:new A({default:(t==null?void 0:t.opacity)??100}),backgroundColor:new v({default:(t==null?void 0:t.backgroundColor)??"0, 0, 30"})}})}draw(){const t=super.draw(),e=t.querySelector(".setting-group-content");if(!e)return t;const i=Array.from(e.children),[s,n,a]=i;e.innerHTML="",e.appendChild(s),e.appendChild(n);const o=document.createElement("div");return o.className="bgset-or-label",o.textContent="OR",e.appendChild(o),e.appendChild(a),t}getCssCode(){const t=this.settings.backgroundImage.value||"",e=this.settings.opacity.value??100,i=this.settings.backgroundColor.value||"#000000";return t?`
|
|
146
144
|
background-image: url("${t}");
|
|
147
145
|
background-size: cover;
|
|
148
146
|
background-position: center;
|
|
149
147
|
opacity: ${e/100};
|
|
150
148
|
`:`
|
|
151
149
|
background-color: ${i};
|
|
152
|
-
|
|
153
|
-
`}}class kt extends m{constructor(t,e,i){super({title:`Tab ${t+1}`,hideCondition:i==null?void 0:i.hideCondition,collapsed:i==null?void 0:i.collapsed,settings:{name:new k({title:"Tab Name",default:`Tab ${t+1}`}),content:new k({title:"Content",default:""})}}),this.onDeleteCallback=e}draw(){const t=super.draw(),e=t.querySelector(".setting-group-arrow");e&&e.parentElement&&e.parentElement.removeChild(e);const i=t.querySelector(".setting-group-title");if(i){const s=document.createElement("div");s.className="tab-delete-container";const n=document.createElement("button");n.className="tab-delete-button",n.innerHTML=`
|
|
150
|
+
`}}class kt extends m{constructor(t,e,i){super({title:`Tab ${t+1}`,hideCondition:i==null?void 0:i.hideCondition,collapsed:i==null?void 0:i.collapsed,settings:{name:new V({title:"Tab Name",default:`Tab ${t+1}`}),content:new V({title:"Content",default:""})}}),this.onDeleteCallback=e}draw(){const t=super.draw(),e=t.querySelector(".setting-group-arrow");e&&e.parentElement&&e.parentElement.removeChild(e);const i=t.querySelector(".setting-group-title");if(i){const s=document.createElement("div");s.className="tab-delete-container";const n=document.createElement("button");n.className="tab-delete-button",n.innerHTML=`
|
|
154
151
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="#f87171" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="trash-icon">
|
|
155
152
|
<polyline points="3 6 5 6 21 6"></polyline>
|
|
156
153
|
<path d="M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6"></path>
|
|
@@ -171,4 +168,4 @@
|
|
|
171
168
|
</svg>
|
|
172
169
|
</span>
|
|
173
170
|
<span class="add-label">Add Tab</span>
|
|
174
|
-
`,i.onclick=()=>{this.addTab(),this.rerender()},e.appendChild(i),t.appendChild(e),t}rerender(){if(!this._el)return;const t=this._el.querySelector(".setting-group-content");t&&(t.innerHTML="",Object.keys(this.settings).forEach(e=>{const i=this.settings[e];t.appendChild(i.draw())}))}}function St(c){return c instanceof m}function It(c){return c instanceof p}exports.AlignSetting=
|
|
171
|
+
`,i.onclick=()=>{this.addTab(),this.rerender()},e.appendChild(i),t.appendChild(e),t}rerender(){if(!this._el)return;const t=this._el.querySelector(".setting-group-content");t&&(t.innerHTML="",Object.keys(this.settings).forEach(e=>{const i=this.settings[e];t.appendChild(i.draw())}))}}function St(c){return c instanceof m}function It(c){return c instanceof p}exports.AlignSetting=B;exports.BackgroundSettingSet=Vt;exports.BorderSettingSet=mt;exports.ButtonSetting=X;exports.ColorSetting=f;exports.ColorWithOpacitySetting=v;exports.DimensionSetting=K;exports.GapSetting=ct;exports.HeaderTypographySettingSet=bt;exports.HeightSetting=it;exports.MarginBottomSetting=dt;exports.MarginSettingGroup=wt;exports.NumberSetting=C;exports.OpacitySetting=A;exports.SelectApiSettings=lt;exports.SelectSetting=S;exports.Setting=p;exports.SettingGroup=m;exports.StringSetting=V;exports.TabsContainerGroup=Mt;exports.TabsSettings=w;exports.Toggle=rt;exports.UploadSetting=R;exports.WidthSetting=nt;exports.asSettingGroupWithSettings=z;exports.createSettingGroup=O;exports.isSetting=It;exports.isSettingGroup=St;exports.iterateSettings=x;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
const
|
|
2
|
-
let
|
|
1
|
+
const R = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
|
|
2
|
+
let T = (c = 21) => {
|
|
3
3
|
let t = "", e = crypto.getRandomValues(new Uint8Array(c |= 0));
|
|
4
4
|
for (; c--; )
|
|
5
|
-
t +=
|
|
5
|
+
t += R[e[c] & 63];
|
|
6
6
|
return t;
|
|
7
7
|
};
|
|
8
|
-
function
|
|
8
|
+
function y(c) {
|
|
9
9
|
if (c === null || typeof c != "object")
|
|
10
10
|
return c;
|
|
11
11
|
if (c instanceof Date)
|
|
@@ -13,16 +13,16 @@ function L(c) {
|
|
|
13
13
|
if (Array.isArray(c)) {
|
|
14
14
|
const i = [];
|
|
15
15
|
for (let s = 0; s < c.length; s++)
|
|
16
|
-
i[s] =
|
|
16
|
+
i[s] = y(c[s]);
|
|
17
17
|
return i;
|
|
18
18
|
}
|
|
19
19
|
const t = {};
|
|
20
20
|
for (const i in c)
|
|
21
|
-
Object.prototype.hasOwnProperty.call(c, i) && (t[i] =
|
|
21
|
+
Object.prototype.hasOwnProperty.call(c, i) && (t[i] = y(c[i]));
|
|
22
22
|
const e = Object.getPrototypeOf(c);
|
|
23
23
|
return e !== Object.prototype && Object.setPrototypeOf(t, e), t;
|
|
24
24
|
}
|
|
25
|
-
function
|
|
25
|
+
function $(c) {
|
|
26
26
|
switch (c) {
|
|
27
27
|
case "number":
|
|
28
28
|
return 0;
|
|
@@ -42,7 +42,7 @@ function F(c) {
|
|
|
42
42
|
}
|
|
43
43
|
class p {
|
|
44
44
|
constructor(t = {}) {
|
|
45
|
-
this.props = t, this.id = t.id ||
|
|
45
|
+
this.props = t, this.id = t.id || T(), this.value = this.props.default, this.desktop = this.props.default, this.title = t.title || "";
|
|
46
46
|
}
|
|
47
47
|
destroy() {
|
|
48
48
|
throw new Error("Method not implemented.");
|
|
@@ -58,8 +58,8 @@ class p {
|
|
|
58
58
|
}
|
|
59
59
|
// Basic clone method
|
|
60
60
|
clone() {
|
|
61
|
-
const t = this.constructor, e =
|
|
62
|
-
return i.value =
|
|
61
|
+
const t = this.constructor, e = y(this.props), i = new t(e);
|
|
62
|
+
return i.value = y(this.value), i;
|
|
63
63
|
}
|
|
64
64
|
createInput(t) {
|
|
65
65
|
t = { ...this.props.inputProps, ...t };
|
|
@@ -79,7 +79,7 @@ class p {
|
|
|
79
79
|
const i = document.createElement("div");
|
|
80
80
|
i.className = t.wrapperClassName || "";
|
|
81
81
|
const s = document.createElement("input");
|
|
82
|
-
this.inputEl = s, s.value = String(t.value ||
|
|
82
|
+
this.inputEl = s, s.value = String(t.value || $(t.inputType)), s.type = t.inputType, s.placeholder = t.placeholder || "", s.className = t.inputClassName || "";
|
|
83
83
|
const n = (o) => {
|
|
84
84
|
const l = o.target;
|
|
85
85
|
let h = l.value;
|
|
@@ -120,31 +120,31 @@ class p {
|
|
|
120
120
|
return i.className = "input-icon " + (e || ""), i.innerHTML = t, i;
|
|
121
121
|
}
|
|
122
122
|
}
|
|
123
|
-
function
|
|
123
|
+
function S(c) {
|
|
124
124
|
let t = 0, e = c.parentElement;
|
|
125
125
|
for (; e; )
|
|
126
126
|
e.classList.contains("setting-group") && e !== c && t++, e = e.parentElement;
|
|
127
127
|
return t;
|
|
128
128
|
}
|
|
129
|
-
function
|
|
129
|
+
function k(c, t) {
|
|
130
130
|
const e = Math.min(Math.max(t, 0), 5);
|
|
131
131
|
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 = "");
|
|
132
132
|
}
|
|
133
|
-
function
|
|
133
|
+
function H(c, t = 0) {
|
|
134
134
|
c.querySelectorAll(":scope > .setting-group-content > .setting-group").forEach((i) => {
|
|
135
135
|
const s = i, n = t + 1;
|
|
136
|
-
|
|
136
|
+
k(s, n), H(s, n);
|
|
137
137
|
});
|
|
138
138
|
}
|
|
139
|
-
const
|
|
139
|
+
const F = {
|
|
140
140
|
maxLevel: 5,
|
|
141
141
|
spacingMultiplier: 1,
|
|
142
142
|
visualIndentMultiplier: 2,
|
|
143
143
|
enableAutoDetection: !0
|
|
144
144
|
};
|
|
145
|
-
class
|
|
145
|
+
class j {
|
|
146
146
|
constructor(t = {}) {
|
|
147
|
-
this.observedElements = /* @__PURE__ */ new Set(), this.config = { ...
|
|
147
|
+
this.observedElements = /* @__PURE__ */ new Set(), this.config = { ...F, ...t }, this.config.enableAutoDetection && this.setupAutoDetection();
|
|
148
148
|
}
|
|
149
149
|
/**
|
|
150
150
|
* Setup automatic detection using MutationObserver
|
|
@@ -178,7 +178,7 @@ class G {
|
|
|
178
178
|
* Update nesting for a specific element
|
|
179
179
|
*/
|
|
180
180
|
updateElementNesting(t) {
|
|
181
|
-
const e =
|
|
181
|
+
const e = S(t);
|
|
182
182
|
this.applyNestingWithConfig(t, e);
|
|
183
183
|
}
|
|
184
184
|
/**
|
|
@@ -226,8 +226,8 @@ class G {
|
|
|
226
226
|
this.observer && (this.observer.disconnect(), this.observer = void 0), this.observedElements.clear();
|
|
227
227
|
}
|
|
228
228
|
}
|
|
229
|
-
const P = new
|
|
230
|
-
function
|
|
229
|
+
const P = new j();
|
|
230
|
+
function x(c, t) {
|
|
231
231
|
for (const e in c)
|
|
232
232
|
if (c.hasOwnProperty(e)) {
|
|
233
233
|
const i = c[e];
|
|
@@ -237,14 +237,14 @@ function E(c, t) {
|
|
|
237
237
|
const g = class g {
|
|
238
238
|
constructor(t) {
|
|
239
239
|
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.lastValues = {}, this.lastChangeTime = 0, this.CHANGE_DEBOUNCE = 100, this.handleBlur = () => {
|
|
240
|
-
}, this.pendingBlurHandler = null, this.originalDefaultValues = {}, this.nestingLevel = 0, this.parentNestingLevel = 0, this.id = t.id ||
|
|
240
|
+
}, this.pendingBlurHandler = null, this.originalDefaultValues = {}, this.nestingLevel = 0, this.parentNestingLevel = 0, this.id = t.id || T(), 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();
|
|
241
241
|
}
|
|
242
242
|
/**
|
|
243
243
|
* Propagate nesting level to child setting groups
|
|
244
244
|
*/
|
|
245
245
|
propagateNestingLevel() {
|
|
246
246
|
const t = this.nestingLevel + 1;
|
|
247
|
-
|
|
247
|
+
x(this.settings, (e, i) => {
|
|
248
248
|
i instanceof g && (i.parentNestingLevel = this.nestingLevel, i.nestingLevel = t, i.propagateNestingLevel());
|
|
249
249
|
});
|
|
250
250
|
}
|
|
@@ -264,14 +264,14 @@ const g = class g {
|
|
|
264
264
|
* Update nesting styles on the rendered element
|
|
265
265
|
*/
|
|
266
266
|
updateNestingStyles() {
|
|
267
|
-
this.elementRef && (
|
|
267
|
+
this.elementRef && (k(this.elementRef, this.nestingLevel), H(this.elementRef, this.nestingLevel));
|
|
268
268
|
}
|
|
269
269
|
/**
|
|
270
270
|
* Auto-detect nesting level from DOM position
|
|
271
271
|
*/
|
|
272
272
|
autoDetectNestingLevel() {
|
|
273
273
|
if (!this.elementRef) return;
|
|
274
|
-
const t =
|
|
274
|
+
const t = S(this.elementRef);
|
|
275
275
|
t !== this.nestingLevel && this.setNestingLevel(t);
|
|
276
276
|
}
|
|
277
277
|
static hide() {
|
|
@@ -295,7 +295,7 @@ const g = class g {
|
|
|
295
295
|
Object.keys(s).length > 0 && (this.lastChangeTime = Date.now(), this.initialValues = i, t(i), this.updateVisibility()), this.isHandlingChange = !1;
|
|
296
296
|
}, 50));
|
|
297
297
|
};
|
|
298
|
-
return this.changeHandlers.clear(),
|
|
298
|
+
return this.changeHandlers.clear(), x(this.settings, (i, s) => {
|
|
299
299
|
var n;
|
|
300
300
|
if (s instanceof g)
|
|
301
301
|
s.setOnChange((a) => {
|
|
@@ -330,7 +330,7 @@ const g = class g {
|
|
|
330
330
|
"focusout",
|
|
331
331
|
this.handleBlur,
|
|
332
332
|
!0
|
|
333
|
-
),
|
|
333
|
+
), x(this.settings, (t, e) => {
|
|
334
334
|
e instanceof g && e.setOnBlur(() => {
|
|
335
335
|
this.onBlur && this.onBlur();
|
|
336
336
|
});
|
|
@@ -344,7 +344,7 @@ const g = class g {
|
|
|
344
344
|
}
|
|
345
345
|
clone() {
|
|
346
346
|
const t = {};
|
|
347
|
-
|
|
347
|
+
x(this.settings, (s, n) => {
|
|
348
348
|
typeof n.clone == "function" ? t[s] = n.clone() : (console.warn(
|
|
349
349
|
`Setting with key '${s}' does not have a clone method. Copying reference.`
|
|
350
350
|
), t[s] = n);
|
|
@@ -359,7 +359,7 @@ const g = class g {
|
|
|
359
359
|
custom: this.custom,
|
|
360
360
|
hideCondition: this.hideCondition,
|
|
361
361
|
parentNestingLevel: this.parentNestingLevel
|
|
362
|
-
}, i =
|
|
362
|
+
}, i = G(e);
|
|
363
363
|
return i.initialValues = this.getValues(), i;
|
|
364
364
|
}
|
|
365
365
|
setValue(t) {
|
|
@@ -463,7 +463,7 @@ const g = class g {
|
|
|
463
463
|
}
|
|
464
464
|
draw() {
|
|
465
465
|
const t = document.createElement("div");
|
|
466
|
-
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"),
|
|
466
|
+
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"), k(t, this.nestingLevel);
|
|
467
467
|
const e = document.createElement("div");
|
|
468
468
|
e.className = "setting-group-title", this.isCollapsed && e.classList.add("collapsed-view"), e.setAttribute("role", "button"), e.setAttribute(
|
|
469
469
|
"aria-expanded",
|
|
@@ -589,13 +589,13 @@ const g = class g {
|
|
|
589
589
|
};
|
|
590
590
|
g.hiddenElements = /* @__PURE__ */ new Set();
|
|
591
591
|
let m = g;
|
|
592
|
-
function
|
|
592
|
+
function G(c) {
|
|
593
593
|
return new m(c);
|
|
594
594
|
}
|
|
595
595
|
function mt(c) {
|
|
596
596
|
return c;
|
|
597
597
|
}
|
|
598
|
-
class
|
|
598
|
+
class M extends p {
|
|
599
599
|
constructor(t = {}) {
|
|
600
600
|
super(t), this.inputType = "text", t.onChange && this.setOnChange(t.onChange);
|
|
601
601
|
}
|
|
@@ -615,12 +615,12 @@ class I extends p {
|
|
|
615
615
|
});
|
|
616
616
|
}
|
|
617
617
|
}
|
|
618
|
-
const
|
|
619
|
-
class f extends
|
|
618
|
+
const W = "<svg xmlns='http://www.w3.org/2000/svg' width='18' height='19' viewBox='0 0 18 19' fill='none'><path d='M8.99999 15.8542C9.79613 16.5667 10.8475 17 12 17C14.4853 17 16.5 14.9853 16.5 12.5C16.5 10.4248 15.0953 8.67769 13.1849 8.15763M4.81513 8.15762C2.9047 8.67768 1.5 10.4248 1.5 12.5C1.5 14.9853 3.51472 17 6 17C8.48528 17 10.5 14.9853 10.5 12.5C10.5 11.9146 10.3882 11.3554 10.1849 10.8424M13.5 6.5C13.5 8.98528 11.4853 11 9 11C6.51472 11 4.5 8.98528 4.5 6.5C4.5 4.01472 6.51472 2 9 2C11.4853 2 13.5 4.01472 13.5 6.5Z' stroke='#667085' stroke-linecap='round' stroke-linejoin='round'/></svg>";
|
|
619
|
+
class f extends M {
|
|
620
620
|
constructor(t) {
|
|
621
621
|
super({
|
|
622
622
|
...t,
|
|
623
|
-
icon: t.icon ||
|
|
623
|
+
icon: t.icon || W,
|
|
624
624
|
title: t.title || "Color",
|
|
625
625
|
default: t.default ? f.normalizeColorValue(t.default) : "#000000"
|
|
626
626
|
}), this.inputType = "color", this.element = null, this.colorInputEl = null, this.textInputEl = null, this.detectChange = t.detectChange;
|
|
@@ -719,17 +719,17 @@ class f extends I {
|
|
|
719
719
|
return this.isValidHex() ? this.hexToRgb(this.value) : "0, 0, 0";
|
|
720
720
|
}
|
|
721
721
|
}
|
|
722
|
-
const
|
|
722
|
+
const D = `
|
|
723
723
|
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
724
724
|
<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"/>
|
|
725
725
|
<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"/>
|
|
726
726
|
<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"/>
|
|
727
727
|
</svg>`;
|
|
728
|
-
class
|
|
728
|
+
class b extends p {
|
|
729
729
|
constructor(t = {}) {
|
|
730
730
|
super({
|
|
731
731
|
...t,
|
|
732
|
-
icon: t.icon ||
|
|
732
|
+
icon: t.icon || D,
|
|
733
733
|
title: t.title || "Color & Opacity",
|
|
734
734
|
default: t.default || "#000000FF"
|
|
735
735
|
}), this.inputType = "color", this.element = null, this.colorInputEl = null, this.textInputEl = null, this.opacityInputEl = null, this.colorPreviewEl = null, this.detectChange = t.detectChange;
|
|
@@ -750,7 +750,7 @@ class y extends p {
|
|
|
750
750
|
return `#${i}${n}`;
|
|
751
751
|
}
|
|
752
752
|
setValue(t) {
|
|
753
|
-
t === void 0 || t === "" ? this.value = "#000000FF" : this.value =
|
|
753
|
+
t === void 0 || t === "" ? this.value = "#000000FF" : this.value = b.normalizeHexWithOpacity(t), this.updateInputElements(), this.updateColorPreview(), this.onChange && this.onChange(this.value), this.detectChange && this.detectChange(this.value);
|
|
754
754
|
}
|
|
755
755
|
updateInputElements() {
|
|
756
756
|
this.value && (this.colorInputEl && (this.colorInputEl.value = this.getRgbColor()), this.textInputEl && (this.textInputEl.value = this.value), this.opacityInputEl && (this.opacityInputEl.value = this.getOpacityPercent().toString()));
|
|
@@ -761,7 +761,7 @@ class y extends p {
|
|
|
761
761
|
this.colorPreviewEl.style.backgroundColor = `rgba(${s}, ${n}, ${a}, ${e})`;
|
|
762
762
|
}
|
|
763
763
|
handleColorChange(t) {
|
|
764
|
-
const e = this.getOpacityPercent(), i =
|
|
764
|
+
const e = this.getOpacityPercent(), i = b.combineColorOpacity(t, e);
|
|
765
765
|
this.setValue(i);
|
|
766
766
|
}
|
|
767
767
|
handleTextInput(t) {
|
|
@@ -769,7 +769,7 @@ class y extends p {
|
|
|
769
769
|
return e || i ? (this.setValue(t), !0) : !1;
|
|
770
770
|
}
|
|
771
771
|
handleOpacityChange(t) {
|
|
772
|
-
const e = this.getRgbColor(), i = Math.max(0, Math.min(100, t)), s =
|
|
772
|
+
const e = this.getRgbColor(), i = Math.max(0, Math.min(100, t)), s = b.combineColorOpacity(e, i);
|
|
773
773
|
this.setValue(s);
|
|
774
774
|
}
|
|
775
775
|
draw() {
|
|
@@ -891,12 +891,12 @@ class C extends p {
|
|
|
891
891
|
);
|
|
892
892
|
}
|
|
893
893
|
}
|
|
894
|
-
const
|
|
894
|
+
const _ = `
|
|
895
895
|
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
896
896
|
<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"/>
|
|
897
897
|
<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"/>
|
|
898
898
|
</svg>`;
|
|
899
|
-
class
|
|
899
|
+
class z extends C {
|
|
900
900
|
constructor(t = {}) {
|
|
901
901
|
const e = {
|
|
902
902
|
title: "Opacity",
|
|
@@ -905,7 +905,7 @@ class V extends C {
|
|
|
905
905
|
maxValue: 100,
|
|
906
906
|
step: 1,
|
|
907
907
|
default: t.default ?? 100,
|
|
908
|
-
icon:
|
|
908
|
+
icon: _,
|
|
909
909
|
...t
|
|
910
910
|
};
|
|
911
911
|
super(e), this.inputType = "number", this.mobileValue = t.mobile;
|
|
@@ -922,7 +922,7 @@ const q = `
|
|
|
922
922
|
<polyline points="6 9 12 15 18 9"></polyline>
|
|
923
923
|
</svg>
|
|
924
924
|
`;
|
|
925
|
-
class
|
|
925
|
+
class N extends p {
|
|
926
926
|
constructor(t = {}) {
|
|
927
927
|
if (super(t), this.inputType = "select", this._options = [], this.isOpen = !1, this.selectedOptionIndex = null, this.optionsListEl = null, this.svgContainer = null, this.buttonEl = null, this.isLoading = !1, this.container = null, this.clickOutsideListener = null, t.options && (this._options = [...t.options]), t.getOptions && this._options.push(...t.getOptions()), t.getOptionsAsync && (this.isLoading = !0), this.value !== void 0) {
|
|
928
928
|
const e = this._options.findIndex((i) => i.value === this.value);
|
|
@@ -1188,7 +1188,7 @@ const J = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBo
|
|
|
1188
1188
|
<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"/>
|
|
1189
1189
|
</svg>`, Z = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
1190
1190
|
<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"/>
|
|
1191
|
-
</svg>`,
|
|
1191
|
+
</svg>`, V = `
|
|
1192
1192
|
<svg xmlns="http://www.w3.org/2000/svg" width="15" height="16" viewBox="0 0 15 16" fill="none">
|
|
1193
1193
|
<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"/>
|
|
1194
1194
|
</svg>
|
|
@@ -1212,10 +1212,10 @@ class Q extends p {
|
|
|
1212
1212
|
".preview-placeholder"
|
|
1213
1213
|
);
|
|
1214
1214
|
t && t !== "" ? (this.previewWrapper.classList.add("has-image"), this.previewEl.src = t, this.previewWrapper.style.display = "block", this.previewEl.style.display = "block", s && s instanceof HTMLElement && (s.style.display = "none"), e && e.classList.remove("no-image"), i && (i.innerHTML = `
|
|
1215
|
-
<span class="upload-icon">${
|
|
1215
|
+
<span class="upload-icon">${V}</span>
|
|
1216
1216
|
<span class="upload-label">Replace</span>
|
|
1217
1217
|
`)) : (this.previewWrapper.classList.remove("has-image"), this.previewEl.src = "", this.previewEl.style.display = "none", this.previewWrapper.style.display = "none", s && s instanceof HTMLElement && (s.style.display = "block"), e && e.classList.add("no-image"), i && (i.innerHTML = `
|
|
1218
|
-
<span class="upload-icon">${
|
|
1218
|
+
<span class="upload-icon">${V}</span>
|
|
1219
1219
|
<span class="upload-label">Upload</span>
|
|
1220
1220
|
`));
|
|
1221
1221
|
}
|
|
@@ -1257,7 +1257,7 @@ class Q extends p {
|
|
|
1257
1257
|
this.previewWrapper.appendChild(this.previewEl);
|
|
1258
1258
|
const a = document.createElement("button");
|
|
1259
1259
|
a.className = "upload-button", a.innerHTML = `
|
|
1260
|
-
<span class="upload-icon">${
|
|
1260
|
+
<span class="upload-icon">${V}</span>
|
|
1261
1261
|
<span class="upload-label">Upload</span>
|
|
1262
1262
|
`;
|
|
1263
1263
|
const o = document.createElement("input");
|
|
@@ -1269,21 +1269,21 @@ class Q extends p {
|
|
|
1269
1269
|
if (l)
|
|
1270
1270
|
try {
|
|
1271
1271
|
a.classList.add("loading"), a.disabled = !0;
|
|
1272
|
-
const d = new FormData(),
|
|
1273
|
-
d.append(
|
|
1274
|
-
const
|
|
1275
|
-
if (!
|
|
1272
|
+
const d = new FormData(), O = this.props.formFieldName || "file";
|
|
1273
|
+
d.append(O, l, l.name);
|
|
1274
|
+
const I = this.props.uploadUrl;
|
|
1275
|
+
if (!I)
|
|
1276
1276
|
throw new Error("No uploadUrl provided to UploadSetting.");
|
|
1277
|
-
const A = this.props.requestMethod || "POST",
|
|
1277
|
+
const A = this.props.requestMethod || "POST", B = { ...this.props.requestHeaders || {} }, E = await (await fetch(I, {
|
|
1278
1278
|
method: A,
|
|
1279
1279
|
body: d,
|
|
1280
|
-
headers:
|
|
1280
|
+
headers: B
|
|
1281
1281
|
})).json();
|
|
1282
|
-
console.log("Upload response:",
|
|
1282
|
+
console.log("Upload response:", E);
|
|
1283
1283
|
let v;
|
|
1284
1284
|
if (this.props.parseResponse)
|
|
1285
|
-
v = this.props.parseResponse(
|
|
1286
|
-
else if (v = (r =
|
|
1285
|
+
v = this.props.parseResponse(E);
|
|
1286
|
+
else if (v = (r = E == null ? void 0 : E.data) == null ? void 0 : r.url, !v)
|
|
1287
1287
|
throw new Error(
|
|
1288
1288
|
"No URL found in response. Provide a parseResponse if needed."
|
|
1289
1289
|
);
|
|
@@ -1589,7 +1589,7 @@ class xt extends p {
|
|
|
1589
1589
|
this.mobileValue = t, t !== void 0 && this.setValue(t);
|
|
1590
1590
|
}
|
|
1591
1591
|
}
|
|
1592
|
-
class
|
|
1592
|
+
class w extends m {
|
|
1593
1593
|
constructor(t) {
|
|
1594
1594
|
var o;
|
|
1595
1595
|
if (!t.tabs)
|
|
@@ -1613,7 +1613,7 @@ class b extends m {
|
|
|
1613
1613
|
tabs: this.tabValues,
|
|
1614
1614
|
activeTabId: this.activeTabId
|
|
1615
1615
|
}, Object.values(e.settings).forEach((i) => {
|
|
1616
|
-
i instanceof
|
|
1616
|
+
i instanceof w && (i._parentTabsSettings = this);
|
|
1617
1617
|
}), this.connectChildChangeHandlers());
|
|
1618
1618
|
}
|
|
1619
1619
|
connectChildChangeHandlers() {
|
|
@@ -1638,7 +1638,7 @@ class b extends m {
|
|
|
1638
1638
|
});
|
|
1639
1639
|
}), this.tabs.forEach((e) => {
|
|
1640
1640
|
Object.entries(e.settings).forEach(([i, s]) => {
|
|
1641
|
-
(s instanceof m || s instanceof p) && (s instanceof
|
|
1641
|
+
(s instanceof m || s instanceof p) && (s instanceof w ? (s._parentTabsSettings = this, s.setOnChange((n) => {
|
|
1642
1642
|
Promise.resolve().then(() => {
|
|
1643
1643
|
this.tabValues[e.id] = this.getTabValues(e), this.triggerDebouncedChange();
|
|
1644
1644
|
});
|
|
@@ -1733,7 +1733,7 @@ class b extends m {
|
|
|
1733
1733
|
activeTabId: this.activeTabId
|
|
1734
1734
|
}, this.tabs.forEach((t) => {
|
|
1735
1735
|
Object.values(t.settings).forEach((e) => {
|
|
1736
|
-
e instanceof
|
|
1736
|
+
e instanceof w && e.updateInitialValues();
|
|
1737
1737
|
});
|
|
1738
1738
|
}));
|
|
1739
1739
|
}
|
|
@@ -1751,7 +1751,7 @@ class b extends m {
|
|
|
1751
1751
|
getTabValues(t) {
|
|
1752
1752
|
const e = {};
|
|
1753
1753
|
return Object.entries(t.settings).forEach(([i, s]) => {
|
|
1754
|
-
s instanceof
|
|
1754
|
+
s instanceof w || s instanceof m ? e[i] = s.getValues() : (s instanceof p, e[i] = s.value);
|
|
1755
1755
|
}), e;
|
|
1756
1756
|
}
|
|
1757
1757
|
clone() {
|
|
@@ -1777,7 +1777,7 @@ class b extends m {
|
|
|
1777
1777
|
hideCondition: this.hideCondition,
|
|
1778
1778
|
settings: {}
|
|
1779
1779
|
};
|
|
1780
|
-
return new
|
|
1780
|
+
return new w(
|
|
1781
1781
|
e
|
|
1782
1782
|
);
|
|
1783
1783
|
}
|
|
@@ -1833,7 +1833,7 @@ class b extends m {
|
|
|
1833
1833
|
const st = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
1834
1834
|
<path d="M2.25 11.75H15.75M5.85 2.75H12.15C13.4101 2.75 14.0402 2.75 14.5215 2.99524C14.9448 3.21095 15.289 3.55516 15.5048 3.97852C15.75 4.45982 15.75 5.08988 15.75 6.35V12.65C15.75 13.9101 15.75 14.5402 15.5048 15.0215C15.289 15.4448 14.9448 15.789 14.5215 16.0048C14.0402 16.25 13.4101 16.25 12.15 16.25H5.85C4.58988 16.25 3.95982 16.25 3.47852 16.0048C3.05516 15.789 2.71095 15.4448 2.49524 15.0215C2.25 14.5402 2.25 13.9101 2.25 12.65V6.35C2.25 5.08988 2.25 4.45982 2.49524 3.97852C2.71095 3.55516 3.05516 3.21095 3.47852 2.99524C3.95982 2.75 4.58988 2.75 5.85 2.75Z" stroke="#667085" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
1835
1835
|
</svg>`;
|
|
1836
|
-
class
|
|
1836
|
+
class Lt extends C {
|
|
1837
1837
|
constructor(t = {}) {
|
|
1838
1838
|
super({
|
|
1839
1839
|
...t,
|
|
@@ -1855,7 +1855,7 @@ const nt = `
|
|
|
1855
1855
|
<path d="M6 2.75H5.85C4.58988 2.75 3.95982 2.75 3.47852 2.99524C3.05516 3.21095 2.71095 3.55516 2.49524 3.97852C2.25 4.45982 2.25 5.08988 2.25 6.35V6.5M6 16.25H5.85C4.58988 16.25 3.95982 16.25 3.47852 16.0048C3.05516 15.789 2.71095 15.4448 2.49524 15.0215C2.25 14.5402 2.25 13.9101 2.25 12.65V12.5M15.75 6.5V6.35C15.75 5.08988 15.75 4.45982 15.5048 3.97852C15.289 3.55516 14.9448 3.21095 14.5215 2.99524C14.0402 2.75 13.4101 2.75 12.15 2.75H12M15.75 12.5V12.65C15.75 13.9101 15.75 14.5402 15.5048 15.0215C15.289 15.4448 14.9448 15.789 14.5215 16.0048C14.0402 16.25 13.4101 16.25 12.15 16.25H12" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
|
|
1856
1856
|
</svg>
|
|
1857
1857
|
`;
|
|
1858
|
-
class
|
|
1858
|
+
class yt extends m {
|
|
1859
1859
|
constructor(t) {
|
|
1860
1860
|
super({
|
|
1861
1861
|
title: "Border",
|
|
@@ -1868,14 +1868,9 @@ class Lt extends m {
|
|
|
1868
1868
|
default: (t == null ? void 0 : t.size) ?? 0,
|
|
1869
1869
|
suffix: "px"
|
|
1870
1870
|
}),
|
|
1871
|
-
color: new
|
|
1871
|
+
color: new b({
|
|
1872
1872
|
default: (t == null ? void 0 : t.color) ?? "0, 0, 30"
|
|
1873
1873
|
}),
|
|
1874
|
-
opacity: new V({
|
|
1875
|
-
default: (t == null ? void 0 : t.opacity) ?? 100,
|
|
1876
|
-
minValue: 0,
|
|
1877
|
-
maxValue: 100
|
|
1878
|
-
}),
|
|
1879
1874
|
radius: new C({
|
|
1880
1875
|
title: "Radius",
|
|
1881
1876
|
icon: nt,
|
|
@@ -1889,12 +1884,11 @@ class Lt extends m {
|
|
|
1889
1884
|
* Optional helper to generate CSS from the current settings.
|
|
1890
1885
|
*/
|
|
1891
1886
|
getCssCode() {
|
|
1892
|
-
const t = this.settings.color.value ?? "#000000", e = this.settings.
|
|
1887
|
+
const t = this.settings.color.value ?? "#000000", e = this.settings.radius.value ?? 0, i = this.settings.size.value ?? 0;
|
|
1893
1888
|
return `
|
|
1894
1889
|
border-color: ${t};
|
|
1895
|
-
border-width: ${
|
|
1896
|
-
border-radius: ${
|
|
1897
|
-
opacity: ${e / 100};
|
|
1890
|
+
border-width: ${i}px;
|
|
1891
|
+
border-radius: ${e}px;
|
|
1898
1892
|
`;
|
|
1899
1893
|
}
|
|
1900
1894
|
}
|
|
@@ -1918,13 +1912,10 @@ class Vt extends m {
|
|
|
1918
1912
|
collapsed: t.collapsed,
|
|
1919
1913
|
hideCondition: t.hideCondition,
|
|
1920
1914
|
settings: {
|
|
1921
|
-
color: new
|
|
1915
|
+
color: new b({
|
|
1922
1916
|
default: t.colorDefault ?? "0, 0, 30"
|
|
1923
1917
|
}),
|
|
1924
|
-
|
|
1925
|
-
default: t.colorOpacityDefault ?? 100
|
|
1926
|
-
}),
|
|
1927
|
-
fontFamily: new T({
|
|
1918
|
+
fontFamily: new N({
|
|
1928
1919
|
title: "Font",
|
|
1929
1920
|
icon: ot,
|
|
1930
1921
|
default: t.fontFamilyDefault ?? "Satoshi",
|
|
@@ -1936,7 +1927,7 @@ class Vt extends m {
|
|
|
1936
1927
|
getOptions: t.fontFamilyGetOptions,
|
|
1937
1928
|
getOptionsAsync: t.fontFamilyGetOptionsAsync
|
|
1938
1929
|
}),
|
|
1939
|
-
fontWeight: new
|
|
1930
|
+
fontWeight: new N({
|
|
1940
1931
|
title: "Weight",
|
|
1941
1932
|
icon: lt,
|
|
1942
1933
|
default: t.fontWeightDefault ?? "400",
|
|
@@ -1963,18 +1954,17 @@ class Vt extends m {
|
|
|
1963
1954
|
});
|
|
1964
1955
|
}
|
|
1965
1956
|
getCssCode() {
|
|
1966
|
-
const t = this.settings.color.value ?? "#000000", e = this.settings.
|
|
1957
|
+
const t = this.settings.color.value ?? "#000000", e = this.settings.fontFamily.value ?? "Satoshi", i = this.settings.fontWeight.value ?? "bold", s = this.settings.fontSize.value ?? 12, n = this.settings.align.value ?? "left";
|
|
1967
1958
|
return `
|
|
1968
1959
|
color: ${t};
|
|
1969
|
-
|
|
1970
|
-
font-
|
|
1971
|
-
font-
|
|
1972
|
-
|
|
1973
|
-
text-align: ${a};
|
|
1960
|
+
font-family: ${e};
|
|
1961
|
+
font-weight: ${i};
|
|
1962
|
+
font-size: ${s}px;
|
|
1963
|
+
text-align: ${n};
|
|
1974
1964
|
`;
|
|
1975
1965
|
}
|
|
1976
1966
|
}
|
|
1977
|
-
class
|
|
1967
|
+
class L extends p {
|
|
1978
1968
|
constructor(t) {
|
|
1979
1969
|
super({
|
|
1980
1970
|
...t,
|
|
@@ -2027,25 +2017,25 @@ class kt extends m {
|
|
|
2027
2017
|
collapsed: t == null ? void 0 : t.collapsed,
|
|
2028
2018
|
hideCondition: t == null ? void 0 : t.hideCondition,
|
|
2029
2019
|
settings: {
|
|
2030
|
-
marginTop: new
|
|
2020
|
+
marginTop: new L({
|
|
2031
2021
|
title: "Top",
|
|
2032
2022
|
icon: ht,
|
|
2033
2023
|
suffix: "px",
|
|
2034
2024
|
default: (t == null ? void 0 : t.marginTop) ?? "auto"
|
|
2035
2025
|
}),
|
|
2036
|
-
marginRight: new
|
|
2026
|
+
marginRight: new L({
|
|
2037
2027
|
title: "Right",
|
|
2038
2028
|
icon: ct,
|
|
2039
2029
|
suffix: "px",
|
|
2040
2030
|
default: (t == null ? void 0 : t.marginRight) ?? 0
|
|
2041
2031
|
}),
|
|
2042
|
-
marginBottom: new
|
|
2032
|
+
marginBottom: new L({
|
|
2043
2033
|
title: "Bottom",
|
|
2044
2034
|
icon: ut,
|
|
2045
2035
|
suffix: "px",
|
|
2046
2036
|
default: (t == null ? void 0 : t.marginBottom) ?? 0
|
|
2047
2037
|
}),
|
|
2048
|
-
marginLeft: new
|
|
2038
|
+
marginLeft: new L({
|
|
2049
2039
|
title: "Left",
|
|
2050
2040
|
icon: dt,
|
|
2051
2041
|
suffix: "px",
|
|
@@ -2085,7 +2075,6 @@ class Mt extends m {
|
|
|
2085
2075
|
* backgroundImage: 'https://example.com/myimage.png',
|
|
2086
2076
|
* opacity: 80,
|
|
2087
2077
|
* backgroundColor: "0, 0, 30",
|
|
2088
|
-
* opacityBG: 90,
|
|
2089
2078
|
* uploadProps: {
|
|
2090
2079
|
* uploadUrl: 'https://st-admapi.onaim.io/api/File/UploadImage',
|
|
2091
2080
|
* requestMethod: 'POST',
|
|
@@ -2108,14 +2097,11 @@ class Mt extends m {
|
|
|
2108
2097
|
...t == null ? void 0 : t.uploadProps,
|
|
2109
2098
|
default: (t == null ? void 0 : t.backgroundImage) ?? ""
|
|
2110
2099
|
}),
|
|
2111
|
-
opacity: new
|
|
2100
|
+
opacity: new z({
|
|
2112
2101
|
default: (t == null ? void 0 : t.opacity) ?? 100
|
|
2113
2102
|
}),
|
|
2114
|
-
backgroundColor: new
|
|
2103
|
+
backgroundColor: new b({
|
|
2115
2104
|
default: (t == null ? void 0 : t.backgroundColor) ?? "0, 0, 30"
|
|
2116
|
-
}),
|
|
2117
|
-
opacityBG: new V({
|
|
2118
|
-
default: (t == null ? void 0 : t.opacityBG) ?? 100
|
|
2119
2105
|
})
|
|
2120
2106
|
}
|
|
2121
2107
|
});
|
|
@@ -2126,16 +2112,16 @@ class Mt extends m {
|
|
|
2126
2112
|
draw() {
|
|
2127
2113
|
const t = super.draw(), e = t.querySelector(".setting-group-content");
|
|
2128
2114
|
if (!e) return t;
|
|
2129
|
-
const i = Array.from(e.children), [s, n, a
|
|
2115
|
+
const i = Array.from(e.children), [s, n, a] = i;
|
|
2130
2116
|
e.innerHTML = "", e.appendChild(s), e.appendChild(n);
|
|
2131
|
-
const
|
|
2132
|
-
return
|
|
2117
|
+
const o = document.createElement("div");
|
|
2118
|
+
return o.className = "bgset-or-label", o.textContent = "OR", e.appendChild(o), e.appendChild(a), t;
|
|
2133
2119
|
}
|
|
2134
2120
|
/**
|
|
2135
2121
|
* Helper method to generate CSS based on the current settings.
|
|
2136
2122
|
*/
|
|
2137
2123
|
getCssCode() {
|
|
2138
|
-
const t = this.settings.backgroundImage.value || "", e = this.settings.opacity.value ?? 100, i = this.settings.backgroundColor.value || "
|
|
2124
|
+
const t = this.settings.backgroundImage.value || "", e = this.settings.opacity.value ?? 100, i = this.settings.backgroundColor.value || "#000000";
|
|
2139
2125
|
return t ? `
|
|
2140
2126
|
background-image: url("${t}");
|
|
2141
2127
|
background-size: cover;
|
|
@@ -2143,7 +2129,6 @@ class Mt extends m {
|
|
|
2143
2129
|
opacity: ${e / 100};
|
|
2144
2130
|
` : `
|
|
2145
2131
|
background-color: ${i};
|
|
2146
|
-
opacity: ${s / 100};
|
|
2147
2132
|
`;
|
|
2148
2133
|
}
|
|
2149
2134
|
}
|
|
@@ -2154,11 +2139,11 @@ class pt extends m {
|
|
|
2154
2139
|
hideCondition: i == null ? void 0 : i.hideCondition,
|
|
2155
2140
|
collapsed: i == null ? void 0 : i.collapsed,
|
|
2156
2141
|
settings: {
|
|
2157
|
-
name: new
|
|
2142
|
+
name: new M({
|
|
2158
2143
|
title: "Tab Name",
|
|
2159
2144
|
default: `Tab ${t + 1}`
|
|
2160
2145
|
}),
|
|
2161
|
-
content: new
|
|
2146
|
+
content: new M({
|
|
2162
2147
|
title: "Content",
|
|
2163
2148
|
default: ""
|
|
2164
2149
|
})
|
|
@@ -2269,31 +2254,31 @@ function Tt(c) {
|
|
|
2269
2254
|
export {
|
|
2270
2255
|
U as AlignSetting,
|
|
2271
2256
|
Mt as BackgroundSettingSet,
|
|
2272
|
-
|
|
2257
|
+
yt as BorderSettingSet,
|
|
2273
2258
|
ft as ButtonSetting,
|
|
2274
2259
|
f as ColorSetting,
|
|
2275
|
-
|
|
2260
|
+
b as ColorWithOpacitySetting,
|
|
2276
2261
|
Ct as DimensionSetting,
|
|
2277
2262
|
xt as GapSetting,
|
|
2278
2263
|
Vt as HeaderTypographySettingSet,
|
|
2279
2264
|
vt as HeightSetting,
|
|
2280
|
-
|
|
2265
|
+
Lt as MarginBottomSetting,
|
|
2281
2266
|
kt as MarginSettingGroup,
|
|
2282
2267
|
C as NumberSetting,
|
|
2283
|
-
|
|
2268
|
+
z as OpacitySetting,
|
|
2284
2269
|
wt as SelectApiSettings,
|
|
2285
|
-
|
|
2270
|
+
N as SelectSetting,
|
|
2286
2271
|
p as Setting,
|
|
2287
2272
|
m as SettingGroup,
|
|
2288
|
-
|
|
2273
|
+
M as StringSetting,
|
|
2289
2274
|
It as TabsContainerGroup,
|
|
2290
|
-
|
|
2275
|
+
w as TabsSettings,
|
|
2291
2276
|
Et as Toggle,
|
|
2292
2277
|
Q as UploadSetting,
|
|
2293
2278
|
bt as WidthSetting,
|
|
2294
2279
|
mt as asSettingGroupWithSettings,
|
|
2295
|
-
|
|
2280
|
+
G as createSettingGroup,
|
|
2296
2281
|
Tt as isSetting,
|
|
2297
2282
|
Nt as isSettingGroup,
|
|
2298
|
-
|
|
2283
|
+
x as iterateSettings
|
|
2299
2284
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -15,8 +15,7 @@ export declare function asSettingGroupWithSettings<T extends Record<string, Sett
|
|
|
15
15
|
export declare class BackgroundSettingSet extends SettingGroup<{
|
|
16
16
|
backgroundImage: UploadSetting;
|
|
17
17
|
opacity: OpacitySetting;
|
|
18
|
-
backgroundColor:
|
|
19
|
-
opacityBG: OpacitySetting;
|
|
18
|
+
backgroundColor: ColorWithOpacitySetting;
|
|
20
19
|
}> {
|
|
21
20
|
/**
|
|
22
21
|
* Constructs a new BackgroundSettingSet.
|
|
@@ -29,7 +28,6 @@ export declare class BackgroundSettingSet extends SettingGroup<{
|
|
|
29
28
|
* backgroundImage: 'https://example.com/myimage.png',
|
|
30
29
|
* opacity: 80,
|
|
31
30
|
* backgroundColor: "0, 0, 30",
|
|
32
|
-
* opacityBG: 90,
|
|
33
31
|
* uploadProps: {
|
|
34
32
|
* uploadUrl: 'https://st-admapi.onaim.io/api/File/UploadImage',
|
|
35
33
|
* requestMethod: 'POST',
|
|
@@ -46,7 +44,6 @@ export declare class BackgroundSettingSet extends SettingGroup<{
|
|
|
46
44
|
backgroundImage?: string;
|
|
47
45
|
opacity?: number;
|
|
48
46
|
backgroundColor?: string;
|
|
49
|
-
opacityBG?: number;
|
|
50
47
|
uploadProps?: UploadSettingProps;
|
|
51
48
|
collapsed?: boolean;
|
|
52
49
|
hideCondition?: () => boolean;
|
|
@@ -67,14 +64,12 @@ export declare class BackgroundSettingSet extends SettingGroup<{
|
|
|
67
64
|
* You can pass default values to override the internal defaults.
|
|
68
65
|
*/
|
|
69
66
|
export declare class BorderSettingSet extends SettingGroup<{
|
|
70
|
-
color:
|
|
71
|
-
opacity: OpacitySetting;
|
|
67
|
+
color: ColorWithOpacitySetting;
|
|
72
68
|
radius: NumberSetting;
|
|
73
69
|
size: NumberSetting;
|
|
74
70
|
}> {
|
|
75
71
|
constructor(defaults?: {
|
|
76
72
|
color?: string;
|
|
77
|
-
opacity?: number;
|
|
78
73
|
radius?: number;
|
|
79
74
|
size?: number;
|
|
80
75
|
collapsed?: boolean;
|
|
@@ -256,8 +251,7 @@ declare interface HeaderTypographySettings {
|
|
|
256
251
|
}
|
|
257
252
|
|
|
258
253
|
export declare class HeaderTypographySettingSet extends SettingGroup<{
|
|
259
|
-
color:
|
|
260
|
-
opacity: OpacitySetting;
|
|
254
|
+
color: ColorWithOpacitySetting;
|
|
261
255
|
fontFamily: SelectSetting<string>;
|
|
262
256
|
fontWeight: SelectSetting<string>;
|
|
263
257
|
fontSize: NumberSetting;
|
package/package.json
CHANGED