builder-settings-types 0.0.220 → 0.0.224
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 +50 -50
- package/dist/builder-settings-types.es.js +534 -497
- package/dist/index.d.ts +9 -0
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const $="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let N=(h=21)=>{let t="",e=crypto.getRandomValues(new Uint8Array(h|=0));for(;h--;)t+=$[e[h]&63];return t};function x(h){if(h===null||typeof h!="object")return h;if(h instanceof Date)return new Date(h.getTime());if(Array.isArray(h)){const i=[];for(let s=0;s<h.length;s++)i[s]=x(h[s]);return i}const t={};for(const i in h)Object.prototype.hasOwnProperty.call(h,i)&&(t[i]=x(h[i]));const e=Object.getPrototypeOf(h);return e!==Object.prototype&&Object.setPrototypeOf(t,e),t}function F(h){switch(h){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||"",this.includeGetJson=t.includeGetJson!==void 0?t.includeGetJson:!0}static SetUploadUrl(t){window.DefaultUploadUrl=t,p.DefaultUploadUrl=t}destroy(){throw new Error("Method not implemented.")}setOnChange(t){return this.onChange=t,this}setOnBlur(t){return this.onBlur=t,this}setValue(t){this.value=t,this.inputEl&&(this.inputEl.value=String(t)),this.onChange&&this.onChange(t),this.props.detectChange&&this.props.detectChange(t)}clone(){const t=this.constructor,e=x(this.props),i=new t(e);return i.value=x(this.value),i}createInput(t){t={...this.props.inputProps,...t};const e=document.createElement("div");if(e.className=t.wrapperClassName||"",t.title||t.icon){const a=document.createElement("div");if(a.className="icon-container",t.icon){const l=this.createIcon(t.icon,t.iconClassName);a.appendChild(l)}if(t.title){const l=this.createLabel(t.title,t.labelClassName);a.appendChild(l)}e.appendChild(a)}const i=document.createElement("div");i.className=t.wrapperClassName||"";const s=document.createElement("input");this.inputEl=s,s.value=String(t.value||F(t.inputType)),s.type=t.inputType,s.placeholder=t.placeholder||"",s.className=t.inputClassName||"";const n=a=>{const l=a.target;let c=l.value;switch(t.inputType){case"number":c=Number(l.value);break;case"color":c=l.value;break;case"date":c=l.value;break;case"select":c=l.value;break;case"text":c=l.value;break;case"button":c=l.value;break;default:c=l.value}this.value=c,this.onChange&&this.onChange(this.value),this.props.detectChange&&this.props.detectChange(this.value)},o=a=>{a.target,this.onBlur&&this.onBlur(this.value)};return s.addEventListener("input",n),s.addEventListener("change",n),s.addEventListener("blur",o),t.inputCustomizer&&t.inputCustomizer(s),i.appendChild(s),e.appendChild(i),e}createLabel(t,e){const i=document.createElement("span");return i.textContent=t,i.className="input-label "+(e||""),i}createIcon(t,e){const i=document.createElement("span");return i.className="input-icon "+(e||""),i.innerHTML=t,i}}function G(h){let t=0,e=h.parentElement;for(;e;)e.classList.contains("setting-group")&&e!==h&&t++,e=e.parentElement;return t}function b(h,t){const e=Math.min(Math.max(t,0),5);h.setAttribute("data-nesting-level",e.toString()),e>0?h.style.setProperty("--visual-indent",`${e*2}px`):(h.style.removeProperty("--visual-indent"),h.style.marginLeft="")}function M(h,t=0){h.querySelectorAll(":scope > .setting-group-content > .setting-group").forEach(i=>{const s=i,n=t+1;b(s,n),M(s,n)})}const j={maxLevel:5,spacingMultiplier:1,visualIndentMultiplier:2,enableAutoDetection:!0};class z{constructor(t={}){this.observedElements=new Set,this.config={...j,...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=G(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 V=new z;function w(h,t){for(const e in h)if(Object.prototype.hasOwnProperty.call(h,e)){const i=h[e];t(e,i)}}const g=class g{constructor(t){this.elementRef=null,this.isHidden=!1,this.custom=!1,this.initialValues={},this.changeTimeout=null,this.isHandlingChange=!1,this.changeHandlers=new Set,this.blurTimeout=null,this.lastChangeTime=0,this.handleBlur=()=>{},this.pendingBlurHandler=null,this.originalDefaultValues={},this.nestingLevel=0,this.parentNestingLevel=0,this.id=t.id||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,this.includeGetJson=t.includeGetJson??!0,this.addItemCfg=t.addItem,Object.assign(this,t.settings),this.initialValues=this.getValues(),this.originalDefaultValues=this.getDefaultValues(),this.propagateNestingLevel()}propagateNestingLevel(){const t=this.nestingLevel+1;w(this.settings,(e,i)=>{i instanceof g&&(i.parentNestingLevel=this.nestingLevel,i.nestingLevel=t,i.propagateNestingLevel())})}getNestingLevel(){return this.nestingLevel}setNestingLevel(t){this.nestingLevel=t,this.propagateNestingLevel(),this.elementRef&&this.updateNestingStyles()}updateNestingStyles(){this.elementRef&&(b(this.elementRef,this.nestingLevel),M(this.elementRef,this.nestingLevel))}static hide(){this.hiddenElements.forEach(t=>{t&&(t.style.display="none")})}static show(){this.hiddenElements.forEach(t=>{t&&(t.style.display="")})}setOnChange(t){this.onChange=t;const e=()=>{this.isHandlingChange||(this.isHandlingChange=!0,this.changeTimeout&&clearTimeout(this.changeTimeout),this.changeTimeout=setTimeout(()=>{const i=this.getValues(),s=this.calculateChanges(this.initialValues,i);Object.keys(s).length>0&&(this.lastChangeTime=Date.now(),this.initialValues=i,t(i),this.updateVisibility()),this.isHandlingChange=!1},50))};return this.changeHandlers.clear(),w(this.settings,(i,s)=>{var n;if(s instanceof g)s.setOnChange(()=>{const o=this.getValues();this.initialValues=o,t(o)}),this.changeHandlers.add(()=>t(this.getValues()));else if(s instanceof p){const o=()=>e();this.changeHandlers.add(o),s.setOnChange(o)}else{const o=()=>e();this.changeHandlers.add(o),(n=s.setOnChange)==null||n.call(s,o)}}),this}setOnBlur(t){return this.onBlur=t,this.pendingBlurHandler=t,this.handleBlur=e=>{(e==null?void 0:e.target)instanceof HTMLElement&&e.target.closest(".setting-group")!==this.elementRef||(this.blurTimeout&&clearTimeout(this.blurTimeout),this.blurTimeout=setTimeout(()=>t(),100))},this.elementRef&&this.setupBlurHandlers(),this}setupBlurHandlers(){this.elementRef&&(this.elementRef.removeEventListener("focusout",this.handleBlur),this.elementRef.addEventListener("focusout",this.handleBlur,!0)),w(this.settings,(t,e)=>{e instanceof g&&e.setOnBlur(()=>{this.onBlur&&this.onBlur()})})}cleanup(){this.changeTimeout&&(clearTimeout(this.changeTimeout),this.changeTimeout=null),this.blurTimeout&&(clearTimeout(this.blurTimeout),this.blurTimeout=null),this.elementRef&&this.elementRef.removeEventListener("focusout",this.handleBlur),this.changeHandlers.clear()}clone(){const t={};w(this.settings,(s,n)=>{typeof n.clone=="function"?t[s]=n.clone():(console.warn(`Setting with key '${s}' does not have a clone method. Copying reference.`),t[s]=n)});const e={title:this.title,settings:t,description:this.description,icon:this.icon,collapsed:this.isCollapsed,main:this.isMain,custom:this.custom,hideCondition:this.hideCondition,parentNestingLevel:this.parentNestingLevel,includeGetJson:this.includeGetJson,addItem:this.addItemCfg},i=O(e);return i.initialValues=this.getValues(),i}setValue(t){if(!t||typeof t!="object")return;Object.entries(t).forEach(([i,s])=>{let n=this.settings[i];if(!n&&this.addItemCfg&&i.startsWith(this.addItemCfg.keyPrefix)){const o=i.slice(this.addItemCfg.keyPrefix.length),a=Number(o);if(Number.isFinite(a)){const l=this.addItemCfg.createItem(a);this.addSetting(i,l),n=l}}n&&(n instanceof g||n instanceof p)&&typeof n.setValue=="function"&&n.setValue(s)}),setTimeout(()=>{this.forceChildUIRefresh()},0);const e=this.getValues();this.initialValues=e,this.onChange&&this.onChange(e)}forceChildUIRefresh(){Object.entries(this.settings).forEach(([t,e])=>{try{if(e instanceof g){const i=e.getValues();e.setValue(i)}else if(typeof e.setValue=="function"){const i=e.value;i!==void 0&&e.setValue(i)}}catch(i){console.warn(`Error refreshing UI for setting ${t}:`,i)}})}wireChild(t){var i,s,n;const e=()=>{var a;const o=this.getValues();this.initialValues=o,(a=this.onChange)==null||a.call(this,o),this.updateVisibility()};t instanceof g?(t.setOnChange(()=>e()),(i=t.setOnBlur)==null||i.call(t,()=>{var o;return(o=this.onBlur)==null?void 0:o.call(this)})):t instanceof p?(t.setOnChange(()=>e()),(s=t.setOnBlur)==null||s.call(t,()=>{var o;return(o=this.onBlur)==null?void 0:o.call(this)})):(n=t.setOnChange)==null||n.call(t,()=>e())}addSetting(t,e){var s;if(this.settings[t]=e,this.wireChild(e),this.elementRef){const n=this.elementRef.querySelector(".setting-group-content");if(n){e instanceof g&&e.setNestingLevel(this.nestingLevel+1);const o=e.draw();this.addItemCfg&&this.addItemCfg.showDeleteButton!==!1&&t.startsWith(this.addItemCfg.keyPrefix)&&this.addDeleteButtonToElement(o,t);const a=n.querySelector(".sg-add-button-bottom");a?n.insertBefore(o,a):n.appendChild(o),V.trackElement(o),b(o,this.nestingLevel+1),M(o,this.nestingLevel+1);const l=o.style.display;o.style.display="none",o.offsetHeight,o.style.display=l,this.updateNestingStyles()}}const i=this.getValues();this.initialValues=i,(s=this.onChange)==null||s.call(this,i)}removeSetting(t){var s;const e=this.settings[t];if(!e)return;if(delete this.settings[t],this.elementRef){const n=this.elementRef.querySelector(".setting-group-content");if(n){const o=Array.from(n.querySelectorAll(".setting-group, .setting"));for(const a of o){const l=a.id;if(l&&l.includes(e.id)){a.remove();break}}}}typeof e.cleanup=="function"&&e.cleanup(),this.updateNestingStyles();const i=this.getValues();this.initialValues=i,(s=this.onChange)==null||s.call(this,i)}addDeleteButtonToElement(t,e){var l,c;const i=t.querySelector(".setting-group-title");if(!i)return;const s=i.querySelector(".actions-section");if(!s)return;const n=document.createElement("button");n.type="button",n.className="sg-delete-button",n.title=((l=this.addItemCfg)==null?void 0:l.deleteButtonLabel)||"Delete",n.style.cssText=`
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const F="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let O=(h=21)=>{let t="",e=crypto.getRandomValues(new Uint8Array(h|=0));for(;h--;)t+=F[e[h]&63];return t};function k(h){if(h===null||typeof h!="object")return h;if(h instanceof Date)return new Date(h.getTime());if(Array.isArray(h)){const i=[];for(let s=0;s<h.length;s++)i[s]=k(h[s]);return i}const t={};for(const i in h)Object.prototype.hasOwnProperty.call(h,i)&&(t[i]=k(h[i]));const e=Object.getPrototypeOf(h);return e!==Object.prototype&&Object.setPrototypeOf(t,e),t}function G(h){switch(h){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 g{constructor(t={}){this.props=t,this.id=t.id||O(),this.value=this.props.default,this.desktop=this.props.default,this.title=t.title||"",this.includeGetJson=t.includeGetJson!==void 0?t.includeGetJson:!0}static SetUploadUrl(t){window.DefaultUploadUrl=t,g.DefaultUploadUrl=t}destroy(){throw new Error("Method not implemented.")}setOnChange(t){return this.onChange=t,this}setOnBlur(t){return this.onBlur=t,this}setValue(t){this.value=t,this.inputEl&&(this.inputEl.value=String(t)),this.onChange&&this.onChange(t),this.props.detectChange&&this.props.detectChange(t)}clone(){const t=this.constructor,e=k(this.props),i=new t(e);return i.value=k(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||G(t.inputType)),s.type=t.inputType,s.placeholder=t.placeholder||"",s.className=t.inputClassName||"";const n=o=>{const l=o.target;let r=l.value;switch(t.inputType){case"number":r=Number(l.value);break;case"color":r=l.value;break;case"date":r=l.value;break;case"select":r=l.value;break;case"text":r=l.value;break;case"button":r=l.value;break;default:r=l.value}this.value=r,this.onChange&&this.onChange(this.value),this.props.detectChange&&this.props.detectChange(this.value)},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 j(h){let t=0,e=h.parentElement;for(;e;)e.classList.contains("setting-group")&&e!==h&&t++,e=e.parentElement;return t}function L(h,t){const e=Math.min(Math.max(t,0),5);h.setAttribute("data-nesting-level",e.toString()),e>0?h.style.setProperty("--visual-indent",`${e*2}px`):(h.style.removeProperty("--visual-indent"),h.style.marginLeft="")}function I(h,t=0){h.querySelectorAll(":scope > .setting-group-content > .setting-group").forEach(i=>{const s=i,n=t+1;L(s,n),I(s,n)})}const z={maxLevel:5,spacingMultiplier:1,visualIndentMultiplier:2,enableAutoDetection:!0};class P{constructor(t={}){this.observedElements=new Set,this.config={...z,...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=j(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 N=new P;function b(h,t){for(const e in h)if(Object.prototype.hasOwnProperty.call(h,e)){const i=h[e];t(e,i)}}const p=class p{constructor(t){this.elementRef=null,this.isHidden=!1,this.custom=!1,this.initialValues={},this.changeTimeout=null,this.isHandlingChange=!1,this.changeHandlers=new Set,this.blurTimeout=null,this.lastChangeTime=0,this.handleBlur=()=>{},this.pendingBlurHandler=null,this.originalDefaultValues={},this.nestingLevel=0,this.parentNestingLevel=0,this.id=t.id||O(),this.title=t.title,this.settings=t.settings,this.description=t.description,this.icon=t.icon,this.isCollapsed=t.collapsed??!1,this.isMain=t.main??!1,this.custom=t.custom??!1,this.hideCondition=t.hideCondition,this.onBlur=t.onBlur,this.parentNestingLevel=t.parentNestingLevel??0,this.nestingLevel=this.parentNestingLevel,this.includeGetJson=t.includeGetJson??!0,this.addItemCfg=t.addItem,this.deleteItemCfg=t.deleteItem,Object.assign(this,t.settings),this.initialValues=this.getValues(),this.originalDefaultValues=this.getDefaultValues(),this.propagateNestingLevel()}propagateNestingLevel(){const t=this.nestingLevel+1;b(this.settings,(e,i)=>{i instanceof p&&(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&&(L(this.elementRef,this.nestingLevel),I(this.elementRef,this.nestingLevel))}static hide(){this.hiddenElements.forEach(t=>{t&&(t.style.display="none")})}static show(){this.hiddenElements.forEach(t=>{t&&(t.style.display="")})}setOnChange(t){this.onChange=t;const e=()=>{this.isHandlingChange||(this.isHandlingChange=!0,this.changeTimeout&&clearTimeout(this.changeTimeout),this.changeTimeout=setTimeout(()=>{const i=this.getValues(),s=this.calculateChanges(this.initialValues,i);Object.keys(s).length>0&&(this.lastChangeTime=Date.now(),this.initialValues=i,t(i),this.updateVisibility()),this.isHandlingChange=!1},50))};return this.changeHandlers.clear(),b(this.settings,(i,s)=>{var n;if(s instanceof p)s.setOnChange(()=>{const a=this.getValues();this.initialValues=a,t(a)}),this.changeHandlers.add(()=>t(this.getValues()));else if(s instanceof g){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.addEventListener("focusout",this.handleBlur,!0)),b(this.settings,(t,e)=>{e instanceof p&&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={};b(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,includeGetJson:this.includeGetJson,addItem:this.addItemCfg,deleteItem:this.deleteItemCfg},i=T(e);return i.initialValues=this.getValues(),i}setValue(t){if(!t||typeof t!="object")return;Object.entries(t).forEach(([i,s])=>{let n=this.settings[i];if(!n&&this.addItemCfg&&i.startsWith(this.addItemCfg.keyPrefix)){const a=i.slice(this.addItemCfg.keyPrefix.length),o=Number(a);if(Number.isFinite(o)){const l=this.addItemCfg.createItem(o);this.addSetting(i,l),n=l}}n&&(n instanceof p||n instanceof g)&&typeof n.setValue=="function"&&n.setValue(s)}),setTimeout(()=>{this.forceChildUIRefresh()},0);const e=this.getValues();this.initialValues=e,this.onChange&&this.onChange(e)}forceChildUIRefresh(){Object.entries(this.settings).forEach(([t,e])=>{try{if(e instanceof p){const i=e.getValues();e.setValue(i)}else if(typeof e.setValue=="function"){const i=e.value;i!==void 0&&e.setValue(i)}}catch(i){console.warn(`Error refreshing UI for setting ${t}:`,i)}})}wireChild(t){var i,s,n;const e=()=>{var o;const a=this.getValues();this.initialValues=a,(o=this.onChange)==null||o.call(this,a),this.updateVisibility()};t instanceof p?(t.setOnChange(()=>e()),(i=t.setOnBlur)==null||i.call(t,()=>{var a;return(a=this.onBlur)==null?void 0:a.call(this)})):t instanceof g?(t.setOnChange(()=>e()),(s=t.setOnBlur)==null||s.call(t,()=>{var a;return(a=this.onBlur)==null?void 0:a.call(this)})):(n=t.setOnChange)==null||n.call(t,()=>e())}addSetting(t,e){var s,n;if(this.settings[t]=e,this.wireChild(e),this.elementRef){const a=this.elementRef.querySelector(".setting-group-content");if(a){e instanceof p&&e.setNestingLevel(this.nestingLevel+1);const o=e.draw(),l=this.deleteItemCfg??this.addItemCfg;if(l&&l.showDeleteButton!==!1){const c=l.keyPrefix??((s=this.addItemCfg)==null?void 0:s.keyPrefix);c&&t.startsWith(c)&&this.addDeleteButtonToElement(o,t)}const r=a.querySelector(".sg-add-button-bottom");r?a.insertBefore(o,r):a.appendChild(o),N.trackElement(o),L(o,this.nestingLevel+1),I(o,this.nestingLevel+1);const d=o.style.display;o.style.display="none",o.offsetHeight,o.style.display=d,this.updateNestingStyles()}}const i=this.getValues();this.initialValues=i,(n=this.onChange)==null||n.call(this,i)}removeSetting(t){var s;const e=this.settings[t];if(!e)return;if(delete this.settings[t],this.elementRef){const n=this.elementRef.querySelector(".setting-group-content");if(n){const a=Array.from(n.querySelectorAll(".setting-group, .setting"));for(const o of a){const l=o.id;if(l&&l.includes(e.id)){o.remove();break}}}}typeof e.cleanup=="function"&&e.cleanup(),this.updateNestingStyles();const i=this.getValues();this.initialValues=i,(s=this.onChange)==null||s.call(this,i)}addDeleteButtonToElement(t,e,i){let s=null;try{s=t.querySelector(":scope > .setting-group-title")}catch{s=null}if(!s){const d=Array.from(t.querySelectorAll(".setting-group-title"));for(const c of d)if(c.closest(".setting-group")===t){s=c;break}s||(s=d[0]??null)}if(!s)return;const n=s.querySelector(".actions-section");if(!n)return;const a=document.createElement("button");a.type="button",a.className="sg-delete-button";const o=i?i.deleteItemCfg:this.deleteItemCfg??this.addItemCfg;a.title=(o==null?void 0:o.deleteButtonLabel)||"Delete",a.style.cssText=`
|
|
2
2
|
background: none;
|
|
3
3
|
border: none;
|
|
4
4
|
cursor: pointer;
|
|
@@ -10,12 +10,12 @@
|
|
|
10
10
|
justify-content: center;
|
|
11
11
|
border-radius: 4px;
|
|
12
12
|
transition: background-color 0.2s;
|
|
13
|
-
`;const
|
|
13
|
+
`;const l=(o==null?void 0:o.deleteButtonIconSvg)||`
|
|
14
14
|
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
15
15
|
<path d="M2 4h12M5.333 4V2.667a1.333 1.333 0 0 1 1.334-1.334h2.666a1.333 1.333 0 0 1 1.334 1.334V4m2 0v9.333a1.333 1.333 0 0 1-1.334 1.334H4.667a1.333 1.333 0 0 1-1.334-1.334V4h8.667Z" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
16
16
|
<path d="M6.667 7.333v4M9.333 7.333v4" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
17
17
|
</svg>
|
|
18
|
-
`;
|
|
18
|
+
`;a.innerHTML=l,a.addEventListener("mouseenter",()=>{a.style.backgroundColor="#fef2f2"}),a.addEventListener("mouseleave",()=>{a.style.backgroundColor="transparent"}),a.addEventListener("click",d=>{d.stopPropagation(),d.preventDefault(),this.showDeleteConfirmation().then(c=>{c&&(i&&i.deleteItemCfg?this.removeSetting(e):this.removeSetting(e))})});const r=n.querySelector(".setting-group-arrow");r?n.insertBefore(a,r):n.appendChild(a)}showDeleteConfirmation(){return new Promise(t=>{const e=document.createElement("div");e.className="sg-modal-overlay",e.style.cssText=`
|
|
19
19
|
position: fixed;
|
|
20
20
|
top: 0;
|
|
21
21
|
left: 0;
|
|
@@ -46,11 +46,11 @@
|
|
|
46
46
|
color: #6b7280;
|
|
47
47
|
font-size: 14px;
|
|
48
48
|
line-height: 1.5;
|
|
49
|
-
`;const
|
|
49
|
+
`;const a=document.createElement("div");a.style.cssText=`
|
|
50
50
|
display: flex;
|
|
51
51
|
gap: 12px;
|
|
52
52
|
justify-content: flex-end;
|
|
53
|
-
`;const
|
|
53
|
+
`;const o=document.createElement("button");o.textContent="Cancel",o.type="button",o.style.cssText=`
|
|
54
54
|
padding: 8px 16px;
|
|
55
55
|
border: 1px solid #d1d5db;
|
|
56
56
|
background: white;
|
|
@@ -70,39 +70,39 @@
|
|
|
70
70
|
font-weight: 500;
|
|
71
71
|
cursor: pointer;
|
|
72
72
|
transition: all 0.2s;
|
|
73
|
-
`,
|
|
73
|
+
`,o.addEventListener("mouseenter",()=>{o.style.backgroundColor="#f9fafb",o.style.borderColor="#9ca3af"}),o.addEventListener("mouseleave",()=>{o.style.backgroundColor="white",o.style.borderColor="#d1d5db"}),l.addEventListener("mouseenter",()=>{l.style.backgroundColor="#dc2626"}),l.addEventListener("mouseleave",()=>{l.style.backgroundColor="#ef4444"});const r=()=>{e.style.opacity="0",i.style.transform="scale(0.95)",setTimeout(()=>{e.parentNode&&e.parentNode.removeChild(e)},200)};o.addEventListener("click",()=>{r(),t(!1)}),l.addEventListener("click",()=>{r(),t(!0)}),e.addEventListener("click",c=>{c.target===e&&(r(),t(!1))});const d=c=>{c.key==="Escape"&&(r(),t(!1),document.removeEventListener("keydown",d))};document.addEventListener("keydown",d),a.appendChild(o),a.appendChild(l),i.appendChild(s),i.appendChild(n),i.appendChild(a),e.appendChild(i),document.body.appendChild(e),requestAnimationFrame(()=>{e.style.opacity="1",i.style.transform="scale(1)"}),setTimeout(()=>l.focus(),100)})}getNextIndexFromPrefix(t){const e=Object.keys(this.settings).filter(i=>i.startsWith(t)).map(i=>{const s=Number(i.slice(t.length));return Number.isFinite(s)?s:-1}).filter(i=>i>=0);return e.length?Math.max(...e)+1:0}calculateChanges(t,e){const i={};return new Set([...Object.keys(t),...Object.keys(e)]).forEach(n=>{const 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(Object.prototype.hasOwnProperty.call(this.settings,i)){const s=this.settings[i];s instanceof p?e[i]=s.getValues():e[i]=s.value}return e}else{const e=this.settings[t];return e?e instanceof p?e.getValues():e.value:void 0}}getValuesForJson(t){if(t===void 0){if(this.includeGetJson===!1)return null;const e={};for(const i in this.settings)if(Object.prototype.hasOwnProperty.call(this.settings,i)){const s=this.settings[i];s instanceof p?e[i]=s.getValuesForJson():s.includeGetJson===!1?e[i]=null:e[i]=s.value}return e}else{const e=this.settings[t];return e?e instanceof p?e.includeGetJson===!1?null:e.getValuesForJson():e.includeGetJson===!1?null:e.value:void 0}}getDefaultValues(t){if(t===void 0){const e={};for(const i in this.settings)if(Object.prototype.hasOwnProperty.call(this.settings,i)){const s=this.settings[i];s instanceof p?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 p?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(Object.prototype.hasOwnProperty.call(this.settings,i)){const s=this.settings[i];if(s instanceof p)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 p)return e.getMobileValues();if(typeof e.getMobileValue=="function"){const i=e.getMobileValue();return i!==void 0?i:e.value}return e.value}}setMobileValues(t){if(!(!t||typeof t!="object")&&(Object.entries(t).forEach(([e,i])=>{const s=this.settings[e];s&&(s instanceof p?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(){var d;const t=document.createElement("div");t.className="setting-group",t.id=`setting-group-${this.id}`,p.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"),L(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 c=document.createElement("span");c.className="group-icon",c.innerHTML=this.icon,i.appendChild(c)}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 c=document.createElement("span");c.className="info-marker",c.innerHTML=`
|
|
74
74
|
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
75
75
|
<path d="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"
|
|
76
76
|
stroke="currentColor" stroke-width="1.33333" stroke-linecap="round" stroke-linejoin="round"/>
|
|
77
77
|
</svg>
|
|
78
|
-
`,
|
|
78
|
+
`,c.title=this.description,n.appendChild(c)}const a=document.createElement("span");a.className="setting-group-arrow",a.innerHTML=`
|
|
79
79
|
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
80
80
|
<path d="M4 6L8 10L12 6" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
81
81
|
</svg>
|
|
82
|
-
`,this.isCollapsed&&
|
|
82
|
+
`,this.isCollapsed&&a.classList.add("rotated"),n.appendChild(a);const o=document.createElement("div");if(o.className="setting-group-content",this.isCollapsed&&(o.classList.add("collapsed"),e.classList.add("collapsed-view"),a.classList.add("rotated"),t.classList.add("collapsed")),this.isMain&&o.classList.add("main-content"),this.description&&!this.isCollapsed){const c=document.createElement("div");c.className="setting-group-description",c.textContent=this.description,o.appendChild(c)}const l=()=>{this.isCollapsed=!this.isCollapsed,o.classList.toggle("collapsed"),e.classList.toggle("collapsed-view"),a.classList.toggle("rotated"),t.classList.toggle("collapsed",this.isCollapsed),e.setAttribute("aria-expanded",(!this.isCollapsed).toString());const c=o.querySelector(".setting-group-description"),u=n.querySelector(".info-marker");if(this.description)if(this.isCollapsed){if(c&&c.remove(),!u){const m=document.createElement("span");m.className="info-marker",m.innerHTML=`
|
|
83
83
|
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
84
84
|
<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"
|
|
85
85
|
stroke="currentColor" stroke-width="1.33333" stroke-linecap="round" stroke-linejoin="round"/>
|
|
86
86
|
</svg>
|
|
87
|
-
`,
|
|
87
|
+
`,m.title=this.description,n.insertBefore(m,a)}}else{if(!c){const m=document.createElement("div");m.className="setting-group-description",m.textContent=this.description,o.insertBefore(m,o.firstChild)}u&&u.remove()}};if(e.onclick=l,e.onkeydown=c=>{(c.key==="Enter"||c.key===" ")&&(c.preventDefault(),l())},Object.keys(this.settings).length>0){for(const c in this.settings)if(Object.prototype.hasOwnProperty.call(this.settings,c)){const u=this.settings[c];u instanceof p&&u.setNestingLevel(this.nestingLevel+1);const m=u.draw();if(u instanceof p&&u.deleteItemCfg)this.addDeleteButtonToElement(m,c,u);else{const E=this.deleteItemCfg??this.addItemCfg;if(E&&E.showDeleteButton!==!1){const x=E.keyPrefix??((d=this.addItemCfg)==null?void 0:d.keyPrefix);x&&c.startsWith(x)&&this.addDeleteButtonToElement(m,c)}}o.appendChild(m)}}else{const c=document.createElement("div");c.className="setting-group-empty",c.textContent="No settings in this group",o.appendChild(c)}if(this.addItemCfg){const c=document.createElement("button");c.type="button",c.className="sg-add-button-bottom",c.style.marginTop="8px";const u=this.addItemCfg.buttonIconSvg??`
|
|
88
88
|
<svg width="16" height="16" viewBox="0 0 16 16" fill="none"
|
|
89
89
|
xmlns="http://www.w3.org/2000/svg">
|
|
90
90
|
<path d="M8 3.333v9.334M3.333 8h9.334" stroke="currentColor"
|
|
91
91
|
stroke-width="1.5" stroke-linecap="round"/>
|
|
92
|
-
</svg>`;
|
|
92
|
+
</svg>`;c.innerHTML=`${u}<span style="margin-left:4px;">${this.addItemCfg.buttonLabel??"Add"}</span>`,c.addEventListener("click",m=>{m.stopPropagation(),m.preventDefault();const S=this.getNextIndexFromPrefix(this.addItemCfg.keyPrefix),E=this.addItemCfg.createItem(S),x=`${this.addItemCfg.keyPrefix}${S}`;this.addSetting(x,E),this.addItemCfg.expandNewItem!==!1&&E.expand&&E.expand()}),o.appendChild(c)}return e.appendChild(i),e.appendChild(n),t.appendChild(e),t.appendChild(o),this.elementRef=t,N.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.getValuesForJson(),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")}}};p.hiddenElements=new Set;let v=p;class H extends v{constructor(t){super(t);const e=Object.keys(this.settings)[0];this.activeTabId=e||""}getActiveTabId(){return this.activeTabId}switchToTab(t){this.settings[t]&&(this.activeTabId=t,this.updateTabUI())}updateTabUI(){if(!this.tabsContainer||!this.contentContainers)return;this.tabsContainer.querySelectorAll(".tab-button").forEach(e=>{e.getAttribute("data-tab-id")===this.activeTabId?e.classList.add("active"):e.classList.remove("active")}),Object.entries(this.contentContainers).forEach(([e,i])=>{e===this.activeTabId?i.classList.add("active"):i.classList.remove("active")})}draw(){const t=super.draw();t.classList.add("tabs-settings-container");const e=t.querySelector(".setting-group-content");if(!e)return t;e.innerHTML="";const i=document.createElement("div");i.className="tabs-title";const s=document.createElement("h3");s.textContent=this.title,i.appendChild(s);const n=document.createElement("div");n.className="tabs-header",this.tabsContainer=n;const a=document.createElement("div");if(a.className="tab-content",this.contentContainers={},Object.keys(this.settings).forEach((o,l)=>{const r=document.createElement("button");r.className="tab-button",r.type="button",r.setAttribute("data-tab-id",o),r.textContent=o,r.addEventListener("click",()=>this.switchToTab(o)),n.appendChild(r);const d=document.createElement("div");d.className="tab-panel",this.contentContainers[o]=d;const c=this.settings[o];c&&(c instanceof v&&c.setNestingLevel(this.getNestingLevel()+1),d.appendChild(c.draw())),a.appendChild(d),l===0&&!this.activeTabId&&(this.activeTabId=o)}),e.appendChild(i),e.appendChild(n),e.appendChild(a),!this.activeTabId){const o=Object.keys(this.settings)[0];this.activeTabId=o||""}return this.updateTabUI(),t}}function T(h){return new v(h)}function D(h){return h}class B extends g{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 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>";class f extends B{constructor(t){super({...t,icon:t.icon||W,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(d=>parseInt(d.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)),r=d=>{const c=d.toString(16);return c.length===1?"0"+c:c};return`#${r(a)}${r(o)}${r(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 r=document.createElement("span");r.className="input-icon",r.innerHTML=this.props.icon,l.appendChild(r)}if(this.props.title){const r=document.createElement("span");r.className="input-label",r.textContent=this.props.title,l.appendChild(r)}t.appendChild(l)}const e=document.createElement("div");e.className="color-input-wrapper";const i=l=>{const r=l.value.trim();if(!r)return e.classList.remove("error"),!0;const c=/^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/.test(r);return c?e.classList.remove("error"):e.classList.add("error"),c},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 d,c;let r=l.target.value.trim();if(this.textInputEl&&i(this.textInputEl)){const u=f.normalizeColorValue(r);this.value=u,(d=this.onChange)==null||d.call(this,u),(c=this.detectChange)==null||c.call(this,u),this.colorInputEl&&(this.colorInputEl.value=u),n.style.backgroundColor=u}}),this.colorInputEl.addEventListener("input",l=>{var c,u;const r=l.target.value,d=f.normalizeColorValue(r);this.value=d,(c=this.onChange)==null||c.call(this,d),(u=this.detectChange)==null||u.call(this,d),this.textInputEl&&(this.textInputEl.value=d),n.style.backgroundColor=d,e.classList.remove("error")}),this.colorInputEl.addEventListener("change",l=>{var c,u;const r=l.target.value,d=f.normalizeColorValue(r);this.value=d,(c=this.onChange)==null||c.call(this,d),(u=this.detectChange)==null||u.call(this,d),this.textInputEl&&(this.textInputEl.value=d),n.style.backgroundColor=d}),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 J=`
|
|
93
93
|
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
94
94
|
<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"/>
|
|
95
95
|
<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"/>
|
|
96
96
|
<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"/>
|
|
97
|
-
</svg>`;class
|
|
97
|
+
</svg>`;class w extends g{constructor(t={}){super({...t,icon:t.icon||J,title:t.title||"Color & Opacity",default:t.default||"#000000FF"}),this.inputType="color",this.element=null,this.colorInputEl=null,this.textInputEl=null,this.opacityInputEl=null,this.colorPreviewEl=null,this.detectChange=t.detectChange,this.value&&(this.value=w.normalizeHexWithOpacity(this.value))}static normalizeHexWithOpacity(t){return t=t.replace("#",""),t.length===3&&(t=t.split("").map(e=>e+e).join("")),t.length===6&&(t=t+"FF"),t.length===8&&/^[0-9A-Fa-f]{8}$/.test(t)?`#${t.toUpperCase()}`:(console.warn(`Invalid hex value "${t}", using default "#000000FF"`),"#000000FF")}getRgbColor(){return this.value?this.value.substring(0,7):"#000000"}getOpacityPercent(){if(!this.value)return 100;const t=this.value.substring(7,9),e=parseInt(t,16)/255;return Math.round(e*100)}static combineColorOpacity(t,e){const i=t.replace("#","").substring(0,6),n=Math.round(e/100*255).toString(16).toUpperCase().padStart(2,"0");return`#${i}${n}`}setValue(t){t===void 0||t===""?this.value="#000000FF":this.value=w.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=w.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=w.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.colorPreviewEl=document.createElement("div"),this.colorPreviewEl.className="color-with-opacity-preview",this.textInputEl=document.createElement("input"),this.textInputEl.type="text",this.textInputEl.className="color-with-opacity-text-input",this.textInputEl.placeholder="#000000FF",this.updateInputElements(),this.updateColorPreview(),this.colorInputEl.addEventListener("input",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(),this.updateColorPreview(),t}getElement(){return this.element}getValue(){return this.value}getRgbaValue(){if(!this.value)return"rgba(0, 0, 0, 1)";const t=this.getRgbColor(),e=this.getOpacityPercent()/100,i=t.replace("#",""),s=parseInt(i.substring(0,2),16),n=parseInt(i.substring(2,4),16),a=parseInt(i.substring(4,6),16);return`rgba(${s}, ${n}, ${a}, ${e})`}getColorAndOpacity(){return{color:this.getRgbColor(),opacity:this.getOpacityPercent()}}}class U extends g{constructor(t={}){super(t),this.inputType="text",t.onChange&&this.setOnChange(t.onChange)}setValue(t){this.value=t,this.textareaEl&&(this.textareaEl.value=t),this.onChange&&this.onChange(t),this.props.detectChange&&this.props.detectChange(t)}draw(){const t=document.createElement("div");if(t.className="html-setting-wrapper "+(this.props.wrapperClassName||""),this.props.title||this.props.icon){const n=document.createElement("div");if(n.className="icon-container",this.props.icon){const 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)}const e=document.createElement("textarea");this.textareaEl=e,e.value=this.value||"",e.placeholder=this.props.placeholder||"Paste your HTML here...",e.className="html-setting-textarea "+(this.props.textareaClassName||""),e.rows=this.props.rows||6,this.props.maxLength!==void 0&&(e.maxLength=this.props.maxLength),this.props.className&&e.classList.add(this.props.className);const i=n=>{const o=n.target.value;this.value=o,this.onChange&&this.onChange(this.value),this.props.detectChange&&this.props.detectChange(this.value)},s=n=>{this.onBlur&&this.value!==void 0&&this.onBlur(this.value)};return e.addEventListener("input",i),e.addEventListener("change",i),e.addEventListener("blur",s),t.appendChild(e),t}}class C extends g{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 q=`
|
|
98
98
|
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
99
99
|
<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"/>
|
|
100
100
|
<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"/>
|
|
101
|
-
</svg>`;class
|
|
101
|
+
</svg>`;class A extends C{constructor(t={}){const e={title:"Opacity",suffix:"%",minValue:0,maxValue:100,step:1,default:t.default??100,icon:q,...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 _=`
|
|
102
102
|
<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">
|
|
103
103
|
<polyline points="6 9 12 15 18 9"></polyline>
|
|
104
104
|
</svg>
|
|
105
|
-
`;class
|
|
105
|
+
`;class M extends g{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,this.resizeListener=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)}}setValue(t){super.setValue(t);const e=this._options.findIndex(i=>i.value===t);e>=0?this.selectedOptionIndex=e:this.selectedOptionIndex=null,this.updateButtonText()}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,this.isOpen?this.checkDropdownPosition():this.cleanupDropdownPosition(),(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)}),document.body.appendChild(i);const s=document.createElement("div");return s.classList.add("svg-container"),s.innerHTML=_,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"),this.cleanupDropdownPosition())},document.addEventListener("click",this.clickOutsideListener),this.resizeListener&&window.removeEventListener("resize",this.resizeListener),this.resizeListener=()=>{this.isOpen&&this.checkDropdownPosition()},window.addEventListener("resize",this.resizeListener),t}checkDropdownPosition(){if(!this.optionsListEl||!this.buttonEl||!this.container)return;const t=this.buttonEl.getBoundingClientRect();this.optionsListEl.classList.remove("dropdown-up"),this.optionsListEl.style.position="fixed",this.optionsListEl.style.top=`${t.bottom+2}px`,this.optionsListEl.style.bottom="auto",this.optionsListEl.style.left=`${t.left}px`,this.optionsListEl.style.right="auto",this.optionsListEl.style.width=`${t.width}px`;const e=Math.min(this._options.length*40+12,280);if(window.innerHeight-t.bottom<e){const s=Math.max(10,window.innerHeight-e-10);this.optionsListEl.style.top=`${s}px`}}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.cleanupDropdownPosition(),this.optionsListEl&&this.optionsListEl.querySelectorAll(".select-option").forEach((r,d)=>{d===e?r.classList.add("selected"):r.classList.remove("selected")}))}cleanupDropdownPosition(){this.optionsListEl&&(this.optionsListEl.style.position="",this.optionsListEl.style.top="",this.optionsListEl.style.bottom="",this.optionsListEl.style.left="",this.optionsListEl.style.right="",this.optionsListEl.style.width="")}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),this.resizeListener&&(window.removeEventListener("resize",this.resizeListener),this.resizeListener=null),this.cleanupDropdownPosition(),this.optionsListEl&&this.optionsListEl.parentNode&&this.optionsListEl.parentNode.removeChild(this.optionsListEl),super.destroy()}}class R extends g{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:`
|
|
106
106
|
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" fill="none">
|
|
107
107
|
<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"
|
|
108
108
|
stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"/>
|
|
@@ -123,30 +123,30 @@
|
|
|
123
123
|
<path d="M13.5 15C14.1989 15 14.5484 15 14.824 14.8858C15.1916 14.7336 15.4836 14.4416 15.6358 14.074C15.75 13.7984 15.75 13.4489 15.75 12.75C15.75 12.0511 15.75 11.7016 15.6358 11.426C15.4836 11.0584 15.1916 10.7664 14.824 10.6142C14.5484 10.5 14.1989 10.5 13.5 10.5H4.5C3.80109 10.5 3.45163 10.5 3.17598 10.6142C2.80843 10.7664 2.51642 11.0584 2.36418 11.426C2.25 11.7016 2.25 12.0511 2.25 12.75C2.25 13.4489 2.25 13.7984 2.36418 14.074C2.51642 14.4416 2.80843 14.7336 3.17597 14.8858C3.45163 15 3.80109 15 4.5 15L13.5 15Z"
|
|
124
124
|
stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"/>
|
|
125
125
|
</svg>
|
|
126
|
-
`}].forEach(n=>{const
|
|
126
|
+
`}].forEach(n=>{const a=document.createElement("button");a.className="align-option-button",a.innerHTML=n.icon,this.value===n.name&&a.classList.add("selected"),a.addEventListener("click",()=>{var o;i.querySelectorAll(".align-option-button").forEach(l=>l.classList.remove("selected")),a.classList.add("selected"),this.value=n.name,(o=this.onChange)==null||o.call(this,this.value)}),i.appendChild(a)}),t.appendChild(i),t}}class Z extends g{constructor(t){super(t),this.inputType="button",this.bgWithAlpha="rgba(145, 158, 171, 0.08)"}draw(){const t=document.createElement("button");t.className="button-setting "+(this.props.className||""),t.textContent=this.props.label,t.style.borderColor=this.props.borderColor||"rgba(145, 158, 171, 0.32)";const e=this.props.backgroundColor||"rgba(0,0,0,0)",i=this.props.textColor||"black";t.style.backgroundColor=e,t.style.color=i;let s=e;const n=e.match(/^rgba\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)\s*\)$/i);if(n){let o=+n[1],l=+n[2],r=+n[3],d=+n[4];d>=1?(o=Math.round(o*.9),l=Math.round(l*.9),r=Math.round(r*.9)):d=Math.min(1,d+.12),s=`rgba(${o},${l},${r},${d})`}t.addEventListener("mouseenter",()=>{console.log("hoverBg",s),t.style.setProperty("background-color",s,"important")}),t.addEventListener("mouseleave",()=>{t.style.setProperty("background-color",e,"important")}),t.addEventListener("click",()=>{var o,l;return(l=(o=this.props).onClick)==null?void 0:l.call(o)});const a=document.createElement("div");return a.className="button-setting-wrapper "+(this.props.wrapperClassName||""),a.appendChild(t),a}}class K extends g{constructor(t={}){super(t),this.inputType={width:"number",height:"number"},this.aspectRatio=1,this.isUpdating=!1;const e=t.width||0,i=t.height||0;this.value||(this.value={width:e,height:i}),this.minWidth=t.minWidth??0,this.maxWidth=t.maxWidth,this.minHeight=t.minHeight??0,this.maxHeight=t.maxHeight,this.locked=t.locked??!1,this.value.height>0&&(this.aspectRatio=this.value.width/this.value.height),this.widthSetting=new C({title:"Width",default:this.value.width,suffix:"px",minValue:this.minWidth,maxValue:this.maxWidth,icon:X}),this.heightSetting=new C({title:"Height",default:this.value.height,suffix:"px",minValue:this.minHeight,maxValue:this.maxHeight,icon:Q}),this.widthSetting.setOnChange(this.handleWidthChange.bind(this)),this.heightSetting.setOnChange(this.handleHeightChange.bind(this))}handleWidthChange(t){if(!this.isUpdating&&!(isNaN(t)||t<0)){t=Math.max(this.minWidth,t),this.maxWidth&&t>this.maxWidth&&(t=this.maxWidth),this.isUpdating=!0;try{let e=t,i=this.value.height;this.locked&&this.aspectRatio>0&&(i=Math.round(e/this.aspectRatio),this.maxHeight&&i>this.maxHeight&&(i=this.maxHeight,e=Math.round(i*this.aspectRatio),this.maxWidth&&e>this.maxWidth&&(e=this.maxWidth,i>0&&(this.aspectRatio=e/i)))),this.value={width:e,height:i},this.widthSetting.setValue(e),this.locked&&this.heightSetting.setValue(i),this.onChange&&this.onChange(this.value)}finally{this.isUpdating=!1}}}handleHeightChange(t){if(!this.isUpdating&&!(isNaN(t)||t<0)){t=Math.max(this.minHeight,t),this.maxHeight&&t>this.maxHeight&&(t=this.maxHeight),this.isUpdating=!0;try{let e=t,i=this.value.width;this.locked&&this.aspectRatio>0&&(i=Math.round(e*this.aspectRatio),this.maxWidth&&i>this.maxWidth&&(i=this.maxWidth,e=Math.round(i/this.aspectRatio),this.maxHeight&&e>this.maxHeight&&(e=this.maxHeight,e>0&&(this.aspectRatio=i/e)))),this.value={width:i,height:e},this.locked&&this.widthSetting.setValue(i),this.heightSetting.setValue(e),this.onChange&&this.onChange(this.value)}finally{this.isUpdating=!1}}}toggleLock(t){if(this.locked=!this.locked,this.locked&&this.value){const{width:i,height:s}=this.value;s>0&&(this.aspectRatio=i/s)}t.innerHTML=this.getLockSVG(this.locked),t.setAttribute("aria-pressed",String(this.locked)),t.title=this.locked?"Unlock aspect ratio":"Lock aspect ratio";const e=t.closest(".dimension-setting-container");e&&(this.locked?e.classList.add("aspect-locked"):e.classList.remove("aspect-locked")),t.style.transform="scale(0.9)",setTimeout(()=>{t.style.transform="scale(1)"},100)}getLockSVG(t){return t?`
|
|
127
127
|
<svg xmlns="http://www.w3.org/2000/svg" width="10" height="10" viewBox="0 0 10 10" fill="none">
|
|
128
128
|
<path d="M2.91663 4.58333V3.33333C2.91663 2.18274 3.84937 1.25 4.99996 1.25C6.00786 1.25 6.84859 1.96573 7.04162 2.91667M3.66663 8.75H6.33329C7.03336 8.75 7.38339 8.75 7.65078 8.61376C7.88598 8.49392 8.07721 8.30269 8.19705 8.06749C8.33329 7.8001 8.33329 7.45007 8.33329 6.75V6.58333C8.33329 5.88327 8.33329 5.53323 8.19705 5.26584C8.07721 5.03064 7.88598 4.83942 7.65078 4.71958C7.38339 4.58333 7.03336 4.58333 6.33329 4.58333H3.66663C2.96656 4.58333 2.61653 4.58333 2.34914 4.71958C2.11394 4.83942 1.92271 5.03064 1.80287 5.26584C1.66663 5.53323 1.66663 5.88327 1.66663 6.58333V6.75C1.66663 7.45007 1.66663 7.8001 1.80287 8.06749C1.92271 8.30269 2.11394 8.49392 2.34914 8.61376C2.61653 8.75 2.96656 8.75 3.66663 8.75Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"/>
|
|
129
129
|
</svg>`:`
|
|
130
130
|
<svg xmlns="http://www.w3.org/2000/svg" width="10" height="10" viewBox="0 0 10 10" fill="none">
|
|
131
131
|
<path d="M2.91663 4.58333V3.33333C2.91663 2.18274 3.84937 1.25 4.99996 1.25M3.66663 8.75H6.33329C7.03336 8.75 7.38339 8.75 7.65078 8.61376C7.88598 8.49392 8.07721 8.30269 8.19705 8.06749C8.33329 7.8001 8.33329 7.45007 8.33329 6.75V6.58333C8.33329 5.88327 8.33329 5.53323 8.19705 5.26584C8.07721 5.03064 7.88598 4.83942 7.65078 4.71958C7.38339 4.58333 7.03336 4.58333 6.33329 4.58333H3.66663C2.96656 4.58333 2.61653 4.58333 2.34914 4.71958C2.11394 4.83942 1.92271 5.03064 1.80287 5.26584C1.66663 5.53323 1.66663 5.88327 1.66663 6.58333V6.75C1.66663 7.45007 1.66663 7.8001 1.80287 8.06749C1.92271 8.30269 2.11394 8.49392 2.34914 8.61376C2.61653 8.75 2.96656 8.75 3.66663 8.75Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"/>
|
|
132
|
-
</svg>`}setValue(t){if(t&&typeof t.width=="number"&&typeof t.height=="number"){let e=Math.max(this.minWidth,t.width);this.maxWidth&&(e=Math.min(this.maxWidth,e));let i=Math.max(this.minHeight,t.height);this.maxHeight&&(i=Math.min(this.maxHeight,i)),this.value={width:e,height:i},this.locked&&this.value.height>0&&(this.aspectRatio=this.value.width/this.value.height),this.isUpdating=!0;try{this.widthSetting.setValue(this.value.width),this.heightSetting.setValue(this.value.height)}finally{this.isUpdating=!1}}}draw(){const t=document.createElement("div");t.className="dimension-setting-container",this.locked&&t.classList.add("aspect-locked");const e=this.widthSetting.draw(),i=this.heightSetting.draw(),s=document.createElement("div");s.className="dimension-bracket";const n=document.createElement("button");return n.className="dimension-lock-icon",n.setAttribute("type","button"),n.setAttribute("aria-pressed",String(this.locked)),n.setAttribute("aria-label",this.locked?"Unlock aspect ratio":"Lock aspect ratio"),n.title=this.locked?"Unlock aspect ratio":"Lock aspect ratio",n.innerHTML=this.getLockSVG(this.locked),n.onclick=
|
|
132
|
+
</svg>`}setValue(t){if(t&&typeof t.width=="number"&&typeof t.height=="number"){let e=Math.max(this.minWidth,t.width);this.maxWidth&&(e=Math.min(this.maxWidth,e));let i=Math.max(this.minHeight,t.height);this.maxHeight&&(i=Math.min(this.maxHeight,i)),this.value={width:e,height:i},this.locked&&this.value.height>0&&(this.aspectRatio=this.value.width/this.value.height),this.isUpdating=!0;try{this.widthSetting.setValue(this.value.width),this.heightSetting.setValue(this.value.height)}finally{this.isUpdating=!1}}}draw(){const t=document.createElement("div");t.className="dimension-setting-container",this.locked&&t.classList.add("aspect-locked");const e=this.widthSetting.draw(),i=this.heightSetting.draw(),s=document.createElement("div");s.className="dimension-bracket";const n=document.createElement("button");return n.className="dimension-lock-icon",n.setAttribute("type","button"),n.setAttribute("aria-pressed",String(this.locked)),n.setAttribute("aria-label",this.locked?"Unlock aspect ratio":"Lock aspect ratio"),n.title=this.locked?"Unlock aspect ratio":"Lock aspect ratio",n.innerHTML=this.getLockSVG(this.locked),n.onclick=a=>{a.preventDefault(),this.toggleLock(n)},s.appendChild(n),t.appendChild(e),t.appendChild(s),t.appendChild(i),t}isLocked(){return this.locked}setLocked(t){if(this.locked!==t){if(this.locked=t,this.locked&&this.value){const{width:i,height:s}=this.value;s>0&&(this.aspectRatio=i/s)}const e=document.querySelector(".dimension-setting-container .dimension-lock-icon");if(e instanceof HTMLElement){e.innerHTML=this.getLockSVG(this.locked),e.setAttribute("aria-pressed",String(this.locked)),e.title=this.locked?"Unlock aspect ratio":"Lock aspect ratio";const i=e.closest(".dimension-setting-container");i&&(this.locked?i.classList.add("aspect-locked"):i.classList.remove("aspect-locked"))}}}}const X=`<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
133
133
|
<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"/>
|
|
134
|
-
</svg>`,
|
|
134
|
+
</svg>`,Q=`<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
135
135
|
<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"/>
|
|
136
|
-
</svg>`,
|
|
136
|
+
</svg>`,V=`
|
|
137
137
|
<svg xmlns="http://www.w3.org/2000/svg" width="15" height="16" viewBox="0 0 15 16" fill="none">
|
|
138
138
|
<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"/>
|
|
139
139
|
</svg>
|
|
140
|
-
`,
|
|
140
|
+
`,Y=`
|
|
141
141
|
<svg width="91" height="71" viewBox="0 0 91 71" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
142
142
|
<rect width="91" height="71" rx="4" fill="#F2F4F7"/>
|
|
143
143
|
<path d="M37 31.5L39.5 29M39.5 29L42 31.5M39.5 29V34.625M44.5 31.9643C45.2634 31.3338 45.75 30.38 45.75 29.3125C45.75 27.414 44.211 25.875 42.3125 25.875C42.1759 25.875 42.0482 25.8037 41.9788 25.6861C41.1638 24.303 39.659 23.375 37.9375 23.375C35.3487 23.375 33.25 25.4737 33.25 28.0625C33.25 29.3538 33.7721 30.5232 34.6168 31.371" stroke="#475467" stroke-linecap="round" stroke-linejoin="round"/>
|
|
144
144
|
</svg>
|
|
145
|
-
`,
|
|
145
|
+
`,tt=`
|
|
146
146
|
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 12 12" fill="none">
|
|
147
147
|
<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"/>
|
|
148
148
|
</svg>
|
|
149
|
-
`,
|
|
149
|
+
`,et=`
|
|
150
150
|
<svg xmlns="http://www.w3.org/2000/svg" width="29" height="29" viewBox="0 0 29 29" fill="none">
|
|
151
151
|
<!-- Top dot -->
|
|
152
152
|
<circle cx="14.5" cy="3" r="1.5" fill="#02CC59" opacity="1"/>
|
|
@@ -165,97 +165,97 @@
|
|
|
165
165
|
<!-- Top-left dot -->
|
|
166
166
|
<circle cx="6.7" cy="6.7" r="1.5" fill="#02CC59" opacity="0.3"/>
|
|
167
167
|
</svg>
|
|
168
|
-
`;class
|
|
169
|
-
<span class="upload-icon">${
|
|
168
|
+
`;class $ extends g{constructor(t={}){super(t),this.inputType="button",this.previewWrapper=null,this.previewEl=null,this.emptyStateEl=null,this.errorContainer=null,this.messageListener=null,this.loadingSpinner=null,this.props.delete===void 0&&(this.props.delete=!0),this.props.maxFileSizeMB===void 0&&(this.props.maxFileSizeMB=5),!this.value&&t.defaultUrl&&t.defaultUrl!==""&&(this.value=t.defaultUrl),this.setupMessageListener()}setupMessageListener(){this.messageListener=t=>{var e;if(t.data&&t.data.type==="FILE_MANAGER_IMAGE_SELECTED"&&t.data.settingId===this.id){const i=t.data.imageUrl;i&&typeof i=="string"&&(this.value=i,this.updatePreviewState(i),(e=this.onChange)==null||e.call(this,i),this.hideError())}},window.addEventListener("message",this.messageListener)}cleanupMessageListener(){this.messageListener&&(window.removeEventListener("message",this.messageListener),this.messageListener=null)}destroy(){this.cleanupMessageListener()}showError(t){this.errorContainer&&(this.errorContainer.textContent=t,this.errorContainer.style.display="block",setTimeout(()=>{this.errorContainer&&(this.errorContainer.style.display="none")},5e3))}hideError(){this.errorContainer&&(this.errorContainer.style.display="none")}showLoading(){!this.previewWrapper||!this.loadingSpinner||(this.previewWrapper.classList.add("loading"),this.previewWrapper.style.display="flex",this.loadingSpinner.style.display="block",this.previewEl&&(this.previewEl.style.display="none"))}hideLoading(){!this.previewWrapper||!this.loadingSpinner||(this.previewWrapper.classList.remove("loading"),this.loadingSpinner.style.display="none")}validateFileSize(t){const e=(this.props.maxFileSizeMB||5)*1024*1024;if(t.size>e){const i=this.props.maxFileSizeMB||5,s=(t.size/(1024*1024)).toFixed(1);return this.showError(`File size (${s}MB) exceeds maximum limit of ${i}MB`),!1}return!0}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");if(t&&t!==""){this.showLoading(),s&&s instanceof HTMLElement&&(s.style.display="none"),e&&e.classList.remove("no-image"),i&&(i.innerHTML=`
|
|
169
|
+
<span class="upload-icon">${V}</span>
|
|
170
170
|
<span class="upload-label">Replace</span>
|
|
171
|
-
`);const n=()=>{this.hideLoading(),this.previewWrapper.classList.add("has-image"),this.previewEl.style.display="block",this.previewEl.removeEventListener("load",n),this.previewEl.removeEventListener("error",
|
|
172
|
-
<span class="upload-icon">${
|
|
171
|
+
`);const n=()=>{this.hideLoading(),this.previewWrapper.classList.add("has-image"),this.previewEl.style.display="block",this.previewEl.removeEventListener("load",n),this.previewEl.removeEventListener("error",a)},a=()=>{this.hideLoading(),this.showError("Failed to load image. Please try again."),this.previewWrapper.classList.remove("has-image"),this.previewEl.style.display="none",this.previewWrapper.style.display="none",s&&s instanceof HTMLElement&&(s.style.display="block"),e&&e.classList.add("no-image"),this.previewEl.removeEventListener("load",n),this.previewEl.removeEventListener("error",a)};this.previewEl.addEventListener("load",n),this.previewEl.addEventListener("error",a),this.previewEl.src=t}else this.hideLoading(),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=`
|
|
172
|
+
<span class="upload-icon">${V}</span>
|
|
173
173
|
<span class="upload-label">Upload</span>
|
|
174
|
-
`)}draw(){const t=document.createElement("div");t.className="upload-setting-wrapper",t.setAttribute("data-setting-id",this.id),t.addEventListener("focusout",
|
|
175
|
-
<span class="upload-icon">${
|
|
174
|
+
`)}draw(){const t=document.createElement("div");t.className="upload-setting-wrapper",t.setAttribute("data-setting-id",this.id),t.addEventListener("focusout",o=>{var l;o.relatedTarget&&t.contains(o.relatedTarget)||(l=this.onBlur)==null||l.call(this,this.value??"")},!0);const e=!!(this.props.title||this.props.icon);if(e||t.classList.add("no-label"),e){const o=document.createElement("div");if(o.className="icon-title-container",this.props.icon){const l=this.createIcon(this.props.icon);o.appendChild(l)}if(this.props.title){const l=this.createLabel(this.props.title);o.appendChild(l)}t.appendChild(o)}this.errorContainer=document.createElement("div"),this.errorContainer.className="error-message",this.errorContainer.style.display="none",t.appendChild(this.errorContainer);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=Y,this.previewWrapper=document.createElement("div"),this.previewWrapper.className="preview-wrapper",this.loadingSpinner=document.createElement("div"),this.loadingSpinner.className="loading-spinner",this.loadingSpinner.innerHTML=et,this.loadingSpinner.style.display="none",this.previewWrapper.appendChild(this.loadingSpinner),this.previewEl=document.createElement("img"),this.previewEl.className="upload-preview",this.props.delete){const o=document.createElement("button");o.className="delete-button",o.type="button",o.title="Delete image",o.innerHTML=tt,this.previewWrapper.appendChild(o),o.onclick=l=>{var r;l.stopPropagation(),this.value="",this.updatePreviewState(null),(r=this.onChange)==null||r.call(this,""),this.hideError()}}this.previewWrapper.appendChild(this.previewEl);const a=document.createElement("button");return a.className="upload-button",a.innerHTML=`
|
|
175
|
+
<span class="upload-icon">${V}</span>
|
|
176
176
|
<span class="upload-label">Upload</span>
|
|
177
|
-
`,i.appendChild(n),i.appendChild(this.previewWrapper),i.appendChild(
|
|
177
|
+
`,i.appendChild(n),i.appendChild(this.previewWrapper),i.appendChild(a),t.appendChild(i),s?this.updatePreviewState(this.value):this.updatePreviewState(null),a.onclick=()=>{window.postMessage({type:"OPEN_FILE_MANAGER_MODAL",settingId:this.id},"*")},t}}class it extends C{constructor(t={}){super({...t,title:t.title||"Height",suffix:t.suffix||"px",minValue:t.minValue??0,icon:t.icon||st,default:t.default??100}),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">
|
|
178
178
|
<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"/>
|
|
179
|
-
</svg>`;class
|
|
179
|
+
</svg>`;class nt extends C{constructor(t={}){super({...t,title:t.title||"Width",suffix:t.suffix||"px",minValue:t.minValue??0,icon:t.icon||ot,default:t.default??100}),this.inputType="number",this.mobileValue=t.mobile}getMobileValue(){return this.mobileValue}setMobileValue(t){this.mobileValue=t,t!==void 0&&this.setValue(t)}}const ot=`<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
180
180
|
<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"/>
|
|
181
|
-
</svg>`,
|
|
181
|
+
</svg>`,at=`
|
|
182
182
|
<svg xmlns="http://www.w3.org/2000/svg" class="svg-select-api" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-chevron-down">
|
|
183
183
|
<polyline points="6 9 12 15 18 9"></polyline>
|
|
184
184
|
</svg>
|
|
185
|
-
`;class
|
|
185
|
+
`;class lt extends g{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.hasInitializedOptions=!1,this.selectedOptionIndex=null,t.default!==void 0&&(this.value=t.default),this.initializeOptions(t),!t.getOptionsAsync&&this.value!==void 0){const e=this._options.findIndex(i=>JSON.stringify(i.value)===JSON.stringify(this.value));e!==-1&&(this.selectedOptionIndex=e)}t.onChange&&this.setOnChange(t.onChange),t.detectChange&&(this.detectChangeCallback=t.detectChange)}initializeOptions(t){this.hasInitializedOptions&&!t.getOptionsAsync||(this._options=[],t.options&&(this._options=[...t.options]),t.getOptions&&this._options.push(...t.getOptions()),t.getOptionsAsync?this.isLoading=!0:this.hasInitializedOptions=!0)}createOption(t,e){const i=document.createElement("li");i.classList.add("select-api-option"),i.textContent=t.name,i.dataset.index=String(e);const s=document.createElement("input");return s.type="radio",s.classList.add("select-api-radio"),s.name="select-api-radio-group",i.appendChild(s),this.selectedOptionIndex===e&&(s.checked=!0),i}draw(){const t=document.createElement("div");t.classList.add("select-api-container"),this.container=t;const e=document.createElement("div");if(e.classList.add("select-api-button"),this.props.title){e.classList.add("has-label");const n=document.createElement("div");n.className="select-label",n.textContent=this.props.title,e.appendChild(n);const a=document.createElement("span");if(a.className="select-value",this.isLoading)a.textContent=this.props.loadingText||"Loading options...";else{const o=this.selectedOptionIndex!==null&&this._options&&this.selectedOptionIndex>=0&&this.selectedOptionIndex<this._options.length?this._options[this.selectedOptionIndex]:null,l=o&&typeof o.name=="string"?o.name:"Select an option";a.textContent=l}e.appendChild(a)}else{const n=document.createElement("span");if(this.isLoading)n.textContent=this.props.loadingText||"Loading options...";else{const a=this.selectedOptionIndex!==null&&this._options&&this.selectedOptionIndex>=0&&this.selectedOptionIndex<this._options.length?this._options[this.selectedOptionIndex]:null,o=a&&typeof a.name=="string"?a.name:"Select an option";n.textContent=o}e.appendChild(n)}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-api-options"),this._options.forEach((n,a)=>{const o=this.createOption(n,a);o.onclick=l=>this.selectApiOption(l,a,e),i.appendChild(o)}),t.appendChild(i);const s=document.createElement("div");return s.classList.add("svg-container"),s.innerHTML=at,t.appendChild(s),s.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))},this.optionsListEl=i,this.svgContainer=s,this.props.getOptionsAsync&&!this.hasInitializedOptions?(this.isLoading=!0,this.updateButtonText(),this.props.getOptionsAsync().then(n=>{const a=new Set(this._options.map(l=>JSON.stringify(l.value))),o=n.filter(l=>!a.has(JSON.stringify(l.value)));if(this._options.push(...o),this.isLoading=!1,this.hasInitializedOptions=!0,this.value!==void 0){const l=this._options.findIndex(r=>JSON.stringify(r.value)===JSON.stringify(this.value));this.selectedOptionIndex=l!==-1?l:null}else this.selectedOptionIndex=null;this.updateOptionsList(),this.updateButtonText()}).catch(n=>{console.error("Failed to fetch async options:",n),this.isLoading=!1,this.updateButtonText(this.props.errorText||"Error: Could not load options",!0)})):this.props.getOptionsAsync&&this._options.length<=1&&(this.isLoading=!0,this.updateButtonText(),this.props.getOptionsAsync().then(n=>{const a=new Set(this._options.map(l=>JSON.stringify(l.value))),o=n.filter(l=>!a.has(JSON.stringify(l.value)));if(this._options.push(...o),this.isLoading=!1,this.value!==void 0){const l=this._options.findIndex(r=>JSON.stringify(r.value)===JSON.stringify(this.value));this.selectedOptionIndex=l!==-1?l:null}else this.selectedOptionIndex=null;this.updateOptionsList(),this.updateButtonText()}).catch(n=>{console.error("Failed to fetch async options:",n),this.isLoading=!1,this.updateButtonText(this.props.errorText||"Error: Could not load options",!0)})),t}getJson(t=!0){return JSON.stringify(t?{}:{value:this.value},null,2)}selectApiOption(t,e,i){var l,r,d,c;const s=t.target,n=s.querySelector(".select-api-radio")||((l=s.closest(".select-api-option"))==null?void 0:l.querySelector(".select-api-radio"));n&&(n.checked=!0),this.selectedOptionIndex=e;const a=this._options[e].value;this.value=a;const o=i.querySelector(".select-value");if(o)o.textContent=this._options[e].name;else{const u=i.firstChild;u&&u.tagName==="SPAN"&&(u.textContent=this._options[e].name)}this.isOpen=!1,(r=this.optionsListEl)==null||r.classList.remove("open"),(d=this.svgContainer)==null||d.classList.remove("open"),(c=this.onChange)==null||c.call(this,a),this.detectChangeCallback&&this.detectChangeCallback(a)}updateOptionsList(){!this.optionsListEl||!this.buttonEl||(this.optionsListEl.innerHTML="",this._options.forEach((t,e)=>{var s;const i=this.createOption(t,e);i.onclick=n=>{this.buttonEl&&this.selectApiOption(n,e,this.buttonEl)},(s=this.optionsListEl)==null||s.appendChild(i)}))}updateButtonText(t,e=!1){if(!this.buttonEl)return;const i=this.buttonEl.querySelector(".select-value")||this.buttonEl.firstChild;if(i)if(e)i.textContent=t||"Error",this.buttonEl.classList.add("error"),this.buttonEl.setAttribute("disabled","true"),this.optionsListEl&&this.optionsListEl.classList.remove("open"),this.svgContainer&&(this.svgContainer.style.display="none");else if(this.isLoading)i.textContent=this.props.loadingText||"Loading options...",this.buttonEl.classList.remove("error"),this.buttonEl.removeAttribute("disabled"),this.svgContainer&&(this.svgContainer.style.display="");else{const s=this.selectedOptionIndex!==null&&this._options&&this.selectedOptionIndex>=0&&this.selectedOptionIndex<this._options.length?this._options[this.selectedOptionIndex]:null,n=s&&typeof s.name=="string"?s.name:"Select an option";i.textContent=t||n,this.buttonEl.classList.remove("error"),this.buttonEl.removeAttribute("disabled"),this.svgContainer&&(this.svgContainer.style.display="")}}setDetectChange(t){this.detectChangeCallback=t}setValue(t){this.value=t,this.selectedOptionIndex=this._options.findIndex(e=>JSON.stringify(e.value)===JSON.stringify(t)),this.updateButtonText()}}class rt extends g{constructor(t){var e,i;super(t),this.inputType="text",this.value=t.default??((i=(e=t.options)==null?void 0:e[0])==null?void 0:i.value)??"",this.detectChangeCallback=t.detectChange}draw(){var a,o;const t=document.createElement("div");t.className="toggle-setting-container",this.props.icon&&t.classList.add("toggle-with-icon");const e=document.createElement("div");if(e.className="toggle-label",this.props.icon){const l=document.createElement("span");l.className="toggle-icon",l.innerHTML=this.props.icon,e.appendChild(l)}if(this.props.title){const l=document.createElement("span");l.textContent=this.props.title,e.appendChild(l)}t.appendChild(e);const i=document.createElement("label");i.className="toggle-switch";const s=document.createElement("input");s.type="checkbox",s.checked=((o=(a=this.props.options)==null?void 0:a.find(l=>l.value===this.value))==null?void 0:o.status)??!1,s.addEventListener("change",()=>{var r,d;const l=((d=(r=this.props.options)==null?void 0:r.find(c=>c.status===s.checked))==null?void 0:d.value)??"";this.value=l,this.onChange&&this.onChange(this.value),this.detectChangeCallback&&this.detectChangeCallback(this.value)});const n=document.createElement("span");if(n.className="toggle-slider",this.props.activeColor||this.props.inactiveColor){const l=document.createElement("style"),r=this.props.activeColor||"#4CAF50",d=this.props.inactiveColor||"#ccc";l.textContent=`
|
|
186
186
|
.toggle-switch input:checked + .toggle-slider {
|
|
187
|
-
background-color: ${
|
|
187
|
+
background-color: ${r};
|
|
188
188
|
}
|
|
189
189
|
.toggle-switch .toggle-slider {
|
|
190
|
-
background-color: ${
|
|
190
|
+
background-color: ${d};
|
|
191
191
|
}
|
|
192
|
-
`,document.head.appendChild(l)}return i.appendChild(s),i.appendChild(n),t.appendChild(i),t}setDetectChange(t){this.detectChangeCallback=t}}const
|
|
192
|
+
`,document.head.appendChild(l)}return i.appendChild(s),i.appendChild(n),t.appendChild(i),t}setDetectChange(t){this.detectChangeCallback=t}}const ct=`<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
193
193
|
<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"/>
|
|
194
|
-
</svg>`;class
|
|
194
|
+
</svg>`;class ht extends g{constructor(t={}){t.rowGap=t.rowGap??!0,t.columnGap=t.columnGap??!0,t.title=t.title??"Gap",t.icon=t.icon??ct,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,r;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)),(r=(l=this.props).onBlur)==null||r.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)}}const dt=`<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
195
195
|
<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"/>
|
|
196
|
-
</svg>`;class
|
|
196
|
+
</svg>`;class ut extends C{constructor(t={}){super({...t,minValue:t.minValue??0,maxValue:t.maxValue??1e3,icon:t.icon||dt,title:t.title||"Margin Bottom",default:t.default??20,wrapperClassName:"margin-bottom-wrapper "+(t.wrapperClassName||"")}),this.inputType="number"}}const pt=`<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
197
197
|
<path d="M15.75 7.25H2.25m9.9 9h-6.3c-1.26 0-1.89 0-2.371-.245a2.25 2.25 0 0 1-.984-.983c-.245-.482-.245-1.112-.245-2.372v-6.3c0-1.26 0-1.89.245-2.371a2.25 2.25 0 0 1 .984-.984c.48-.245 1.11-.245 2.371-.245h6.3c1.26 0 1.89 0 2.371.245.424.216.768.56.984.984.245.48.245 1.11.245 2.371v6.3c0 1.26 0 1.89-.245 2.371-.216.424-.56.768-.984.984-.48.245-1.11.245-2.371.245"
|
|
198
198
|
stroke="#667085" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
199
|
-
</svg>`;class
|
|
199
|
+
</svg>`;class gt extends C{constructor(t={}){super({...t,minValue:t.minValue??0,maxValue:t.maxValue??1e3,icon:t.icon||pt,title:t.title||"Margin Top",default:t.default??20,wrapperClassName:"margin-top-wrapper "+(t.wrapperClassName||"")}),this.inputType="number"}}const mt=`
|
|
200
200
|
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
201
201
|
<polyline points="3,6 5,6 21,6"></polyline>
|
|
202
202
|
<path d="m19,6v14a2,2 0 0,1-2,2H7a2,2 0 0,1-2-2V6m3,0V4a2,2 0 0,1,2-2h4a2,2 0 0,1,2,2v2"></path>
|
|
203
203
|
<line x1="10" y1="11" x2="10" y2="17"></line>
|
|
204
204
|
<line x1="14" y1="11" x2="14" y2="17"></line>
|
|
205
205
|
</svg>
|
|
206
|
-
`,
|
|
206
|
+
`,ft=`
|
|
207
207
|
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
208
208
|
<line x1="12" y1="5" x2="12" y2="19"></line>
|
|
209
209
|
<line x1="5" y1="12" x2="19" y2="12"></line>
|
|
210
210
|
</svg>
|
|
211
|
-
`;class
|
|
211
|
+
`;class vt extends g{constructor(t={}){super(t),this.inputType={},this.container=null,this.languagesContainer=null,this.addLanguageSelect=null,this.addButton=null,this.defaultLanguages=[{code:"en",name:"English"},{code:"ka",name:"Georgian"},{code:"ru",name:"Russian"},{code:"tr",name:"Turkish"},{code:"de",name:"German"},{code:"fr",name:"French"},{code:"es",name:"Spanish"},{code:"it",name:"Italian"},{code:"ar",name:"Arabic"},{code:"zh",name:"Chinese"}],this.value||(this.value={})}get availableLanguages(){return this.props.availableLanguages||this.defaultLanguages}get usedLanguageCodes(){return Object.keys(this.value||{})}get availableLanguageOptions(){return this.availableLanguages.filter(t=>!this.usedLanguageCodes.includes(t.code))}updateAddLanguageSelect(){if(!this.addLanguageSelect)return;this.addLanguageSelect.innerHTML='<option value="">Select language...</option>',this.availableLanguageOptions.forEach(i=>{const s=document.createElement("option");s.value=i.code,s.textContent=i.name,this.addLanguageSelect.appendChild(s)});const t=this.availableLanguageOptions.length>0,e=this.props.maxLanguages&&this.usedLanguageCodes.length>=this.props.maxLanguages;this.addButton&&(this.addButton.disabled=!t||!!e)}createLanguageRow(t,e){const i=document.createElement("div");i.classList.add("multi-language-row"),i.dataset.language=t;const s=document.createElement("span");s.classList.add("language-label"),s.textContent=t.toUpperCase();const n=document.createElement("div");n.classList.add("language-input-group");const a=document.createElement("input");a.type="text",a.classList.add("language-input"),a.value=e||"",a.placeholder=this.props.placeholder||"Enter text...",a.addEventListener("input",l=>{const r=l.target;this.updateLanguageValue(t,r.value)});const o=document.createElement("button");return o.type="button",o.classList.add("delete-language-btn"),o.innerHTML=mt,o.title=`Delete ${t.toUpperCase()}`,o.addEventListener("click",()=>{this.removeLanguage(t)}),n.appendChild(a),n.appendChild(o),i.appendChild(s),i.appendChild(n),i}updateLanguageValue(t,e){this.value||(this.value={}),this.value[t]=e,this.onChange&&this.onChange(this.value),this.props.detectChange&&this.props.detectChange(this.value)}removeLanguage(t){var i;if(!this.value)return;delete this.value[t],this.onChange&&this.onChange(this.value),this.props.detectChange&&this.props.detectChange(this.value);const e=(i=this.languagesContainer)==null?void 0:i.querySelector(`[data-language="${t}"]`);e&&e.remove(),this.updateAddLanguageSelect()}addLanguage(t){var s;if(!t||this.usedLanguageCodes.includes(t))return;this.value||(this.value={}),this.value[t]="",this.onChange&&this.onChange(this.value),this.props.detectChange&&this.props.detectChange(this.value);const e=this.createLanguageRow(t,"");(s=this.languagesContainer)==null||s.appendChild(e),this.updateAddLanguageSelect(),this.addLanguageSelect&&(this.addLanguageSelect.value="");const i=e.querySelector(".language-input");i&&i.focus()}createAddLanguageSection(){const t=document.createElement("div");t.classList.add("add-language-section");const e=document.createElement("div");e.classList.add("add-language-label"),e.textContent="Add language:";const i=document.createElement("div");i.classList.add("add-language-controls");const s=document.createElement("select");s.classList.add("add-language-select"),this.addLanguageSelect=s;const n=document.createElement("button");return n.type="button",n.classList.add("add-language-btn"),n.innerHTML=`${ft} Add`,this.addButton=n,n.addEventListener("click",()=>{const a=s.value;a&&this.addLanguage(a)}),i.appendChild(s),i.appendChild(n),t.appendChild(e),t.appendChild(i),t}draw(){const t=document.createElement("div");if(t.classList.add("multi-language-wrapper"),this.props.title){const n=document.createElement("div");n.classList.add("multi-language-title"),n.textContent=this.props.title,t.appendChild(n)}const e=document.createElement("div");e.classList.add("multi-language-content");const i=document.createElement("div");i.classList.add("languages-container"),this.languagesContainer=i,this.value&&Object.entries(this.value).forEach(([n,a])=>{const o=this.createLanguageRow(n,a);i.appendChild(o)}),e.appendChild(i);const s=this.createAddLanguageSection();return e.appendChild(s),t.appendChild(e),this.updateAddLanguageSelect(),this.container=t,t}setValue(t){super.setValue(t),this.languagesContainer&&(this.languagesContainer.innerHTML="",this.value&&Object.entries(this.value).forEach(([e,i])=>{const s=this.createLanguageRow(e,i);this.languagesContainer.appendChild(s)}),this.updateAddLanguageSelect())}}class Ct extends g{constructor(t={}){super(t),this.inputType="select";const e=[{name:"None",value:"none"},{name:"Fade",value:"fade 1.5s ease-in-out infinite"},{name:"Slide",value:"slide 1.5s ease-in-out infinite"},{name:"Zoom",value:"zoom 1.5s ease-in-out infinite"},{name:"Bounce",value:"bounce 1.5s ease-in-out infinite"},{name:"Pulse",value:"pulse 1.5s ease-in-out infinite"}];this.selectSetting=new M({title:this.title||"Animation",options:e,default:this.props.default||"none"}),this.selectSetting.onChange=i=>{var s;this.value=i,(s=this.onChange)==null||s.call(this,i)}}draw(){return this.selectSetting.draw()}destroy(){this.selectSetting.destroy(),super.destroy()}}const wt=`
|
|
212
212
|
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
213
213
|
<path d="M5.625 9.5H5.6325M12.375 9.5H12.3825M9 9.5H9.0075M9 12.875H9.0075M9 6.125H9.0075M2.25 6.35L2.25 12.65C2.25 13.9101 2.25 14.5402 2.49524 15.0215C2.71095 15.4448 3.05516 15.789 3.47852 16.0048C3.95982 16.25 4.58988 16.25 5.85 16.25H12.15C13.4101 16.25 14.0402 16.25 14.5215 16.0048C14.9448 15.789 15.289 15.4448 15.5048 15.0215C15.75 14.5402 15.75 13.9101 15.75 12.65V6.35C15.75 5.08988 15.75 4.45982 15.5048 3.97852C15.289 3.55516 14.9448 3.21095 14.5215 2.99524C14.0402 2.75 13.4101 2.75 12.15 2.75L5.85 2.75C4.58988 2.75 3.95982 2.75 3.47852 2.99524C3.05516 3.21095 2.71095 3.55516 2.49524 3.97852C2.25 4.45982 2.25 5.08988 2.25 6.35Z" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
|
|
214
214
|
</svg>
|
|
215
|
-
`,
|
|
215
|
+
`,Et=`
|
|
216
216
|
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
217
217
|
<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"/>
|
|
218
218
|
</svg>
|
|
219
|
-
`;class
|
|
219
|
+
`;class bt extends v{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:Et,default:(t==null?void 0:t.size)??0,suffix:"px"}),color:new w({default:(t==null?void 0:t.color)??"0, 0, 30"}),radius:new C({title:"Radius",icon:wt,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`
|
|
220
220
|
border-color: ${t};
|
|
221
221
|
border-width: ${i}px;
|
|
222
222
|
border-radius: ${e}px;
|
|
223
|
-
`}}const
|
|
223
|
+
`}}const xt=`
|
|
224
224
|
<svg xmlns="http://www.w3.org/2000/svg" width="14" height="13" viewBox="0 0 14 13" fill="none">
|
|
225
225
|
<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"/>
|
|
226
226
|
</svg>
|
|
227
|
-
`,
|
|
227
|
+
`,yt=`
|
|
228
228
|
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
229
229
|
<path d="M3 5.75C3 5.05109 3 4.70163 3.11418 4.42597C3.26642 4.05843 3.55843 3.76642 3.92597 3.61418C4.20163 3.5 4.55109 3.5 5.25 3.5H12.75C13.4489 3.5 13.7984 3.5 14.074 3.61418C14.4416 3.76642 14.7336 4.05843 14.8858 4.42597C15 4.70163 15 5.05109 15 5.75M6 15.5H12M7.6875 3.5V15.5M10.3125 3.5V15.5" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
|
|
230
230
|
</svg>
|
|
231
|
-
`,
|
|
231
|
+
`,Lt=`
|
|
232
232
|
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
233
233
|
<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"/>
|
|
234
234
|
</svg>
|
|
235
|
-
`;class
|
|
235
|
+
`;class kt extends v{constructor(t={}){const{showAlign:e=t.showAlign??!0,...i}=t;super({title:i.title||"Typography",collapsed:i.collapsed,hideCondition:i.hideCondition,settings:(()=>{const s={color:new w({default:i.colorDefault??"0, 0, 30"}),fontFamily:new M({title:"Font",icon:xt,default:i.fontFamilyDefault??"Satoshi",options:i.fontFamilyOptions??[{name:"Alt",value:"Croco Sans Black Caps Alt"},{name:"Regular",value:"Croco Sans Caps Regular"},{name:"Caps",value:"Croco Sans Black Caps"},{name:"FaraGo",value:"'FiraGO', sans-serif"}],getOptions:i.fontFamilyGetOptions,getOptionsAsync:i.fontFamilyGetOptionsAsync}),fontWeight:new M({title:"Weight",icon:yt,default:i.fontWeightDefault??"400",options:i.fontWeightOptions??[{name:"Regular",value:"400"},{name:"Medium",value:"500"},{name:"Bold",value:"600"}],getOptions:i.fontWeightGetOptions,getOptionsAsync:i.fontWeightGetOptionsAsync}),fontSize:new C({title:"Size",icon:Lt,default:i.fontSizeDefault??12,suffix:"px",mobile:i.fontSizeMobileDefault})};return e?{...s,align:new R({title:"Align",default:i.alignDefault??"center"})}:s})()})}getCssCode(){var a;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=((a=this.settings.align)==null?void 0:a.value)??"left";return`
|
|
236
236
|
color: ${t};
|
|
237
237
|
font-family: ${e};
|
|
238
238
|
font-weight: ${i};
|
|
239
239
|
font-size: ${s}px;
|
|
240
240
|
text-align: ${n};
|
|
241
|
-
`}}class
|
|
241
|
+
`}}class y extends g{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,r=this.props.maxValue??Number.MAX_SAFE_INTEGER;let d=Number(o.value);d<l&&(d=l),d>r&&(d=r),o.value=String(d)}))},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 r=Number(l);isNaN(r)||(this.value=r)}this.onChange&&this.onChange(this.value)}),i}}class Mt extends v{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:St,suffix:"px",default:(t==null?void 0:t.marginTop)??"auto"}),marginRight:new y({title:"Right",icon:Vt,suffix:"px",default:(t==null?void 0:t.marginRight)??0}),marginBottom:new y({title:"Bottom",icon:It,suffix:"px",default:(t==null?void 0:t.marginBottom)??0}),marginLeft:new y({title:"Left",icon:Nt,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`
|
|
242
242
|
margin-top: ${t};
|
|
243
243
|
margin-right: ${e};
|
|
244
244
|
margin-bottom: ${i};
|
|
245
245
|
margin-left: ${s};
|
|
246
|
-
`}}const
|
|
246
|
+
`}}const St=`<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
247
247
|
<path d="M2.25 16.25H2.2575M2.25 9.5H2.2575M2.25 12.875H2.2575M2.25 6.125H2.2575M5.625 16.25H5.6325M5.625 9.5H5.6325M12.375 16.25H12.3825M12.375 9.5H12.3825M9 16.25H9.0075M9 9.5H9.0075M9 12.875H9.0075M9 6.125H9.0075M15.75 16.25H15.7575M15.75 9.5H15.7575M15.75 12.875H15.7575M15.75 6.125H15.7575M15.75 2.75H2.25" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
|
|
248
|
-
</svg>`,St=`<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
249
|
-
<path d="M5.625 2.75H5.6325M5.625 9.5H5.6325M5.625 16.25H5.6325M12.375 2.75H12.3825M12.375 9.5H12.3825M12.375 16.25H12.3825M9 2.75H9.0075M9 9.5H9.0075M9 16.25H9.0075M9 12.875H9.0075M9 6.125H9.0075M2.25 2.75H2.2575M2.25 9.5H2.2575M2.25 16.25H2.2575M2.25 12.875H2.2575M2.25 6.125H2.2575M15.75 16.25V2.75" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
|
|
250
248
|
</svg>`,Vt=`<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
249
|
+
<path d="M5.625 2.75H5.6325M5.625 9.5H5.6325M5.625 16.25H5.6325M12.375 2.75H12.3825M12.375 9.5H12.3825M12.375 16.25H12.3825M9 2.75H9.0075M9 9.5H9.0075M9 16.25H9.0075M9 12.875H9.0075M9 6.125H9.0075M2.25 2.75H2.2575M2.25 9.5H2.2575M2.25 16.25H2.2575M2.25 12.875H2.2575M2.25 6.125H2.2575M15.75 16.25V2.75" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
|
|
250
|
+
</svg>`,It=`<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
251
251
|
<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"/>
|
|
252
252
|
</svg>`,Nt=`<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
253
253
|
<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"/>
|
|
254
|
-
</svg>`;class
|
|
254
|
+
</svg>`;class Ot extends v{constructor(t){super({title:"Background Image",collapsed:t==null?void 0:t.collapsed,hideCondition:t==null?void 0:t.hideCondition,settings:{backgroundImage:new $({...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 w({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?`
|
|
255
255
|
background-image: url("${t}");
|
|
256
256
|
background-size: cover;
|
|
257
257
|
background-position: center;
|
|
258
258
|
opacity: ${e/100};
|
|
259
259
|
`:`
|
|
260
260
|
background-color: ${i};
|
|
261
|
-
`}}function
|
|
261
|
+
`}}function Ht(h){return h instanceof v}function Tt(h){return h instanceof g}exports.AlignSetting=R;exports.AnimationSetting=Ct;exports.BackgroundSettingSet=Ot;exports.BorderSettingSet=bt;exports.ButtonSetting=Z;exports.ColorSetting=f;exports.ColorWithOpacitySetting=w;exports.DimensionSetting=K;exports.GapSetting=ht;exports.HeaderTypographySettingSet=kt;exports.HeightSetting=it;exports.HtmlSetting=U;exports.MarginBottomSetting=ut;exports.MarginSettingGroup=Mt;exports.MarginTopSetting=gt;exports.MultiLanguageSetting=vt;exports.NumberSetting=C;exports.OpacitySetting=A;exports.SelectApiSettings=lt;exports.SelectSetting=M;exports.Setting=g;exports.SettingGroup=v;exports.StringSetting=B;exports.TabSettingGroup=H;exports.TabsSettingGroup=H;exports.Toggle=rt;exports.UploadSetting=$;exports.WidthSetting=nt;exports.asSettingGroupWithSettings=D;exports.createSettingGroup=T;exports.isSetting=Tt;exports.isSettingGroup=Ht;exports.iterateSettings=b;
|