builder-settings-types 0.0.309 → 0.0.311
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.
|
@@ -102,6 +102,10 @@ export declare class TabSettingGroup<TSettings extends SettingsMap = SettingsMap
|
|
|
102
102
|
constructor(groupProps: SettingGroupProps<TSettings>);
|
|
103
103
|
getActiveTabId(): string;
|
|
104
104
|
switchToTab(tabId: string): void;
|
|
105
|
+
getValues(): ExtractSettingValues<TSettings> & {
|
|
106
|
+
activeTabId: string;
|
|
107
|
+
};
|
|
108
|
+
getValues<K extends keyof TSettings>(childKey: K): unknown;
|
|
105
109
|
private updateTabUI;
|
|
106
110
|
draw(): HTMLElement;
|
|
107
111
|
}
|
|
@@ -79,7 +79,7 @@
|
|
|
79
79
|
xmlns="http://www.w3.org/2000/svg">
|
|
80
80
|
<path d="M8 3.333v9.334M3.333 8h9.334" stroke="currentColor"
|
|
81
81
|
stroke-width="1.5" stroke-linecap="round"/>
|
|
82
|
-
</svg>`;p.innerHTML=`${c}<span style="margin-left:4px;">${this.addItemCfg.buttonLabel??"Add"}</span>`,p.addEventListener("click",d=>{d.stopPropagation(),d.preventDefault();const u=this.getNextIndexFromPrefix(this.addItemCfg.keyPrefix),g=this.addItemCfg.createItem(u);if(et(g)){const f=`${this.addItemCfg.keyPrefix}${u}`;this.addSetting(f,g)}}),o.appendChild(p)}return e.appendChild(i),e.appendChild(n),t.appendChild(e),t.appendChild(o),this.elementRef=t,at.trackElement(t),setTimeout(()=>{this.updateNestingStyles()},0),this.pendingBlurHandler&&(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"))}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")}}};Y.hiddenElements=new Set;let T=Y;function St(h){return new st(h)}class st extends T{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 p=document.createElement("div");p.className="tab-panel",this.contentContainers[o]=p;const c=this.settings[o];c&&(L(c)&&typeof c.setNestingLevel=="function"&&c.setNestingLevel(this.getNestingLevel()+1),p.appendChild(c.draw())),a.appendChild(p),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 dt(h){return new T(h)}function Nt(h){return h}class pt extends x{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 It="<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 S extends pt{constructor(t){super({...t,icon:t.icon||It,title:t.title||"Color",default:t.default?S.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("var(--")?t:t.startsWith("#")?S.normalizeHexValue(t):t.includes(",")?S.rgbToHexStatic(t):S.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(p=>parseInt(p.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=p=>{const c=p.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=S.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 g=document.createElement("div");if(g.className="icon-container",this.props.icon){const f=document.createElement("span");f.className="input-icon",f.innerHTML=this.props.icon,g.appendChild(f)}if(this.props.title){const f=document.createElement("span");f.className="input-label",f.textContent=this.props.title,g.appendChild(f)}t.appendChild(g)}const e=document.createElement("div");e.className="color-input-wrapper";const i=document.createElement("div");i.className="color-setting-tabs",i.style.display="flex",i.style.marginBottom="8px",i.style.gap="4px";const s=document.createElement("button");s.className="color-tab active",s.textContent="Solid";const n=document.createElement("button");n.className="color-tab",n.textContent="Global",i.appendChild(s),i.appendChild(n);const a=document.createElement("div");a.className="color-content-solid";const o=document.createElement("div");o.className="color-content-global",o.style.display="none",o.style.display="grid",o.style.gridTemplateColumns="repeat(auto-fill, minmax(30px, 1fr))",o.style.gap="8px";const l=()=>{try{if(console.log("ColorSetting: renderGlobalOptions called"),o.innerHTML="",!x){console.error("ColorSetting: Setting class is undefined");const f=document.createElement("div");f.textContent="Error: System error (Setting undefined)",o.appendChild(f);return}const g=x.GlobalVariables||{};if(console.log("ColorSetting: GlobalVariables:",g),!g||Object.keys(g).length===0){const f=document.createElement("div");f.textContent="No global colors defined",f.style.gridColumn="1 / -1",f.style.fontSize="12px",f.style.color="#666",o.appendChild(f);return}Object.entries(g).forEach(([f,m])=>{const v=document.createElement("button");v.className="global-color-btn",v.title=f,v.style.width="30px",v.style.height="30px",v.style.borderRadius="50%",v.style.border="1px solid #ddd",v.style.backgroundColor=m,v.style.cursor="pointer",this.value===`var(--${f})`&&(v.style.border="2px solid #2196f3"),v.addEventListener("click",C=>{var E,M;C.preventDefault();const w=`var(--${f})`;this.value=w,(E=this.onChange)==null||E.call(this,w),(M=this.detectChange)==null||M.call(this,w),Array.from(o.children).forEach(y=>{y.style.border="1px solid #ddd"}),v.style.border="2px solid #2196f3",c.style.backgroundColor=m}),o.appendChild(v)})}catch(g){console.error("ColorSetting: Error in renderGlobalOptions",g),o.innerHTML="Error loading global options"}};l(),s.addEventListener("click",g=>{g.preventDefault(),s.classList.add("active"),n.classList.remove("active"),a.style.display="flex",o.style.display="none",this.value&&this.value.startsWith("var(--")}),n.addEventListener("click",g=>{g.preventDefault(),n.classList.add("active"),s.classList.remove("active"),a.style.display="none",o.style.display="grid",l()}),this.value&&this.value.startsWith("var(--")?n.click():s.click();const r=g=>{const f=g.value.trim();if(!f)return e.classList.remove("error"),!0;const v=/^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/.test(f);return v?e.classList.remove("error"):e.classList.add("error"),v},p=document.createElement("input");p.type="color",p.className="color-picker",p.value=this.value&&!this.value.startsWith("var(--")?this.value:"#000000",p.setAttribute("aria-label","Choose color"),p.setAttribute("title","Click to open color picker"),this.getDataPropsPath()&&p.setAttribute("data-test-id",this.getDataPropsPath()),this.colorInputEl=p;const c=document.createElement("div");c.className="color-preview";let d=this.value||"#000000";if(d.startsWith("var(--")){const g=d.replace("var(--","").replace(")","");d=(x.GlobalVariables||{})[g]||"#000000"}c.style.backgroundColor=d;const u=document.createElement("input");return u.type="text",u.className="color-text-input",u.value=this.value||"",u.placeholder="#000000",u.setAttribute("pattern","#[0-9A-Fa-f]{6}"),u.setAttribute("title","Enter a hex color value (e.g., #ff0000)"),u.setAttribute("aria-label","Hex color value"),u.setAttribute("maxlength","7"),this.getDataPropsPath()&&u.setAttribute("data-test-id",`${this.getDataPropsPath()}_text`),this.textInputEl=u,this.textInputEl.addEventListener("input",g=>{var m,v;let f=g.target.value.trim();if(this.textInputEl&&r(this.textInputEl)){const C=S.normalizeColorValue(f);this.value=C,(m=this.onChange)==null||m.call(this,C),(v=this.detectChange)==null||v.call(this,C),this.colorInputEl&&(this.colorInputEl.value=C),c.style.backgroundColor=C}}),this.colorInputEl.addEventListener("input",g=>{var v,C;const f=g.target.value,m=S.normalizeColorValue(f);this.value=m,(v=this.onChange)==null||v.call(this,m),(C=this.detectChange)==null||C.call(this,m),this.textInputEl&&(this.textInputEl.value=m),c.style.backgroundColor=m,e.classList.remove("error")}),this.colorInputEl.addEventListener("change",g=>{var v,C;const f=g.target.value,m=S.normalizeColorValue(f);this.value=m,(v=this.onChange)==null||v.call(this,m),(C=this.detectChange)==null||C.call(this,m),this.textInputEl&&(this.textInputEl.value=m),c.style.backgroundColor=m}),a.appendChild(p),a.appendChild(c),a.appendChild(u),e.appendChild(i),e.appendChild(a),e.appendChild(o),t.appendChild(e),this.element=t,t}getElement(){return this.element}getNormalizedValue(){return this.value?S.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 Vt=`
|
|
82
|
+
</svg>`;p.innerHTML=`${c}<span style="margin-left:4px;">${this.addItemCfg.buttonLabel??"Add"}</span>`,p.addEventListener("click",d=>{d.stopPropagation(),d.preventDefault();const u=this.getNextIndexFromPrefix(this.addItemCfg.keyPrefix),g=this.addItemCfg.createItem(u);if(et(g)){const v=`${this.addItemCfg.keyPrefix}${u}`;this.addSetting(v,g)}}),o.appendChild(p)}return e.appendChild(i),e.appendChild(n),t.appendChild(e),t.appendChild(o),this.elementRef=t,at.trackElement(t),setTimeout(()=>{this.updateNestingStyles()},0),this.pendingBlurHandler&&(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"))}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")}}};Y.hiddenElements=new Set;let T=Y;function St(h){return new st(h)}class st extends T{constructor(t){super(t);const e=Object.keys(this.settings)[0];this.activeTabId=e||""}getActiveTabId(){return this.activeTabId}switchToTab(t){var i;if(!this.settings[t]||this.activeTabId===t)return;this.activeTabId=t,this.updateTabUI();const e=this.getValues();this.initialValues=e,(i=this.onChange)==null||i.call(this,e)}getValues(t){return t!==void 0?super.getValues(t):{...super.getValues(),activeTabId:this.activeTabId}}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 p=document.createElement("div");p.className="tab-panel",this.contentContainers[o]=p;const c=this.settings[o];c&&(L(c)&&typeof c.setNestingLevel=="function"&&c.setNestingLevel(this.getNestingLevel()+1),p.appendChild(c.draw())),a.appendChild(p),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 dt(h){return new T(h)}function Nt(h){return h}class pt extends x{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 It="<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 S extends pt{constructor(t){super({...t,icon:t.icon||It,title:t.title||"Color",default:t.default?S.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("var(--")?t:t.startsWith("#")?S.normalizeHexValue(t):t.includes(",")?S.rgbToHexStatic(t):S.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(p=>parseInt(p.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=p=>{const c=p.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=S.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 g=document.createElement("div");if(g.className="icon-container",this.props.icon){const v=document.createElement("span");v.className="input-icon",v.innerHTML=this.props.icon,g.appendChild(v)}if(this.props.title){const v=document.createElement("span");v.className="input-label",v.textContent=this.props.title,g.appendChild(v)}t.appendChild(g)}const e=document.createElement("div");e.className="color-input-wrapper";const i=document.createElement("div");i.className="color-setting-tabs",i.style.display="flex",i.style.marginBottom="8px",i.style.gap="4px";const s=document.createElement("button");s.className="color-tab active",s.textContent="Solid";const n=document.createElement("button");n.className="color-tab",n.textContent="Global",i.appendChild(s),i.appendChild(n);const a=document.createElement("div");a.className="color-content-solid";const o=document.createElement("div");o.className="color-content-global",o.style.display="none",o.style.display="grid",o.style.gridTemplateColumns="repeat(auto-fill, minmax(30px, 1fr))",o.style.gap="8px";const l=()=>{try{if(console.log("ColorSetting: renderGlobalOptions called"),o.innerHTML="",!x){console.error("ColorSetting: Setting class is undefined");const v=document.createElement("div");v.textContent="Error: System error (Setting undefined)",o.appendChild(v);return}const g=x.GlobalVariables||{};if(console.log("ColorSetting: GlobalVariables:",g),!g||Object.keys(g).length===0){const v=document.createElement("div");v.textContent="No global colors defined",v.style.gridColumn="1 / -1",v.style.fontSize="12px",v.style.color="#666",o.appendChild(v);return}Object.entries(g).forEach(([v,m])=>{const f=document.createElement("button");f.className="global-color-btn",f.title=v,f.style.width="30px",f.style.height="30px",f.style.borderRadius="50%",f.style.border="1px solid #ddd",f.style.backgroundColor=m,f.style.cursor="pointer",this.value===`var(--${v})`&&(f.style.border="2px solid #2196f3"),f.addEventListener("click",C=>{var E,M;C.preventDefault();const w=`var(--${v})`;this.value=w,(E=this.onChange)==null||E.call(this,w),(M=this.detectChange)==null||M.call(this,w),Array.from(o.children).forEach(y=>{y.style.border="1px solid #ddd"}),f.style.border="2px solid #2196f3",c.style.backgroundColor=m}),o.appendChild(f)})}catch(g){console.error("ColorSetting: Error in renderGlobalOptions",g),o.innerHTML="Error loading global options"}};l(),s.addEventListener("click",g=>{g.preventDefault(),s.classList.add("active"),n.classList.remove("active"),a.style.display="flex",o.style.display="none",this.value&&this.value.startsWith("var(--")}),n.addEventListener("click",g=>{g.preventDefault(),n.classList.add("active"),s.classList.remove("active"),a.style.display="none",o.style.display="grid",l()}),this.value&&this.value.startsWith("var(--")?n.click():s.click();const r=g=>{const v=g.value.trim();if(!v)return e.classList.remove("error"),!0;const f=/^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/.test(v);return f?e.classList.remove("error"):e.classList.add("error"),f},p=document.createElement("input");p.type="color",p.className="color-picker",p.value=this.value&&!this.value.startsWith("var(--")?this.value:"#000000",p.setAttribute("aria-label","Choose color"),p.setAttribute("title","Click to open color picker"),this.getDataPropsPath()&&p.setAttribute("data-test-id",this.getDataPropsPath()),this.colorInputEl=p;const c=document.createElement("div");c.className="color-preview";let d=this.value||"#000000";if(d.startsWith("var(--")){const g=d.replace("var(--","").replace(")","");d=(x.GlobalVariables||{})[g]||"#000000"}c.style.backgroundColor=d;const u=document.createElement("input");return u.type="text",u.className="color-text-input",u.value=this.value||"",u.placeholder="#000000",u.setAttribute("pattern","#[0-9A-Fa-f]{6}"),u.setAttribute("title","Enter a hex color value (e.g., #ff0000)"),u.setAttribute("aria-label","Hex color value"),u.setAttribute("maxlength","7"),this.getDataPropsPath()&&u.setAttribute("data-test-id",`${this.getDataPropsPath()}_text`),this.textInputEl=u,this.textInputEl.addEventListener("input",g=>{var m,f;let v=g.target.value.trim();if(this.textInputEl&&r(this.textInputEl)){const C=S.normalizeColorValue(v);this.value=C,(m=this.onChange)==null||m.call(this,C),(f=this.detectChange)==null||f.call(this,C),this.colorInputEl&&(this.colorInputEl.value=C),c.style.backgroundColor=C}}),this.colorInputEl.addEventListener("input",g=>{var f,C;const v=g.target.value,m=S.normalizeColorValue(v);this.value=m,(f=this.onChange)==null||f.call(this,m),(C=this.detectChange)==null||C.call(this,m),this.textInputEl&&(this.textInputEl.value=m),c.style.backgroundColor=m,e.classList.remove("error")}),this.colorInputEl.addEventListener("change",g=>{var f,C;const v=g.target.value,m=S.normalizeColorValue(v);this.value=m,(f=this.onChange)==null||f.call(this,m),(C=this.detectChange)==null||C.call(this,m),this.textInputEl&&(this.textInputEl.value=m),c.style.backgroundColor=m}),a.appendChild(p),a.appendChild(c),a.appendChild(u),e.appendChild(i),e.appendChild(a),e.appendChild(o),t.appendChild(e),this.element=t,t}getElement(){return this.element}getNormalizedValue(){return this.value?S.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 Vt=`
|
|
83
83
|
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
84
84
|
<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"/>
|
|
85
85
|
<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"/>
|
|
@@ -186,7 +186,7 @@
|
|
|
186
186
|
</svg>`;class Kt extends I{constructor(t={}){super({...t,minValue:t.minValue??0,maxValue:t.maxValue??1e3,icon:t.icon||Xt,title:t.title||"Margin Bottom",default:t.default??20,wrapperClassName:"margin-bottom-wrapper "+(t.wrapperClassName||"")}),this.inputType="number"}}const Yt=`<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
187
187
|
<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"
|
|
188
188
|
stroke="#667085" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
189
|
-
</svg>`;class Qt extends I{constructor(t={}){super({...t,minValue:t.minValue??0,maxValue:t.maxValue??1e3,icon:t.icon||Yt,title:t.title||"Margin Top",default:t.default??20,wrapperClassName:"margin-top-wrapper "+(t.wrapperClassName||"")}),this.inputType="number"}}class te extends x{constructor(t){super(t),this.inputType={},this.container=null,this.defaultLanguage="",this.uploadSettings=new Map,t.default?this.value={...t.default}:this.value||(this.value={}),this.defaultLanguage=t.languages.includes(x.DefaultLanguage)?x.DefaultLanguage:t.languages[0];const e=t.defaultValue||`Enter text in ${this.capitalizeFirstLetter(this.defaultLanguage)}`;t.languages.forEach(i=>{var s,n;i in(this.value||{})||(this.value||(this.value={}),i===this.defaultLanguage&&e?this.value[i]=((s=t.default)==null?void 0:s[i])||e:this.value[i]=((n=t.default)==null?void 0:n[i])||"")})}capitalizeFirstLetter(t){return String(t).charAt(0).toUpperCase()+String(t).slice(1)}measureTextWidth(t,e){this.textMeasureCanvas||(this.textMeasureCanvas=document.createElement("canvas"));const i=this.textMeasureCanvas.getContext("2d");if(!i)return t.length*10;const s=`${e.fontStyle} ${e.fontWeight} ${e.fontSize} ${e.fontFamily}`.trim();return i.font=s,i.measureText(t).width}adaptPlaceholderToSingleLine(t,e){const i=window.getComputedStyle(t),s=parseFloat(i.paddingLeft)||0,n=parseFloat(i.paddingRight)||0,a=parseFloat(i.borderLeftWidth)||0,o=parseFloat(i.borderRightWidth)||0,l=Math.max(0,t.clientWidth-s-n-a-o);if(l<=0){t.placeholder=e;return}if(this.measureTextWidth(e,i)<=l){t.placeholder=e;return}const p="...";let c=0,d=e.length,u=0;for(;c<=d;){const f=Math.floor((c+d)/2),m=e.slice(0,f).trimEnd()+p;this.measureTextWidth(m,i)<=l?(u=f,c=f+1):d=f-1}const g=e.slice(0,u).trimEnd()+p;t.placeholder=g}autosizeTextarea(t,e=3){t.style.height="auto";const i=window.getComputedStyle(t),s=parseFloat(i.lineHeight)||20,n=parseFloat(i.paddingTop)+parseFloat(i.paddingBottom),a=parseFloat(i.borderTopWidth)+parseFloat(i.borderBottomWidth),o=s*e+n+a,l=Math.min(t.scrollHeight||44,o);t.style.height=`${l}px`,t.scrollHeight>o?t.style.overflowY="auto":t.style.overflowY="hidden"}createTextareaRow(t,e){const i=document.createElement("div");i.classList.add("simple-multi-language-row");const s=document.createElement("label");if(s.classList.add("simple-language-label"),s.textContent=t.toUpperCase(),s.setAttribute("for",`textarea-${t}`),i.appendChild(s),this.props.multiImg){const n=new nt({defaultUrl:e||"",title:"",id:`${this.id}_upload_${t}`});n.setOnChange(o=>{this.updateLanguageValue(t,o),t===this.defaultLanguage&&this.updateOtherLanguagePlaceholders(o)}),this.uploadSettings.set(t,n);const a=n.draw();a.classList.add("simple-language-upload"),i.appendChild(a)}else{const n=document.createElement("textarea");n.id=`textarea-${t}`,n.classList.add("simple-language-textarea"),n.value=e||"",n.rows=1,n.style.overflowY="hidden";let a=this.props.placeholder||"Enter text in {language}...";a.includes("{language}")&&(a=a.replace("{language}",t.toUpperCase())),n.setAttribute("data-full-placeholder",a),this.adaptPlaceholderToSingleLine(n,a),this.getDataPropsPath()&&n.setAttribute("data-test-id",`${this.getDataPropsPath()}_${t}`),n.addEventListener("input",l=>{const r=l.target;this.updateLanguageValue(t,r.value),t===this.defaultLanguage&&this.updateOtherLanguagePlaceholders(r.value),this.autosizeTextarea(r,3);const p=n.getAttribute("data-full-placeholder")||"";p&&this.adaptPlaceholderToSingleLine(n,p)}),i.appendChild(n),(l=>(typeof queueMicrotask=="function"?queueMicrotask:r=>setTimeout(r,0))(l))(()=>{this.autosizeTextarea(n,3);const l=n.getAttribute("data-full-placeholder")||"";l&&this.adaptPlaceholderToSingleLine(n,l)})}return i}updateLanguageValue(t,e){this.value||(this.value={});const i={...this.value,[t]:e};this.setValue(i)}updateOtherLanguagePlaceholders(t){this.container&&this.props.languages.forEach(e=>{var s,n;if(e===this.defaultLanguage)return;const i=(s=this.container)==null?void 0:s.querySelector(`#textarea-${e}`);if(i&&(!i.value||i.value.trim()==="")){const a=t||((n=this.props.placeholder)==null?void 0:n.replace("{language}",e.toUpperCase()))||`Enter text in ${e.toUpperCase()}...`;i.setAttribute("data-full-placeholder",a),this.adaptPlaceholderToSingleLine(i,a)}})}draw(){const t=document.createElement("div");if(t.classList.add("simple-multi-language-wrapper"),this.props.title){const s=document.createElement("div");s.classList.add("simple-multi-language-title"),s.textContent=this.props.title,t.appendChild(s)}const e=document.createElement("div");e.classList.add("simple-multi-language-content"),this.props.languages.forEach(s=>{var o;const n=((o=this.value)==null?void 0:o[s])||"",a=this.createTextareaRow(s,n);e.appendChild(a)}),t.appendChild(e),this.container=t;const i=()=>{if(!this.container)return;this.container.querySelectorAll(".simple-language-textarea").forEach(n=>{const a=n.getAttribute("data-full-placeholder")||"";a&&this.adaptPlaceholderToSingleLine(n,a)})};return window.addEventListener("resize",i),t}setValue(t){super.setValue(t),this.container&&this.props.languages.forEach(e=>{var i;if(this.props.multiImg){const s=this.uploadSettings.get(e);s&&s.setValue((t==null?void 0:t[e])||"")}else{const s=(i=this.container)==null?void 0:i.querySelector(`#textarea-${e}`);if(s){s.value=(t==null?void 0:t[e])||"",this.autosizeTextarea(s,3);const n=s.getAttribute("data-full-placeholder")||"";n&&this.adaptPlaceholderToSingleLine(s,n)}}})}}class ee extends x{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 K({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 mt=(h,t,e)=>{let i=!1,s=0,n=0,a=0,o=0;const l=c=>{if(c.target.closest("button"))return;i=!0,s=c.clientX,n=c.clientY;const d=t.getBoundingClientRect();a=d.left,o=d.top,document.addEventListener("mousemove",r),document.addEventListener("mouseup",p),document.body.style.userSelect="none"},r=c=>{if(!i)return;const d=c.clientX-s,u=c.clientY-n,g=window.innerWidth,f=window.innerHeight,m=t.offsetWidth,v=t.offsetHeight;let C=a+d,w=o+u;C=Math.max(8,Math.min(g-m-8,C)),w=Math.max(8,Math.min(f-v-8,w)),t.style.left=`${C}px`,t.style.top=`${w}px`,e==null||e(C,w)},p=()=>{i=!1,document.removeEventListener("mousemove",r),document.removeEventListener("mouseup",p),document.body.style.userSelect=""};h.addEventListener("mousedown",l)},W=h=>{if(!h)return null;let t=h.trim();return!t.startsWith("#")||(t=t.slice(1),t.length===3&&(t=t.split("").map(e=>e+e).join("")),!/^[0-9a-fA-F]{6}$/.test(t))?null:`#${t.toUpperCase()}`},J=(h,t,e)=>`#${[h,t,e].map(i=>Math.max(0,Math.min(255,i)).toString(16).padStart(2,"0")).join("")}`,N=h=>{const t=h.replace("#",""),e=t.length===3?t.split("").map(i=>i+i).join(""):t;return{r:parseInt(e.slice(0,2),16),g:parseInt(e.slice(2,4),16),b:parseInt(e.slice(4,6),16)}},R=h=>{const{r:t,g:e,b:i}=N(h),s=t/255,n=e/255,a=i/255,o=Math.max(s,n,a),l=Math.min(s,n,a),r=o-l;let p=0;r!==0&&(o===s?p=(n-a)/r%6:o===n?p=(a-s)/r+2:p=(s-n)/r+4),p<0&&(p+=6);const c=o===0?0:r/o,d=o;return{h:p*60,s:c,v:d}},F=(h,t,e)=>{const i=(h%360+360)%360,s=e*t,n=s*(1-Math.abs(i/60%2-1)),a=e-s;let o=0,l=0,r=0;return i<60?(o=s,l=n,r=0):i<120?(o=n,l=s,r=0):i<180?(o=0,l=s,r=n):i<240?(o=0,l=n,r=s):i<300?(o=n,l=0,r=s):(o=s,l=0,r=n),J(Math.round((o+a)*255),Math.round((l+a)*255),Math.round((r+a)*255))},ft=(h,t,e)=>{const i=e*(1-t/2),s=i===0||i===1?0:(e-i)/Math.min(i,1-i);return{hue:h,sat:s,lightness:i}},it=(h,t,e)=>{const i=(1-Math.abs(2*e-1))*t,s=i*(1-Math.abs(h/60%2-1)),n=e-i/2;let a=0,o=0,l=0;return h<60?(a=i,o=s,l=0):h<120?(a=s,o=i,l=0):h<180?(a=0,o=i,l=s):h<240?(a=0,o=s,l=i):h<300?(a=s,o=0,l=i):(a=i,o=0,l=s),{r:Math.round((a+n)*255),g:Math.round((o+n)*255),b:Math.round((l+n)*255)}},vt=(h,t)=>{const e=Math.max(0,Math.min(100,t))/100;if(h.startsWith("#")){const{r:s,g:n,b:a}=N(h);return`rgba(${s}, ${n}, ${a}, ${e})`}if(h.startsWith("rgba("))return h.replace(/,\s*[\d.]+\)$/,`, ${e})`);if(h.startsWith("rgb("))return h.replace("rgb(","rgba(").replace(")",`, ${e})`);if(h.startsWith("hsl(")){const s=h.match(/hsl\((\d+),\s*(\d+)%,\s*(\d+)%\)/);if(s){const{r:n,g:a,b:o}=it(parseInt(s[1]),parseInt(s[2])/100,parseInt(s[3])/100);return`rgba(${n}, ${a}, ${o}, ${e})`}}if(h.startsWith("hsla(")){const s=h.match(/hsla\((\d+),\s*(\d+)%,\s*(\d+)%,\s*[\d.]+\)/);if(s){const{r:n,g:a,b:o}=it(parseInt(s[1]),parseInt(s[2])/100,parseInt(s[3])/100);return`rgba(${n}, ${a}, ${o}, ${e})`}}const i=W(h);if(i){const{r:s,g:n,b:a}=N(i);return`rgba(${s}, ${n}, ${a}, ${e})`}return h},ie=h=>["red","green","blue","yellow","orange","purple","pink","brown","black","white","gray","grey","cyan","magenta","lime","navy","maroon","olive","aqua","silver","teal","fuchsia","transparent"].includes(h.toLowerCase()),Ct=h=>[/^#[0-9a-fA-F]{3,8}$/,/^rgba?\s*\([^)]+\)$/,/^hsla?\s*\([^)]+\)$/,/^[a-zA-Z]+$/].some(e=>e.test(h.trim())),se=h=>{if(typeof document>"u")return Ct(h)||!!W(h);const t=document.createElement("div");return t.style.color=h,t.style.color!==""},yt=h=>{const t=h.trim();if(/^#[0-9A-Fa-f]{8}$/.test(t)){const n=t.slice(1),a=parseInt(n.slice(0,2),16),o=parseInt(n.slice(2,4),16),l=parseInt(n.slice(4,6),16),r=parseInt(n.slice(6,8),16);return{color:J(a,o,l),position:0,opacity:Math.round(r/255*100)}}const e=t.match(/rgba?\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*([\d.]+))?\s*\)/);if(e){const n=parseInt(e[1]),a=parseInt(e[2]),o=parseInt(e[3]),l=e[4]?parseFloat(e[4]):1;return{color:J(n,a,o),position:0,opacity:Math.round(l*100)}}const i=t.match(/hsla?\s*\(\s*([\d.]+)\s*,\s*([\d.]+)%\s*,\s*([\d.]+)%(?:\s*,\s*([\d.]+))?\s*\)/);if(i){const{r:n,g:a,b:o}=it(parseFloat(i[1]),parseFloat(i[2])/100,parseFloat(i[3])/100),l=i[4]?parseFloat(i[4]):1;return{color:J(n,a,o),position:0,opacity:Math.round(l*100)}}return{color:W(t)||t,position:0,opacity:100}},lt=h=>{const t=[];let e="",i=0;for(let s=0;s<h.length;s++){const n=h[s];if(n==="(")i++;else if(n===")")i--;else if(n===","&&i===0){t.push(e.trim()),e="";continue}e+=n}return e.trim()&&t.push(e.trim()),t},rt=(h,t)=>{const e=new RegExp(`${t}\\s*\\(`,"i"),i=h.match(e);if(!i)return null;const s=i.index+i[0].length;let n=1,a=s;for(let o=s;o<h.length&&n>0;o++)h[o]==="("?n++:h[o]===")"&&n--,a=o;return n===0?h.substring(s,a):null},ne=h=>{const t=h.split(" ")[0].toLowerCase();return["circle","ellipse","closest-side","closest-corner","farthest-side","farthest-corner","at","contain","cover"].includes(t)?!1:/^#[0-9a-f]{3,8}$/i.test(t)||/^rgb/i.test(h)||/^hsl/i.test(h)||ie(t)},ct=h=>{const t=[];return h.forEach((e,i)=>{const s=e.trim();if(!s)return;let n="",a=0;const o=s.match(/^(.+?)\s+(\d+(?:\.\d+)?)%?\s*$/);o&&Ct(o[1].trim())?(n=o[1].trim(),a=parseFloat(o[2])):(n=s,a=h.length===1?0:i/(h.length-1)*100);const l=yt(n);l.position=Math.max(0,Math.min(100,Math.round(a))),t.push(l)}),t},$=h=>{const t=h.stops&&h.stops.length?h.stops:[{color:"#000000",position:0,opacity:100}];return{type:h.type&&["linear","radial","solid"].includes(h.type)?h.type:"linear",angle:typeof h.angle=="number"?h.angle:90,stops:t.map((e,i)=>({color:e.color||"#000000",position:typeof e.position=="number"?e.position:t.length===1?0:Math.round(i/(t.length-1)*100),opacity:e.opacity===void 0||Number.isNaN(e.opacity)?100:e.opacity}))}},V=h=>{const t=h.replace(/;$/,"").trim();if(se(t)){const s=yt(t);return $({type:"solid",angle:0,stops:[s]})}const e=rt(t,"linear-gradient");if(e){const s=lt(e);let n=90,a=s;const o=s[0];if(o.includes("deg")){const r=o.match(/(-?\d+(?:\.\d+)?)deg/);r&&(n=parseFloat(r[1]),a=s.slice(1))}else o.includes("to ")&&(n={"to right":90,"to left":270,"to bottom":180,"to top":0,"to bottom right":135,"to bottom left":225,"to top right":45,"to top left":315}[o]??90,a=s.slice(1));const l=ct(a);return l.length?$({type:"linear",angle:n,stops:l}):null}const i=rt(t,"radial-gradient");if(i){const s=lt(i),n=s[0]&&!ne(s[0])?s.slice(1):s,a=ct(n);return a.length?$({type:"radial",angle:0,stops:a}):null}return null},O=h=>{if(h.type==="solid"){const e=h.stops[0],i=e.color;if(i.startsWith("var(--"))return i;const s=e.opacity??100,n=i.replace("#",""),a=Math.round(s/100*255).toString(16).toUpperCase().padStart(2,"0");return`#${n}${a}`}const t=h.stops.map(e=>`${vt(e.color,e.opacity??100)} ${e.position}%`).join(", ");return h.type==="radial"?`radial-gradient(circle, ${t})`:`linear-gradient(${h.angle}deg, ${t})`},oe=h=>Math.round(h/100*255).toString(16).toUpperCase().padStart(2,"0"),Z=h=>{if(h.type==="solid"){const t=h.stops[0];if(t){const e=t.color;if(e.startsWith("var(--"))return e.replace("var(--","").replace(")","").split("-").map(n=>n.charAt(0).toUpperCase()+n.slice(1)).join(" ");e.toUpperCase();const i=t.opacity??100;if(i===100)return e;{const s=oe(i);return`${e}${s}`}}return"#000000"}return h.type==="linear"?`Linear ${h.angle}°`:"Radial Gradient"},z=class z{static defaults(){return{solid:[],gradient:[]}}static normalizeList(t){const e=new Set,i=[];return t.forEach(s=>{let n=W(s);n||V(s)&&(n=s),n&&(e.has(n)||(e.add(n),i.push(n)))}),i.slice(0,this.MAX_COLORS)}static ensureLoaded(){var t;if(!this.colors&&(this.colors=this.defaults(),!(typeof window>"u")))try{const e=(t=window.sessionStorage)==null?void 0:t.getItem(this.STORAGE_KEY);if(!e)return;const i=JSON.parse(e);if(Array.isArray(i))this.colors.solid=this.normalizeList(i);else if(i&&typeof i=="object"){const s=i;s.solid&&(this.colors.solid=this.normalizeList(s.solid)),s.gradient&&(this.colors.gradient=this.normalizeList(s.gradient))}}catch{this.colors=this.defaults()}}static persist(){var t;if(!(typeof window>"u"))try{(t=window.sessionStorage)==null||t.setItem(this.STORAGE_KEY,JSON.stringify(this.colors||this.defaults()))}catch{}}static list(t){return this.ensureLoaded(),this.colors||(this.colors=this.defaults()),this.colors[t]}static getColors(t){if(t==="all"){const e=this.list("solid"),i=this.list("gradient"),s=[...e,...i];return this.normalizeList(s)}return[...this.list(t)]}static addColor(t,e){if(!t)return;let i=W(t),s="solid";if(i)s="solid";else{const l=V(t);l&&(i=t,s=l.type==="solid"?"solid":"gradient")}if(!i)return;const n=e==="all"?s:e,a=this.list(n),o=a.indexOf(i);o!==-1&&a.splice(o,1),a.unshift(i),a.length>this.MAX_COLORS&&(a.length=this.MAX_COLORS),this.persist()}};z.STORAGE_KEY="settingsLib_recentColors",z.MAX_COLORS=12,z.colors=null;let G=z;const ot=(h,t)=>{const e=document.createElement("div");e.className="color-picker-recent-section";const i=document.createElement("div");i.className="color-picker-recent-title",i.textContent="Recently Used";const s=document.createElement("div");s.className="color-picker-tooltip",s.style.display="none",e.appendChild(s);const n=()=>{s.style.display="none"},a=(p,c)=>{const d=p.getBoundingClientRect();s.textContent=c,s.style.left=`${d.left+d.width/2}px`,s.style.top=`${d.bottom+8}px`,s.style.display="block"},o=document.createElement("div");o.className="color-picker-recent-grid";const l=document.createElement("div");l.className="color-picker-recent-placeholder",l.textContent="No recent colors yet",e.appendChild(i),e.appendChild(o),e.appendChild(l);const r=()=>{n(),o.innerHTML="";const p=G.getColors(t);if(p.length===0){o.style.display="none",l.style.display="block";return}o.style.display="grid",l.style.display="none",p.forEach(c=>{const d=document.createElement("button");d.type="button",d.className="color-picker-recent-swatch";const u=ae(c);d.title=u,d.setAttribute("aria-label",`Use color: ${u}`),d.style.background=c,d.style.borderColor=c,d.addEventListener("mouseenter",()=>a(d,u)),d.addEventListener("mouseleave",()=>{n(),d.style.boxShadow=""}),d.addEventListener("mousedown",()=>{d.style.boxShadow="0px 0px 0px 2px var(--grey40)"}),d.addEventListener("mouseup",()=>{setTimeout(()=>{d.style.boxShadow=""},150)}),d.addEventListener("click",()=>{n(),h(c)}),o.appendChild(d)})};return r(),{container:e,refresh:r}},ae=h=>{const t=V(h);if(t)return Z(t);const e=W(h);if(e){const i=N(e);return`${e} (RGB: ${i.r}, ${i.g}, ${i.b})`}return h},bt=`<svg width="13" height="13" viewBox="0 0 13 13" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
189
|
+
</svg>`;class Qt extends I{constructor(t={}){super({...t,minValue:t.minValue??0,maxValue:t.maxValue??1e3,icon:t.icon||Yt,title:t.title||"Margin Top",default:t.default??20,wrapperClassName:"margin-top-wrapper "+(t.wrapperClassName||"")}),this.inputType="number"}}class te extends x{constructor(t){super(t),this.inputType={},this.container=null,this.defaultLanguage="",this.uploadSettings=new Map,t.default?this.value={...t.default}:this.value||(this.value={}),this.defaultLanguage=t.languages.includes(x.DefaultLanguage)?x.DefaultLanguage:t.languages[0];const e=t.defaultValue||`Enter text in ${this.capitalizeFirstLetter(this.defaultLanguage)}`;t.languages.forEach(i=>{var s,n;i in(this.value||{})||(this.value||(this.value={}),i===this.defaultLanguage&&e?this.value[i]=((s=t.default)==null?void 0:s[i])||e:this.value[i]=((n=t.default)==null?void 0:n[i])||"")})}capitalizeFirstLetter(t){return String(t).charAt(0).toUpperCase()+String(t).slice(1)}measureTextWidth(t,e){this.textMeasureCanvas||(this.textMeasureCanvas=document.createElement("canvas"));const i=this.textMeasureCanvas.getContext("2d");if(!i)return t.length*10;const s=`${e.fontStyle} ${e.fontWeight} ${e.fontSize} ${e.fontFamily}`.trim();return i.font=s,i.measureText(t).width}adaptPlaceholderToSingleLine(t,e){const i=window.getComputedStyle(t),s=parseFloat(i.paddingLeft)||0,n=parseFloat(i.paddingRight)||0,a=parseFloat(i.borderLeftWidth)||0,o=parseFloat(i.borderRightWidth)||0,l=Math.max(0,t.clientWidth-s-n-a-o);if(l<=0){t.placeholder=e;return}if(this.measureTextWidth(e,i)<=l){t.placeholder=e;return}const p="...";let c=0,d=e.length,u=0;for(;c<=d;){const v=Math.floor((c+d)/2),m=e.slice(0,v).trimEnd()+p;this.measureTextWidth(m,i)<=l?(u=v,c=v+1):d=v-1}const g=e.slice(0,u).trimEnd()+p;t.placeholder=g}autosizeTextarea(t,e=3){t.style.height="auto";const i=window.getComputedStyle(t),s=parseFloat(i.lineHeight)||20,n=parseFloat(i.paddingTop)+parseFloat(i.paddingBottom),a=parseFloat(i.borderTopWidth)+parseFloat(i.borderBottomWidth),o=s*e+n+a,l=Math.min(t.scrollHeight||44,o);t.style.height=`${l}px`,t.scrollHeight>o?t.style.overflowY="auto":t.style.overflowY="hidden"}createTextareaRow(t,e){const i=document.createElement("div");i.classList.add("simple-multi-language-row");const s=document.createElement("label");if(s.classList.add("simple-language-label"),s.textContent=t.toUpperCase(),s.setAttribute("for",`textarea-${t}`),i.appendChild(s),this.props.multiImg){const n=new nt({defaultUrl:e||"",title:"",id:`${this.id}_upload_${t}`});n.setOnChange(o=>{this.updateLanguageValue(t,o),t===this.defaultLanguage&&this.updateOtherLanguagePlaceholders(o)}),this.uploadSettings.set(t,n);const a=n.draw();a.classList.add("simple-language-upload"),i.appendChild(a)}else{const n=document.createElement("textarea");n.id=`textarea-${t}`,n.classList.add("simple-language-textarea"),n.value=e||"",n.rows=1,n.style.overflowY="hidden";let a=this.props.placeholder||"Enter text in {language}...";a.includes("{language}")&&(a=a.replace("{language}",t.toUpperCase())),n.setAttribute("data-full-placeholder",a),this.adaptPlaceholderToSingleLine(n,a),this.getDataPropsPath()&&n.setAttribute("data-test-id",`${this.getDataPropsPath()}_${t}`),n.addEventListener("input",l=>{const r=l.target;this.updateLanguageValue(t,r.value),t===this.defaultLanguage&&this.updateOtherLanguagePlaceholders(r.value),this.autosizeTextarea(r,3);const p=n.getAttribute("data-full-placeholder")||"";p&&this.adaptPlaceholderToSingleLine(n,p)}),i.appendChild(n),(l=>(typeof queueMicrotask=="function"?queueMicrotask:r=>setTimeout(r,0))(l))(()=>{this.autosizeTextarea(n,3);const l=n.getAttribute("data-full-placeholder")||"";l&&this.adaptPlaceholderToSingleLine(n,l)})}return i}updateLanguageValue(t,e){this.value||(this.value={});const i={...this.value,[t]:e};this.setValue(i)}updateOtherLanguagePlaceholders(t){this.container&&this.props.languages.forEach(e=>{var s,n;if(e===this.defaultLanguage)return;const i=(s=this.container)==null?void 0:s.querySelector(`#textarea-${e}`);if(i&&(!i.value||i.value.trim()==="")){const a=t||((n=this.props.placeholder)==null?void 0:n.replace("{language}",e.toUpperCase()))||`Enter text in ${e.toUpperCase()}...`;i.setAttribute("data-full-placeholder",a),this.adaptPlaceholderToSingleLine(i,a)}})}draw(){const t=document.createElement("div");if(t.classList.add("simple-multi-language-wrapper"),this.props.title){const s=document.createElement("div");s.classList.add("simple-multi-language-title"),s.textContent=this.props.title,t.appendChild(s)}const e=document.createElement("div");e.classList.add("simple-multi-language-content"),this.props.languages.forEach(s=>{var o;const n=((o=this.value)==null?void 0:o[s])||"",a=this.createTextareaRow(s,n);e.appendChild(a)}),t.appendChild(e),this.container=t;const i=()=>{if(!this.container)return;this.container.querySelectorAll(".simple-language-textarea").forEach(n=>{const a=n.getAttribute("data-full-placeholder")||"";a&&this.adaptPlaceholderToSingleLine(n,a)})};return window.addEventListener("resize",i),t}setValue(t){super.setValue(t),this.container&&this.props.languages.forEach(e=>{var i;if(this.props.multiImg){const s=this.uploadSettings.get(e);s&&s.setValue((t==null?void 0:t[e])||"")}else{const s=(i=this.container)==null?void 0:i.querySelector(`#textarea-${e}`);if(s){s.value=(t==null?void 0:t[e])||"",this.autosizeTextarea(s,3);const n=s.getAttribute("data-full-placeholder")||"";n&&this.adaptPlaceholderToSingleLine(s,n)}}})}}class ee extends x{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 K({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 mt=(h,t,e)=>{let i=!1,s=0,n=0,a=0,o=0;const l=c=>{if(c.target.closest("button"))return;i=!0,s=c.clientX,n=c.clientY;const d=t.getBoundingClientRect();a=d.left,o=d.top,document.addEventListener("mousemove",r),document.addEventListener("mouseup",p),document.body.style.userSelect="none"},r=c=>{if(!i)return;const d=c.clientX-s,u=c.clientY-n,g=window.innerWidth,v=window.innerHeight,m=t.offsetWidth,f=t.offsetHeight;let C=a+d,w=o+u;C=Math.max(8,Math.min(g-m-8,C)),w=Math.max(8,Math.min(v-f-8,w)),t.style.left=`${C}px`,t.style.top=`${w}px`,e==null||e(C,w)},p=()=>{i=!1,document.removeEventListener("mousemove",r),document.removeEventListener("mouseup",p),document.body.style.userSelect=""};h.addEventListener("mousedown",l)},W=h=>{if(!h)return null;let t=h.trim();return!t.startsWith("#")||(t=t.slice(1),t.length===3&&(t=t.split("").map(e=>e+e).join("")),!/^[0-9a-fA-F]{6}$/.test(t))?null:`#${t.toUpperCase()}`},J=(h,t,e)=>`#${[h,t,e].map(i=>Math.max(0,Math.min(255,i)).toString(16).padStart(2,"0")).join("")}`,N=h=>{const t=h.replace("#",""),e=t.length===3?t.split("").map(i=>i+i).join(""):t;return{r:parseInt(e.slice(0,2),16),g:parseInt(e.slice(2,4),16),b:parseInt(e.slice(4,6),16)}},R=h=>{const{r:t,g:e,b:i}=N(h),s=t/255,n=e/255,a=i/255,o=Math.max(s,n,a),l=Math.min(s,n,a),r=o-l;let p=0;r!==0&&(o===s?p=(n-a)/r%6:o===n?p=(a-s)/r+2:p=(s-n)/r+4),p<0&&(p+=6);const c=o===0?0:r/o,d=o;return{h:p*60,s:c,v:d}},F=(h,t,e)=>{const i=(h%360+360)%360,s=e*t,n=s*(1-Math.abs(i/60%2-1)),a=e-s;let o=0,l=0,r=0;return i<60?(o=s,l=n,r=0):i<120?(o=n,l=s,r=0):i<180?(o=0,l=s,r=n):i<240?(o=0,l=n,r=s):i<300?(o=n,l=0,r=s):(o=s,l=0,r=n),J(Math.round((o+a)*255),Math.round((l+a)*255),Math.round((r+a)*255))},vt=(h,t,e)=>{const i=e*(1-t/2),s=i===0||i===1?0:(e-i)/Math.min(i,1-i);return{hue:h,sat:s,lightness:i}},it=(h,t,e)=>{const i=(1-Math.abs(2*e-1))*t,s=i*(1-Math.abs(h/60%2-1)),n=e-i/2;let a=0,o=0,l=0;return h<60?(a=i,o=s,l=0):h<120?(a=s,o=i,l=0):h<180?(a=0,o=i,l=s):h<240?(a=0,o=s,l=i):h<300?(a=s,o=0,l=i):(a=i,o=0,l=s),{r:Math.round((a+n)*255),g:Math.round((o+n)*255),b:Math.round((l+n)*255)}},ft=(h,t)=>{const e=Math.max(0,Math.min(100,t))/100;if(h.startsWith("#")){const{r:s,g:n,b:a}=N(h);return`rgba(${s}, ${n}, ${a}, ${e})`}if(h.startsWith("rgba("))return h.replace(/,\s*[\d.]+\)$/,`, ${e})`);if(h.startsWith("rgb("))return h.replace("rgb(","rgba(").replace(")",`, ${e})`);if(h.startsWith("hsl(")){const s=h.match(/hsl\((\d+),\s*(\d+)%,\s*(\d+)%\)/);if(s){const{r:n,g:a,b:o}=it(parseInt(s[1]),parseInt(s[2])/100,parseInt(s[3])/100);return`rgba(${n}, ${a}, ${o}, ${e})`}}if(h.startsWith("hsla(")){const s=h.match(/hsla\((\d+),\s*(\d+)%,\s*(\d+)%,\s*[\d.]+\)/);if(s){const{r:n,g:a,b:o}=it(parseInt(s[1]),parseInt(s[2])/100,parseInt(s[3])/100);return`rgba(${n}, ${a}, ${o}, ${e})`}}const i=W(h);if(i){const{r:s,g:n,b:a}=N(i);return`rgba(${s}, ${n}, ${a}, ${e})`}return h},ie=h=>["red","green","blue","yellow","orange","purple","pink","brown","black","white","gray","grey","cyan","magenta","lime","navy","maroon","olive","aqua","silver","teal","fuchsia","transparent"].includes(h.toLowerCase()),Ct=h=>[/^#[0-9a-fA-F]{3,8}$/,/^rgba?\s*\([^)]+\)$/,/^hsla?\s*\([^)]+\)$/,/^[a-zA-Z]+$/].some(e=>e.test(h.trim())),se=h=>{if(typeof document>"u")return Ct(h)||!!W(h);const t=document.createElement("div");return t.style.color=h,t.style.color!==""},yt=h=>{const t=h.trim();if(/^#[0-9A-Fa-f]{8}$/.test(t)){const n=t.slice(1),a=parseInt(n.slice(0,2),16),o=parseInt(n.slice(2,4),16),l=parseInt(n.slice(4,6),16),r=parseInt(n.slice(6,8),16);return{color:J(a,o,l),position:0,opacity:Math.round(r/255*100)}}const e=t.match(/rgba?\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*([\d.]+))?\s*\)/);if(e){const n=parseInt(e[1]),a=parseInt(e[2]),o=parseInt(e[3]),l=e[4]?parseFloat(e[4]):1;return{color:J(n,a,o),position:0,opacity:Math.round(l*100)}}const i=t.match(/hsla?\s*\(\s*([\d.]+)\s*,\s*([\d.]+)%\s*,\s*([\d.]+)%(?:\s*,\s*([\d.]+))?\s*\)/);if(i){const{r:n,g:a,b:o}=it(parseFloat(i[1]),parseFloat(i[2])/100,parseFloat(i[3])/100),l=i[4]?parseFloat(i[4]):1;return{color:J(n,a,o),position:0,opacity:Math.round(l*100)}}return{color:W(t)||t,position:0,opacity:100}},lt=h=>{const t=[];let e="",i=0;for(let s=0;s<h.length;s++){const n=h[s];if(n==="(")i++;else if(n===")")i--;else if(n===","&&i===0){t.push(e.trim()),e="";continue}e+=n}return e.trim()&&t.push(e.trim()),t},rt=(h,t)=>{const e=new RegExp(`${t}\\s*\\(`,"i"),i=h.match(e);if(!i)return null;const s=i.index+i[0].length;let n=1,a=s;for(let o=s;o<h.length&&n>0;o++)h[o]==="("?n++:h[o]===")"&&n--,a=o;return n===0?h.substring(s,a):null},ne=h=>{const t=h.split(" ")[0].toLowerCase();return["circle","ellipse","closest-side","closest-corner","farthest-side","farthest-corner","at","contain","cover"].includes(t)?!1:/^#[0-9a-f]{3,8}$/i.test(t)||/^rgb/i.test(h)||/^hsl/i.test(h)||ie(t)},ct=h=>{const t=[];return h.forEach((e,i)=>{const s=e.trim();if(!s)return;let n="",a=0;const o=s.match(/^(.+?)\s+(\d+(?:\.\d+)?)%?\s*$/);o&&Ct(o[1].trim())?(n=o[1].trim(),a=parseFloat(o[2])):(n=s,a=h.length===1?0:i/(h.length-1)*100);const l=yt(n);l.position=Math.max(0,Math.min(100,Math.round(a))),t.push(l)}),t},$=h=>{const t=h.stops&&h.stops.length?h.stops:[{color:"#000000",position:0,opacity:100}];return{type:h.type&&["linear","radial","solid"].includes(h.type)?h.type:"linear",angle:typeof h.angle=="number"?h.angle:90,stops:t.map((e,i)=>({color:e.color||"#000000",position:typeof e.position=="number"?e.position:t.length===1?0:Math.round(i/(t.length-1)*100),opacity:e.opacity===void 0||Number.isNaN(e.opacity)?100:e.opacity}))}},V=h=>{const t=h.replace(/;$/,"").trim();if(se(t)){const s=yt(t);return $({type:"solid",angle:0,stops:[s]})}const e=rt(t,"linear-gradient");if(e){const s=lt(e);let n=90,a=s;const o=s[0];if(o.includes("deg")){const r=o.match(/(-?\d+(?:\.\d+)?)deg/);r&&(n=parseFloat(r[1]),a=s.slice(1))}else o.includes("to ")&&(n={"to right":90,"to left":270,"to bottom":180,"to top":0,"to bottom right":135,"to bottom left":225,"to top right":45,"to top left":315}[o]??90,a=s.slice(1));const l=ct(a);return l.length?$({type:"linear",angle:n,stops:l}):null}const i=rt(t,"radial-gradient");if(i){const s=lt(i),n=s[0]&&!ne(s[0])?s.slice(1):s,a=ct(n);return a.length?$({type:"radial",angle:0,stops:a}):null}return null},O=h=>{if(h.type==="solid"){const e=h.stops[0],i=e.color;if(i.startsWith("var(--"))return i;const s=e.opacity??100,n=i.replace("#",""),a=Math.round(s/100*255).toString(16).toUpperCase().padStart(2,"0");return`#${n}${a}`}const t=h.stops.map(e=>`${ft(e.color,e.opacity??100)} ${e.position}%`).join(", ");return h.type==="radial"?`radial-gradient(circle, ${t})`:`linear-gradient(${h.angle}deg, ${t})`},oe=h=>Math.round(h/100*255).toString(16).toUpperCase().padStart(2,"0"),Z=h=>{if(h.type==="solid"){const t=h.stops[0];if(t){const e=t.color;if(e.startsWith("var(--"))return e.replace("var(--","").replace(")","").split("-").map(n=>n.charAt(0).toUpperCase()+n.slice(1)).join(" ");e.toUpperCase();const i=t.opacity??100;if(i===100)return e;{const s=oe(i);return`${e}${s}`}}return"#000000"}return h.type==="linear"?`Linear ${h.angle}°`:"Radial Gradient"},z=class z{static defaults(){return{solid:[],gradient:[]}}static normalizeList(t){const e=new Set,i=[];return t.forEach(s=>{let n=W(s);n||V(s)&&(n=s),n&&(e.has(n)||(e.add(n),i.push(n)))}),i.slice(0,this.MAX_COLORS)}static ensureLoaded(){var t;if(!this.colors&&(this.colors=this.defaults(),!(typeof window>"u")))try{const e=(t=window.sessionStorage)==null?void 0:t.getItem(this.STORAGE_KEY);if(!e)return;const i=JSON.parse(e);if(Array.isArray(i))this.colors.solid=this.normalizeList(i);else if(i&&typeof i=="object"){const s=i;s.solid&&(this.colors.solid=this.normalizeList(s.solid)),s.gradient&&(this.colors.gradient=this.normalizeList(s.gradient))}}catch{this.colors=this.defaults()}}static persist(){var t;if(!(typeof window>"u"))try{(t=window.sessionStorage)==null||t.setItem(this.STORAGE_KEY,JSON.stringify(this.colors||this.defaults()))}catch{}}static list(t){return this.ensureLoaded(),this.colors||(this.colors=this.defaults()),this.colors[t]}static getColors(t){if(t==="all"){const e=this.list("solid"),i=this.list("gradient"),s=[...e,...i];return this.normalizeList(s)}return[...this.list(t)]}static addColor(t,e){if(!t)return;let i=W(t),s="solid";if(i)s="solid";else{const l=V(t);l&&(i=t,s=l.type==="solid"?"solid":"gradient")}if(!i)return;const n=e==="all"?s:e,a=this.list(n),o=a.indexOf(i);o!==-1&&a.splice(o,1),a.unshift(i),a.length>this.MAX_COLORS&&(a.length=this.MAX_COLORS),this.persist()}};z.STORAGE_KEY="settingsLib_recentColors",z.MAX_COLORS=12,z.colors=null;let G=z;const ot=(h,t)=>{const e=document.createElement("div");e.className="color-picker-recent-section";const i=document.createElement("div");i.className="color-picker-recent-title",i.textContent="Recently Used";const s=document.createElement("div");s.className="color-picker-tooltip",s.style.display="none",e.appendChild(s);const n=()=>{s.style.display="none"},a=(p,c)=>{const d=p.getBoundingClientRect();s.textContent=c,s.style.left=`${d.left+d.width/2}px`,s.style.top=`${d.bottom+8}px`,s.style.display="block"},o=document.createElement("div");o.className="color-picker-recent-grid";const l=document.createElement("div");l.className="color-picker-recent-placeholder",l.textContent="No recent colors yet",e.appendChild(i),e.appendChild(o),e.appendChild(l);const r=()=>{n(),o.innerHTML="";const p=G.getColors(t);if(p.length===0){o.style.display="none",l.style.display="block";return}o.style.display="grid",l.style.display="none",p.forEach(c=>{const d=document.createElement("button");d.type="button",d.className="color-picker-recent-swatch";const u=ae(c);d.title=u,d.setAttribute("aria-label",`Use color: ${u}`),d.style.background=c,d.style.borderColor=c,d.addEventListener("mouseenter",()=>a(d,u)),d.addEventListener("mouseleave",()=>{n(),d.style.boxShadow=""}),d.addEventListener("mousedown",()=>{d.style.boxShadow="0px 0px 0px 2px var(--grey40)"}),d.addEventListener("mouseup",()=>{setTimeout(()=>{d.style.boxShadow=""},150)}),d.addEventListener("click",()=>{n(),h(c)}),o.appendChild(d)})};return r(),{container:e,refresh:r}},ae=h=>{const t=V(h);if(t)return Z(t);const e=W(h);if(e){const i=N(e);return`${e} (RGB: ${i.r}, ${i.g}, ${i.b})`}return h},bt=`<svg width="13" height="13" viewBox="0 0 13 13" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
190
190
|
<path fill-rule="evenodd" clip-rule="evenodd"
|
|
191
191
|
d="M6.12347 4.96653L1.41158 0.254304C1.25449 0.102568 1.04409 0.0186071 0.825694 0.0205049C0.607302 0.0224037 0.398393 0.110007 0.24396 0.26445C0.0895282 0.418893 0.0019303 0.627818 3.24698e-05 0.846225C-0.00186536 1.06463 0.0820894 1.27505 0.233815 1.43215L4.9457 6.14438L0.233814 10.8566C0.0820886 11.0137 -0.00186625 11.2241 3.15434e-05 11.4425C0.00192934 11.6609 0.0895272 11.8699 0.243959 12.0243C0.398392 12.1787 0.607301 12.2663 0.825693 12.2682C1.04408 12.2701 1.25449 12.1862 1.41158 12.0344L6.12347 7.32222L10.8354 12.0344C10.9932 12.1824 11.2023 12.2632 11.4186 12.2597C11.6349 12.2562 11.8414 12.1687 11.9943 12.0156C12.1472 11.8626 12.2346 11.6561 12.2379 11.4398C12.2413 11.2234 12.1604 11.0143 12.0123 10.8566L7.30123 6.14438L12.0131 1.43215C12.0927 1.35531 12.1561 1.2634 12.1998 1.16177C12.2434 1.06014 12.2664 0.950833 12.2674 0.84023C12.2683 0.729626 12.2473 0.61994 12.2054 0.517568C12.1635 0.415196 12.1017 0.322191 12.0234 0.243979C11.9452 0.165768 11.8522 0.103916 11.7499 0.0620327C11.6475 0.0201492 11.5378 -0.000927989 11.4272 3.33052e-05C11.3166 0.000993646 11.2073 0.0239743 11.1057 0.0676297C11.0041 0.111286 10.9122 0.174745 10.8354 0.254305L6.12347 4.96653Z"
|
|
192
192
|
fill="#919EAB"/>
|
|
@@ -210,10 +210,10 @@
|
|
|
210
210
|
<path d="M20.6106 19.5062C20.6887 19.5843 20.6887 19.711 20.6106 19.7891L19.7896 20.6101C19.7115 20.6882 19.5848 20.6882 19.5067 20.6101L5.98957 7.09298C5.91146 7.01488 5.91146 6.88825 5.98957 6.81014L6.81063 5.98908C6.88873 5.91097 7.01537 5.91097 7.09347 5.98908L20.6106 19.5062Z" fill="#46525C"/>
|
|
211
211
|
<path d="M9.69583 12.2146C9.81298 12.3318 9.81298 12.5217 9.69583 12.6389L7.80151 14.5332C6.72071 15.614 6.6062 17.4365 7.80151 18.6318C8.99473 19.8267 10.8184 19.7123 11.8992 18.6318L13.7935 16.7366C13.9106 16.6194 14.1006 16.6194 14.2178 16.7366L14.816 17.3348C14.9331 17.4519 14.9332 17.6418 14.816 17.759L12.9216 19.6543C11.2241 21.3536 8.47364 21.3518 6.77417 19.6543C5.07483 17.9568 5.0749 15.2064 6.77417 13.5068L8.66848 11.6116C8.78563 11.4944 8.97562 11.4944 9.0928 11.6116L9.69583 12.2146ZM13.5085 6.77441C15.2061 5.07514 17.9565 5.07509 19.656 6.77441C21.3535 8.47388 21.3533 11.2243 19.656 12.9238L17.7607 14.8182C17.6436 14.9354 17.4536 14.9353 17.3365 14.8182L16.7344 14.2161C16.6172 14.0989 16.6172 13.9089 16.7344 13.7918L18.6296 11.8975C19.7101 10.8167 19.8245 8.99503 18.6296 7.7998C17.4363 6.60449 15.6118 6.719 14.531 7.7998L12.6367 9.69412C12.5195 9.81128 12.3296 9.81128 12.2124 9.69412L11.6123 9.09402C11.4952 8.97684 11.4952 8.78685 11.6124 8.6697L13.5085 6.77441Z" fill="#46525C"/>
|
|
212
212
|
</svg>
|
|
213
|
-
`;class pe{constructor(t,e="gradient"){this.isOpen=!1,this.currentColor="#FF0000",this.currentOpacity=100,this.outsideClick=i=>{if(!this.isOpen)return;const s=i.target;if(this.element.contains(s))return;if(this.backdrop.contains(s)){i.preventDefault(),i.stopPropagation(),this.close(!0);return}const n=document.querySelectorAll(".gstop-color-input, .gstop-color-preview, .gradient-mini-preview");if(Array.from(n).some(l=>l.contains(s)))return;const o=document.querySelector(".gradient-popover");o&&o.contains(s)||(i.preventDefault(),i.stopPropagation(),this.close(!0))},this.keyDown=i=>{if(this.isOpen){if(i.key==="Escape")i.preventDefault(),this.close(!0);else if(i.key==="Enter"){const s=i.target;if(s&&(s.tagName==="INPUT"||s.tagName==="TEXTAREA"))return;i.preventDefault(),this.close(!0)}}},this.onChange=t,this.recentScope=e,this.element=this.build(),this.backdrop=this.createBackdrop()}parsePercentage(t){const e=parseFloat(t);return isNaN(e)?0:e/100}build(){const t=document.createElement("div");t.className="custom-color-picker",t.style.display="none";const e=document.createElement("div");e.className="color-picker-header",e.style.cursor="move";const i=document.createElement("span");i.textContent="Color";const s=document.createElement("button");s.className="color-picker-close",s.innerHTML=bt,s.addEventListener("click",()=>this.close(!0)),e.appendChild(i),e.appendChild(s),mt(e,t);const n=document.createElement("div");n.className="color-picker-area",this.colorArea=n;const a=document.createElement("div");a.className="color-picker-marker",this.colorMarker=a,n.appendChild(a);const o=document.createElement("div");o.className="color-picker-sliders-container";const l=document.createElement("button");l.className="color-picker-eyedropper",l.type="button",l.innerHTML=Et;const r=document.createElement("div");r.className="color-picker-sliders-group";const p=document.createElement("div");p.className="color-picker-hue",this.hueSlider=p;const c=document.createElement("div");c.className="color-picker-hue-marker",this.hueMarker=c,p.appendChild(c);const d=document.createElement("div");d.className="color-picker-opacity",this.opacitySlider=d;const u=document.createElement("div");u.className="color-picker-opacity-marker",this.opacityMarker=u,d.appendChild(u),r.appendChild(p),r.appendChild(d),o.appendChild(l),o.appendChild(r);const g=ot(b=>{var k;this.setColor(b),(k=this.onChange)==null||k.call(this,b,this.currentOpacity)},this.recentScope);this.recentSectionRefresh=g.refresh;const f=document.createElement("div");f.className="color-picker-format-section";const m=document.createElement("select");m.className="color-picker-format-select",this.select=m;const v=document.createElement("option");v.value="hex",v.textContent="HEX";const C=document.createElement("option");C.value="rgb",C.textContent="RGB";const w=document.createElement("option");w.value="hsl",w.textContent="HSL",m.appendChild(v),m.appendChild(C),m.appendChild(w);const E=document.createElement("input");E.type="text",E.className="color-picker-color-input",E.value=this.currentColor,this.input=E;const M=document.createElement("div");M.className="color-picker-input-container";const y=document.createElement("button");return y.className="color-picker-copy-inside",y.textContent="Copy",M.appendChild(E),M.appendChild(y),f.appendChild(m),f.appendChild(M),t.appendChild(e),t.appendChild(n),t.appendChild(o),t.appendChild(g.container),t.appendChild(f),t.addEventListener("click",b=>b.stopPropagation()),this.bind(n,p,d,E,m,y,l),t}createBackdrop(){const t=document.createElement("div");return t.className="color-picker-backdrop",t.style.display="none",t.addEventListener("click",e=>{e.preventDefault(),e.stopPropagation(),this.close(!0)}),t}bind(t,e,i,s,n,a,o){const l=c=>{var C;const d=t.getBoundingClientRect(),u=Math.max(0,Math.min(1,(c.clientX-d.left)/d.width)),g=Math.max(0,Math.min(1,(c.clientY-d.top)/d.height));this.colorMarker.style.left=`${u*100}%`,this.colorMarker.style.top=`${g*100}%`;const m=this.parsePercentage(this.hueMarker.style.left||"0%")*360,v=F(m,u,1-g);this.currentColor=v,this.syncInput(),this.updateOpacityBg(),(C=this.onChange)==null||C.call(this,v,this.currentOpacity)},r=c=>{var C;const d=e.getBoundingClientRect();let u=Math.max(0,Math.min(1,(c.clientX-d.left)/d.width));this.hueMarker.style.left=`${u*100}%`;const g=u*360,f=this.parsePercentage(this.colorMarker.style.left||"0%"),m=this.parsePercentage(this.colorMarker.style.top||"0%"),v=F(g,f,1-m);this.currentColor=v,this.colorArea.style.background=`linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(${g}, 100%, 50%))`,this.syncInput(),this.updateOpacityBg(),(C=this.onChange)==null||C.call(this,v,this.currentOpacity)},p=c=>{var g;const d=i.getBoundingClientRect(),u=Math.max(0,Math.min(1,(c.clientX-d.left)/d.width));this.opacityMarker.style.left=`${u*100}%`,this.currentOpacity=Math.round(u*100),(g=this.onChange)==null||g.call(this,this.currentColor,this.currentOpacity)};t.addEventListener("mousedown",c=>{c.preventDefault(),l(c);const d=g=>l(g),u=()=>{document.removeEventListener("mousemove",d),document.removeEventListener("mouseup",u)};document.addEventListener("mousemove",d),document.addEventListener("mouseup",u)}),e.addEventListener("mousedown",c=>{c.preventDefault(),r(c);const d=g=>r(g),u=()=>{document.removeEventListener("mousemove",d),document.removeEventListener("mouseup",u)};document.addEventListener("mousemove",d),document.addEventListener("mouseup",u)}),i.addEventListener("mousedown",c=>{c.preventDefault(),p(c);const d=g=>p(g),u=()=>{document.removeEventListener("mousemove",d),document.removeEventListener("mouseup",u)};document.addEventListener("mousemove",d),document.addEventListener("mouseup",u)}),n.addEventListener("change",()=>this.syncInput()),s.addEventListener("input",()=>this.applyFromInput()),s.addEventListener("blur",()=>this.syncInput()),s.addEventListener("keydown",c=>{c.key==="Enter"&&(c.preventDefault(),this.syncInput(),s.blur())}),a.addEventListener("click",async()=>{try{await navigator.clipboard.writeText(s.value)}catch{s.select(),document.execCommand("copy")}}),o.addEventListener("click",async()=>{var c;if(!("EyeDropper"in window)){alert("EyeDropper API is not supported in this browser.");return}try{const d=new window.EyeDropper,{sRGBHex:u}=await d.open();this.setColor(u),(c=this.onChange)==null||c.call(this,u,this.currentOpacity)}catch{}}),document.addEventListener("keydown",this.keyDown,!0),setTimeout(()=>document.addEventListener("click",this.outsideClick,!0),0)}setColor(t){var a;this.currentColor=t;const{h:e,s:i,v:s}=R(t),n=e>=360?e%360:e;this.hueMarker.style.left=`${n/360*100}%`,this.colorMarker.style.left=`${i*100}%`,this.colorMarker.style.top=`${(1-s)*100}%`,this.colorArea.style.background=`linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(${n}, 100%, 50%))`,this.syncInput(),this.updateOpacityBg(),(a=this.onChange)==null||a.call(this,t,this.currentOpacity)}syncInput(){const t=this.select.value,{h:e,s:i,v:s}=R(this.currentColor);if(t==="hex")this.input.value=this.currentColor;else if(t==="rgb"){const{r:n,g:a,b:o}=N(this.currentColor);this.input.value=`rgb(${n}, ${a}, ${o})`}else{const{hue:n,sat:a,lightness:o}=ft(e,i,s);this.input.value=`hsl(${Math.round(n)}, ${Math.round(a*100)}%, ${Math.round(o*100)}%)`}}applyFromInput(){const t=this.input.value.trim();let e="";if(/^#[0-9A-Fa-f]{6}$/.test(t))e=t;else{const i=t.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);if(i){const s=parseInt(i[1]),n=parseInt(i[2]),a=parseInt(i[3]);s<=255&&n<=255&&a<=255&&(e=`#${[s,n,a].map(o=>o.toString(16).padStart(2,"0")).join("")}`)}else{const s=t.match(/hsl\((\d+),\s*(\d+)%,\s*(\d+)%\)/);if(s){const n=parseInt(s[1]),a=parseInt(s[2])/100,o=parseInt(s[3])/100,l=o+a*Math.min(o,1-o),r=l===0?0:2*(1-o/l);e=F(n,r,l)}}}e&&this.setColor(e)}updateOpacityBg(){const{r:t,g:e,b:i}=N(this.currentColor);this.opacitySlider.style.setProperty("--base-color",`rgb(${t}, ${e}, ${i})`)}open(t,e,i){var w;this.currentColor=t,this.currentOpacity=i??100,this.syncInput();const{h:s,s:n,v:a}=R(t);this.hueMarker.style.left=`${s/360*100}%`,this.colorMarker.style.left=`${n*100}%`,this.colorMarker.style.top=`${(1-a)*100}%`,this.colorArea.style.background=`linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(${s}, 100%, 50%))`,this.updateOpacityBg(),this.opacityMarker.style.left=`${this.currentOpacity}%`,(w=this.recentSectionRefresh)==null||w.call(this),this.isOpen=!0,this.backdrop.style.display="block",this.backdrop.parentElement||document.body.appendChild(this.backdrop),this.element.style.display="block",this.element.style.position="fixed",this.element.style.zIndex="10002",this.element.style.left="-9999px",this.element.style.top="0px",this.element.parentElement||document.body.appendChild(this.element);const o=this.element.offsetWidth,l=this.element.offsetHeight,r=e.getBoundingClientRect(),p=window.innerWidth,c=window.innerHeight,d=16;let u=r.right+8,g=r.top;const f=p-r.right,m=r.left;f>=o+d?u=r.right+8:m>=o+d?u=r.left-o-8:u=Math.max(d,(p-o)/2);const v=c-r.bottom,C=r.top;v>=l+d?g=r.bottom+8:C>=l+d?g=r.top-l-8:v>C?(g=r.bottom+8,g+l>c-d&&(g=c-l-d)):(g=r.top-l-8,g<d&&(g=d)),this.element.style.left=`${u}px`,this.element.style.top=`${g}px`}close(t){var e;this.isOpen&&(this.isOpen=!1,this.backdrop.style.display="none",this.element.style.display="none",document.removeEventListener("click",this.outsideClick,!0),document.removeEventListener("keydown",this.keyDown,!0),t&&this.onChange&&this.recentScope==="solid"&&(G.addColor(this.currentColor,this.recentScope),(e=this.recentSectionRefresh)==null||e.call(this)))}getElement(){return this.element}}class ue{constructor(t){this.isDragging=!1,this.currentColor=t.initialColor,this.currentOpacity=t.initialOpacity,this.onColorChange=t.onColorChange,this.recentScope=t.scope??"solid",this.element=this.build(),this.initFromColor(this.currentColor,this.currentOpacity)}parsePercentage(t){const e=parseFloat(t);return isNaN(e)?0:e/100}build(){const t=document.createElement("div");t.className="embedded-color-picker";const e=document.createElement("div");e.className="color-picker-area embedded",this.colorArea=e;const i=document.createElement("div");i.className="color-picker-marker",this.colorMarker=i,e.appendChild(i);const s=document.createElement("div");s.className="color-picker-sliders-container embedded";const n=document.createElement("button");n.className="color-picker-eyedropper",n.type="button",n.innerHTML=Et;const a=document.createElement("div");a.className="color-picker-sliders-group";const o=document.createElement("div");o.className="color-picker-hue embedded",this.hueSlider=o;const l=document.createElement("div");l.className="color-picker-hue-marker",this.hueMarker=l,o.appendChild(l);const r=document.createElement("div");r.className="color-picker-opacity embedded",this.opacitySlider=r;const p=document.createElement("div");p.className="color-picker-opacity-marker",this.opacityMarker=p,r.appendChild(p),a.appendChild(o),a.appendChild(r),s.appendChild(n),s.appendChild(a);const c=ot(E=>{const M=V(E);M&&M.type!=="solid"?this.onColorChange(E,this.currentOpacity):(this.setColor(E),this.onColorChange(this.currentColor,this.currentOpacity))},"all");this.recentSectionRefresh=c.refresh;const d=document.createElement("div");d.className="color-picker-format-section embedded";const u=document.createElement("select");u.className="color-picker-format-select",this.select=u;const g=document.createElement("option");g.value="hex",g.textContent="HEX";const f=document.createElement("option");f.value="rgb",f.textContent="RGB";const m=document.createElement("option");m.value="hsl",m.textContent="HSL",u.appendChild(g),u.appendChild(f),u.appendChild(m);const v=document.createElement("input");v.type="text",v.className="color-picker-color-input",this.input=v;const C=document.createElement("div");C.className="color-picker-input-container";const w=document.createElement("button");return w.className="color-picker-copy-inside",w.textContent="Copy",C.appendChild(v),C.appendChild(w),d.appendChild(u),d.appendChild(C),t.appendChild(e),t.appendChild(s),t.appendChild(d),t.appendChild(c.container),this.bind(e,o,r,v,u,w,n),t}bind(t,e,i,s,n,a,o){const l=c=>{const d=t.getBoundingClientRect(),u=Math.max(0,Math.min(1,(c.clientX-d.left)/d.width)),g=Math.max(0,Math.min(1,(c.clientY-d.top)/d.height));this.colorMarker.style.left=`${u*100}%`,this.colorMarker.style.top=`${g*100}%`;const m=this.parsePercentage(this.hueMarker.style.left||"0%")*360,v=F(m,u,1-g);this.currentColor=v,this.syncInput(),this.updateOpacityBg(),this.queueChange()},r=c=>{const d=e.getBoundingClientRect(),u=Math.max(0,Math.min(1,(c.clientX-d.left)/d.width));this.hueMarker.style.left=`${u*100}%`;const g=u*360,f=this.parsePercentage(this.colorMarker.style.left||"0%"),m=this.parsePercentage(this.colorMarker.style.top||"0%"),v=F(g,f,1-m);this.currentColor=v,this.colorArea.style.background=`linear-gradient(to top, #000, transparent),
|
|
213
|
+
`;class pe{constructor(t,e="gradient"){this.isOpen=!1,this.currentColor="#FF0000",this.currentOpacity=100,this.outsideClick=i=>{if(!this.isOpen)return;const s=i.target;if(this.element.contains(s))return;if(this.backdrop.contains(s)){i.preventDefault(),i.stopPropagation(),this.close(!0);return}const n=document.querySelectorAll(".gstop-color-input, .gstop-color-preview, .gradient-mini-preview");if(Array.from(n).some(l=>l.contains(s)))return;const o=document.querySelector(".gradient-popover");o&&o.contains(s)||(i.preventDefault(),i.stopPropagation(),this.close(!0))},this.keyDown=i=>{if(this.isOpen){if(i.key==="Escape")i.preventDefault(),this.close(!0);else if(i.key==="Enter"){const s=i.target;if(s&&(s.tagName==="INPUT"||s.tagName==="TEXTAREA"))return;i.preventDefault(),this.close(!0)}}},this.onChange=t,this.recentScope=e,this.element=this.build(),this.backdrop=this.createBackdrop()}parsePercentage(t){const e=parseFloat(t);return isNaN(e)?0:e/100}build(){const t=document.createElement("div");t.className="custom-color-picker",t.style.display="none";const e=document.createElement("div");e.className="color-picker-header",e.style.cursor="move";const i=document.createElement("span");i.textContent="Color";const s=document.createElement("button");s.className="color-picker-close",s.innerHTML=bt,s.addEventListener("click",()=>this.close(!0)),e.appendChild(i),e.appendChild(s),mt(e,t);const n=document.createElement("div");n.className="color-picker-area",this.colorArea=n;const a=document.createElement("div");a.className="color-picker-marker",this.colorMarker=a,n.appendChild(a);const o=document.createElement("div");o.className="color-picker-sliders-container";const l=document.createElement("button");l.className="color-picker-eyedropper",l.type="button",l.innerHTML=Et;const r=document.createElement("div");r.className="color-picker-sliders-group";const p=document.createElement("div");p.className="color-picker-hue",this.hueSlider=p;const c=document.createElement("div");c.className="color-picker-hue-marker",this.hueMarker=c,p.appendChild(c);const d=document.createElement("div");d.className="color-picker-opacity",this.opacitySlider=d;const u=document.createElement("div");u.className="color-picker-opacity-marker",this.opacityMarker=u,d.appendChild(u),r.appendChild(p),r.appendChild(d),o.appendChild(l),o.appendChild(r);const g=ot(b=>{var k;this.setColor(b),(k=this.onChange)==null||k.call(this,b,this.currentOpacity)},this.recentScope);this.recentSectionRefresh=g.refresh;const v=document.createElement("div");v.className="color-picker-format-section";const m=document.createElement("select");m.className="color-picker-format-select",this.select=m;const f=document.createElement("option");f.value="hex",f.textContent="HEX";const C=document.createElement("option");C.value="rgb",C.textContent="RGB";const w=document.createElement("option");w.value="hsl",w.textContent="HSL",m.appendChild(f),m.appendChild(C),m.appendChild(w);const E=document.createElement("input");E.type="text",E.className="color-picker-color-input",E.value=this.currentColor,this.input=E;const M=document.createElement("div");M.className="color-picker-input-container";const y=document.createElement("button");return y.className="color-picker-copy-inside",y.textContent="Copy",M.appendChild(E),M.appendChild(y),v.appendChild(m),v.appendChild(M),t.appendChild(e),t.appendChild(n),t.appendChild(o),t.appendChild(g.container),t.appendChild(v),t.addEventListener("click",b=>b.stopPropagation()),this.bind(n,p,d,E,m,y,l),t}createBackdrop(){const t=document.createElement("div");return t.className="color-picker-backdrop",t.style.display="none",t.addEventListener("click",e=>{e.preventDefault(),e.stopPropagation(),this.close(!0)}),t}bind(t,e,i,s,n,a,o){const l=c=>{var C;const d=t.getBoundingClientRect(),u=Math.max(0,Math.min(1,(c.clientX-d.left)/d.width)),g=Math.max(0,Math.min(1,(c.clientY-d.top)/d.height));this.colorMarker.style.left=`${u*100}%`,this.colorMarker.style.top=`${g*100}%`;const m=this.parsePercentage(this.hueMarker.style.left||"0%")*360,f=F(m,u,1-g);this.currentColor=f,this.syncInput(),this.updateOpacityBg(),(C=this.onChange)==null||C.call(this,f,this.currentOpacity)},r=c=>{var C;const d=e.getBoundingClientRect();let u=Math.max(0,Math.min(1,(c.clientX-d.left)/d.width));this.hueMarker.style.left=`${u*100}%`;const g=u*360,v=this.parsePercentage(this.colorMarker.style.left||"0%"),m=this.parsePercentage(this.colorMarker.style.top||"0%"),f=F(g,v,1-m);this.currentColor=f,this.colorArea.style.background=`linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(${g}, 100%, 50%))`,this.syncInput(),this.updateOpacityBg(),(C=this.onChange)==null||C.call(this,f,this.currentOpacity)},p=c=>{var g;const d=i.getBoundingClientRect(),u=Math.max(0,Math.min(1,(c.clientX-d.left)/d.width));this.opacityMarker.style.left=`${u*100}%`,this.currentOpacity=Math.round(u*100),(g=this.onChange)==null||g.call(this,this.currentColor,this.currentOpacity)};t.addEventListener("mousedown",c=>{c.preventDefault(),l(c);const d=g=>l(g),u=()=>{document.removeEventListener("mousemove",d),document.removeEventListener("mouseup",u)};document.addEventListener("mousemove",d),document.addEventListener("mouseup",u)}),e.addEventListener("mousedown",c=>{c.preventDefault(),r(c);const d=g=>r(g),u=()=>{document.removeEventListener("mousemove",d),document.removeEventListener("mouseup",u)};document.addEventListener("mousemove",d),document.addEventListener("mouseup",u)}),i.addEventListener("mousedown",c=>{c.preventDefault(),p(c);const d=g=>p(g),u=()=>{document.removeEventListener("mousemove",d),document.removeEventListener("mouseup",u)};document.addEventListener("mousemove",d),document.addEventListener("mouseup",u)}),n.addEventListener("change",()=>this.syncInput()),s.addEventListener("input",()=>this.applyFromInput()),s.addEventListener("blur",()=>this.syncInput()),s.addEventListener("keydown",c=>{c.key==="Enter"&&(c.preventDefault(),this.syncInput(),s.blur())}),a.addEventListener("click",async()=>{try{await navigator.clipboard.writeText(s.value)}catch{s.select(),document.execCommand("copy")}}),o.addEventListener("click",async()=>{var c;if(!("EyeDropper"in window)){alert("EyeDropper API is not supported in this browser.");return}try{const d=new window.EyeDropper,{sRGBHex:u}=await d.open();this.setColor(u),(c=this.onChange)==null||c.call(this,u,this.currentOpacity)}catch{}}),document.addEventListener("keydown",this.keyDown,!0),setTimeout(()=>document.addEventListener("click",this.outsideClick,!0),0)}setColor(t){var a;this.currentColor=t;const{h:e,s:i,v:s}=R(t),n=e>=360?e%360:e;this.hueMarker.style.left=`${n/360*100}%`,this.colorMarker.style.left=`${i*100}%`,this.colorMarker.style.top=`${(1-s)*100}%`,this.colorArea.style.background=`linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(${n}, 100%, 50%))`,this.syncInput(),this.updateOpacityBg(),(a=this.onChange)==null||a.call(this,t,this.currentOpacity)}syncInput(){const t=this.select.value,{h:e,s:i,v:s}=R(this.currentColor);if(t==="hex")this.input.value=this.currentColor;else if(t==="rgb"){const{r:n,g:a,b:o}=N(this.currentColor);this.input.value=`rgb(${n}, ${a}, ${o})`}else{const{hue:n,sat:a,lightness:o}=vt(e,i,s);this.input.value=`hsl(${Math.round(n)}, ${Math.round(a*100)}%, ${Math.round(o*100)}%)`}}applyFromInput(){const t=this.input.value.trim();let e="";if(/^#[0-9A-Fa-f]{6}$/.test(t))e=t;else{const i=t.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);if(i){const s=parseInt(i[1]),n=parseInt(i[2]),a=parseInt(i[3]);s<=255&&n<=255&&a<=255&&(e=`#${[s,n,a].map(o=>o.toString(16).padStart(2,"0")).join("")}`)}else{const s=t.match(/hsl\((\d+),\s*(\d+)%,\s*(\d+)%\)/);if(s){const n=parseInt(s[1]),a=parseInt(s[2])/100,o=parseInt(s[3])/100,l=o+a*Math.min(o,1-o),r=l===0?0:2*(1-o/l);e=F(n,r,l)}}}e&&this.setColor(e)}updateOpacityBg(){const{r:t,g:e,b:i}=N(this.currentColor);this.opacitySlider.style.setProperty("--base-color",`rgb(${t}, ${e}, ${i})`)}open(t,e,i){var w;this.currentColor=t,this.currentOpacity=i??100,this.syncInput();const{h:s,s:n,v:a}=R(t);this.hueMarker.style.left=`${s/360*100}%`,this.colorMarker.style.left=`${n*100}%`,this.colorMarker.style.top=`${(1-a)*100}%`,this.colorArea.style.background=`linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(${s}, 100%, 50%))`,this.updateOpacityBg(),this.opacityMarker.style.left=`${this.currentOpacity}%`,(w=this.recentSectionRefresh)==null||w.call(this),this.isOpen=!0,this.backdrop.style.display="block",this.backdrop.parentElement||document.body.appendChild(this.backdrop),this.element.style.display="block",this.element.style.position="fixed",this.element.style.zIndex="10002",this.element.style.left="-9999px",this.element.style.top="0px",this.element.parentElement||document.body.appendChild(this.element);const o=this.element.offsetWidth,l=this.element.offsetHeight,r=e.getBoundingClientRect(),p=window.innerWidth,c=window.innerHeight,d=16;let u=r.right+8,g=r.top;const v=p-r.right,m=r.left;v>=o+d?u=r.right+8:m>=o+d?u=r.left-o-8:u=Math.max(d,(p-o)/2);const f=c-r.bottom,C=r.top;f>=l+d?g=r.bottom+8:C>=l+d?g=r.top-l-8:f>C?(g=r.bottom+8,g+l>c-d&&(g=c-l-d)):(g=r.top-l-8,g<d&&(g=d)),this.element.style.left=`${u}px`,this.element.style.top=`${g}px`}close(t){var e;this.isOpen&&(this.isOpen=!1,this.backdrop.style.display="none",this.element.style.display="none",document.removeEventListener("click",this.outsideClick,!0),document.removeEventListener("keydown",this.keyDown,!0),t&&this.onChange&&this.recentScope==="solid"&&(G.addColor(this.currentColor,this.recentScope),(e=this.recentSectionRefresh)==null||e.call(this)))}getElement(){return this.element}}class ue{constructor(t){this.isDragging=!1,this.currentColor=t.initialColor,this.currentOpacity=t.initialOpacity,this.onColorChange=t.onColorChange,this.recentScope=t.scope??"solid",this.element=this.build(),this.initFromColor(this.currentColor,this.currentOpacity)}parsePercentage(t){const e=parseFloat(t);return isNaN(e)?0:e/100}build(){const t=document.createElement("div");t.className="embedded-color-picker";const e=document.createElement("div");e.className="color-picker-area embedded",this.colorArea=e;const i=document.createElement("div");i.className="color-picker-marker",this.colorMarker=i,e.appendChild(i);const s=document.createElement("div");s.className="color-picker-sliders-container embedded";const n=document.createElement("button");n.className="color-picker-eyedropper",n.type="button",n.innerHTML=Et;const a=document.createElement("div");a.className="color-picker-sliders-group";const o=document.createElement("div");o.className="color-picker-hue embedded",this.hueSlider=o;const l=document.createElement("div");l.className="color-picker-hue-marker",this.hueMarker=l,o.appendChild(l);const r=document.createElement("div");r.className="color-picker-opacity embedded",this.opacitySlider=r;const p=document.createElement("div");p.className="color-picker-opacity-marker",this.opacityMarker=p,r.appendChild(p),a.appendChild(o),a.appendChild(r),s.appendChild(n),s.appendChild(a);const c=ot(E=>{const M=V(E);M&&M.type!=="solid"?this.onColorChange(E,this.currentOpacity):(this.setColor(E),this.onColorChange(this.currentColor,this.currentOpacity))},"all");this.recentSectionRefresh=c.refresh;const d=document.createElement("div");d.className="color-picker-format-section embedded";const u=document.createElement("select");u.className="color-picker-format-select",this.select=u;const g=document.createElement("option");g.value="hex",g.textContent="HEX";const v=document.createElement("option");v.value="rgb",v.textContent="RGB";const m=document.createElement("option");m.value="hsl",m.textContent="HSL",u.appendChild(g),u.appendChild(v),u.appendChild(m);const f=document.createElement("input");f.type="text",f.className="color-picker-color-input",this.input=f;const C=document.createElement("div");C.className="color-picker-input-container";const w=document.createElement("button");return w.className="color-picker-copy-inside",w.textContent="Copy",C.appendChild(f),C.appendChild(w),d.appendChild(u),d.appendChild(C),t.appendChild(e),t.appendChild(s),t.appendChild(d),t.appendChild(c.container),this.bind(e,o,r,f,u,w,n),t}bind(t,e,i,s,n,a,o){const l=c=>{const d=t.getBoundingClientRect(),u=Math.max(0,Math.min(1,(c.clientX-d.left)/d.width)),g=Math.max(0,Math.min(1,(c.clientY-d.top)/d.height));this.colorMarker.style.left=`${u*100}%`,this.colorMarker.style.top=`${g*100}%`;const m=this.parsePercentage(this.hueMarker.style.left||"0%")*360,f=F(m,u,1-g);this.currentColor=f,this.syncInput(),this.updateOpacityBg(),this.queueChange()},r=c=>{const d=e.getBoundingClientRect(),u=Math.max(0,Math.min(1,(c.clientX-d.left)/d.width));this.hueMarker.style.left=`${u*100}%`;const g=u*360,v=this.parsePercentage(this.colorMarker.style.left||"0%"),m=this.parsePercentage(this.colorMarker.style.top||"0%"),f=F(g,v,1-m);this.currentColor=f,this.colorArea.style.background=`linear-gradient(to top, #000, transparent),
|
|
214
214
|
linear-gradient(to right, #fff, hsl(${g}, 100%, 50%))`,this.syncInput(),this.updateOpacityBg(),this.queueChange()},p=c=>{const d=i.getBoundingClientRect(),u=Math.max(0,Math.min(1,(c.clientX-d.left)/d.width));this.opacityMarker.style.left=`${u*100}%`,this.currentOpacity=Math.round(u*100),this.queueChange()};t.addEventListener("mousedown",c=>{c.preventDefault(),this.isDragging=!0,l(c);const d=g=>l(g),u=()=>{this.isDragging=!1,this.flushChange(),document.removeEventListener("mousemove",d),document.removeEventListener("mouseup",u),this.applyPendingExternal()};document.addEventListener("mousemove",d),document.addEventListener("mouseup",u)}),e.addEventListener("mousedown",c=>{c.preventDefault(),this.isDragging=!0,r(c);const d=g=>r(g),u=()=>{this.isDragging=!1,this.flushChange(),document.removeEventListener("mousemove",d),document.removeEventListener("mouseup",u),this.applyPendingExternal()};document.addEventListener("mousemove",d),document.addEventListener("mouseup",u)}),i.addEventListener("mousedown",c=>{c.preventDefault(),this.isDragging=!0,p(c);const d=g=>p(g),u=()=>{this.isDragging=!1,this.flushChange(),document.removeEventListener("mousemove",d),document.removeEventListener("mouseup",u),this.applyPendingExternal()};document.addEventListener("mousemove",d),document.addEventListener("mouseup",u)}),n.addEventListener("change",()=>{this.syncInput()}),s.addEventListener("input",()=>{this.applyFromInput()}),s.addEventListener("blur",()=>{this.syncInput()}),s.addEventListener("keydown",c=>{c.key==="Enter"&&(c.preventDefault(),this.syncInput(),s.blur())}),a.addEventListener("click",async()=>{try{await navigator.clipboard.writeText(s.value)}catch{s.select(),document.execCommand("copy")}}),o.addEventListener("click",async()=>{if(!("EyeDropper"in window)){alert("EyeDropper API is not supported in this browser.");return}try{const c=new window.EyeDropper,{sRGBHex:d}=await c.open();this.setColor(d),this.onColorChange(this.currentColor,this.currentOpacity)}catch{}})}setColor(t){this.currentColor=t;const{h:e,s:i,v:s}=R(t),n=e>=360?e%360:e;this.hueMarker.style.left=`${n/360*100}%`,this.colorMarker.style.left=`${i*100}%`,this.colorMarker.style.top=`${(1-s)*100}%`,this.colorArea.style.background=`linear-gradient(to top, #000, transparent),
|
|
215
|
-
linear-gradient(to right, #fff, hsl(${n}, 100%, 50%))`,this.syncInput(),this.updateOpacityBg()}syncInput(){const t=this.select.value,{h:e,s:i,v:s}=R(this.currentColor);if(t==="hex")this.input.value=this.currentColor;else if(t==="rgb"){const{r:n,g:a,b:o}=N(this.currentColor);this.input.value=`rgb(${n}, ${a}, ${o})`}else{const{hue:n,sat:a,lightness:o}=
|
|
216
|
-
linear-gradient(to right, #fff, hsl(${a}, 100%, 50%))`,this.opacityMarker.style.left=`${e}%`,this.updateOpacityBg(),this.syncInput(),(o=this.recentSectionRefresh)==null||o.call(this)}commitRecentColor(){var t;this.recentScope==="solid"&&(G.addColor(this.currentColor,this.recentScope),(t=this.recentSectionRefresh)==null||t.call(this))}getElement(){return this.element}updateColor(t,e){if(this.isDragging){this.pendingExternalUpdate={color:t,opacity:e};return}this.initFromColor(t,e)}}const H=class H extends x{constructor(t={}){const e=typeof t.default=="string"?void 0:t.default;super({...t,title:t.title||"Color",default:e}),this.inputType={type:"text",angle:"number",stops:"text"},this.element=null,this.previewEl=null,this.inputEl=void 0,this.popoverEl=null,this.backdropEl=null,this.isPopoverOpen=!1,this.isEditing=!1,this.popoverPosition=null,this.previewUpdateTimeout=null,this.solidPicker=null,this.pendingSolidColor=null,this.variant="default",this.globalLayoutMode="list",this.globalSearchQuery="",this.currentMode="custom",this.unlinkButton=null,this.onBackgroundClick=i=>{var d;if(!this.popoverEl||!this.isPopoverOpen)return;const s=i.target,n=this.popoverEl.contains(s),a=(d=this.element)==null?void 0:d.contains(s),o=document.querySelectorAll(".custom-color-picker"),l=Array.from(o).some(u=>u.contains(s)),r=s.closest(".gstop-color-input, .gradient-mini-preview, .gstop-color-preview"),p=s.classList.contains("color-picker-backdrop"),c=s.classList.contains("gradient-popover-backdrop");!n&&!a&&!l&&!r&&!p&&!c&&this.closePopover()},this.handlePopoverKeydown=i=>{if(this.isPopoverOpen){if(i.key==="Escape"){i.preventDefault(),this.closePopover();return}if(i.key==="Enter"){const s=i.target;if(s&&(s.tagName==="INPUT"||s.tagName==="TEXTAREA"))return;i.preventDefault(),this.closePopover()}}},this.detectChange=t.detectChange,this.variant=t.variant??"default",this.originalDefault=t.default,this.value=this.defaultValue()}resolveGlobalVarColor(t){if(t.startsWith("var(--")){const e=t.replace("var(--","").replace(")","");return(x.GlobalVariables||{})[e]||t}return t}breakGlobalBinding(){if(!this.value||this.value.type!=="solid"||!this.value.stops.length)return;const e=this.value.stops[0].color;if(!e.startsWith("var(--"))return;const i=this.resolveGlobalVarColor(e);if(i===e){console.warn(`Could not resolve global variable: ${e}`);return}this.value.stops[0].color=i,this.updateUI(),this.triggerChange(),this.isPopoverOpen&&this.refreshPopoverContent()}defaultValue(){const t=this.originalDefault;if(typeof t=="string"){if(t.startsWith("var(--"))return $({type:"solid",angle:0,stops:[{color:t,position:0,opacity:100}]});const i=V(t);if(i)return $(i)}return $(t&&typeof t=="object"?t:{type:"linear",angle:90,stops:[{color:"#a84b4b",position:0,opacity:100},{color:"#786666",position:100,opacity:100}]})}setValue(t){var i,s;let e=null;typeof t=="string"?t.startsWith("var(--")?e=$({type:"solid",angle:0,stops:[{color:t,position:0,opacity:100}]}):e=V(t):t&&typeof t=="object"&&(e=$(t)),e||(e=this.defaultValue()),this.value=e,this.updateUI(),this.isPopoverOpen&&this.refreshPopoverContent(),(i=this.onChange)==null||i.call(this,this.value),(s=this.detectChange)==null||s.call(this,this.value),this.pendingSolidColor=null,this.updateUnlinkButtonVisibility()}updateUI(){if(this.previewEl&&this.value)if(this.value.type==="solid"){const t=this.value.stops[0],e=t.opacity??100,i=this.resolveGlobalVarColor(t.color);this.previewEl.style.background=vt(i,e)}else{const t=this.resolveGradientGlobalVars(this.value);this.previewEl.style.background=O(t)}this.inputEl&&this.value&&!this.isEditing&&(this.inputEl.value=Z(this.value)),this.updateUnlinkButtonVisibility()}resolveGradientGlobalVars(t){return{...t,stops:t.stops.map(e=>({...e,color:this.resolveGlobalVarColor(e.color)}))}}updateUnlinkButtonVisibility(){if(!this.unlinkButton||!this.value)return;this.value.type==="solid"&&this.value.stops.length>0&&this.value.stops[0].color.startsWith("var(--")?this.unlinkButton.classList.add("visible"):this.unlinkButton.classList.remove("visible")}cssForTextValue(){return this.value?{background:O(this.value),"-webkit-background-clip":"text","background-clip":"text",color:"transparent","-webkit-text-fill-color":"transparent"}:{}}draw(){const t=document.createElement("div");if(t.className="gradient-setting-wrapper",this.props.title){const i=document.createElement("div");i.className="icon-container";const s=document.createElement("span");s.className="input-label",s.textContent=this.props.title,i.appendChild(s),t.appendChild(i)}const e=document.createElement("div");return e.className="gradient-input-wrapper",this.previewEl=document.createElement("div"),this.previewEl.className="gradient-mini-preview",this.previewEl.style.background=this.value?O(this.value):"linear-gradient(90deg, #a84b4b 0%, #786666 100%)",this.previewEl.addEventListener("click",i=>{i.preventDefault(),i.stopPropagation(),this.openPopover()}),this.inputEl=document.createElement("input"),this.inputEl.type="text",this.inputEl.className="gradient-text-input",this.inputEl.placeholder="Enter gradient CSS or paste color...",this.inputEl.value=this.value?Z(this.value):"",this.inputEl.readOnly=!1,this.inputEl.addEventListener("focus",()=>{if(this.isEditing=!0,this.value)if(this.value.type==="solid"){const i=this.value.stops[0];if(i){const s=i.color.toUpperCase(),n=i.opacity??100;if(n===100)this.inputEl.value=s;else{const o=Math.round(n/100*255).toString(16).toUpperCase().padStart(2,"0");this.inputEl.value=`${s}${o}`}}}else this.inputEl.value=O(this.value)}),this.inputEl.addEventListener("blur",()=>{this.isEditing=!1,this.value&&(this.inputEl.value=Z(this.value))}),this.inputEl.addEventListener("paste",i=>this.handlePaste(i)),this.inputEl.addEventListener("input",i=>this.handleTextInput(i)),this.inputEl.addEventListener("keydown",i=>{i.key==="Enter"&&(this.handleTextInput(i),this.inputEl.blur()),i.key==="Escape"&&(this.value&&(this.inputEl.value=O(this.value)),this.inputEl.blur())}),e.appendChild(this.previewEl),this.unlinkButton=document.createElement("button"),this.unlinkButton.type="button",this.unlinkButton.className="gradient-unlink-button",this.unlinkButton.innerHTML=de,this.unlinkButton.title="Break global color binding",this.unlinkButton.addEventListener("click",i=>{i.preventDefault(),i.stopPropagation(),this.breakGlobalBinding()}),e.appendChild(this.unlinkButton),e.appendChild(this.inputEl),t.appendChild(e),this.createPopover(),this.element=t,this.updateUnlinkButtonVisibility(),t}createPopover(){var l,r,p;if(this.popoverEl)return;this.backdropEl=document.createElement("div"),this.backdropEl.className="gradient-popover-backdrop",this.backdropEl.style.display="none",this.backdropEl.addEventListener("click",c=>{c.preventDefault(),c.stopPropagation(),this.closePopover()}),this.popoverEl=document.createElement("div"),this.popoverEl.className="gradient-popover",this.popoverEl.style.display="none",this.popoverEl.addEventListener("click",c=>{c.stopPropagation()});const t=document.createElement("div");t.className="gradient-popover-header",t.style.cursor="move";let e=null;if(this.variant!=="global"){e=document.createElement("div"),e.className="color-setting-tabs header-tabs";const c=document.createElement("button");c.className="color-tab active",c.textContent="Custom";const d=document.createElement("button");d.className="color-tab",d.textContent="Global",e.appendChild(c),e.appendChild(d),t.appendChild(e)}else{const c=document.createElement("div");t.appendChild(c)}const i=document.createElement("button");i.type="button",i.className="gradient-popover-close",i.innerHTML=bt,i.addEventListener("click",()=>this.closePopover()),t.appendChild(i),mt(t,this.popoverEl,(c,d)=>{this.popoverPosition={left:c,top:d}});const s=document.createElement("div");s.className="gradient-editor";const n=document.createElement("div");n.className="type-tabs-wrapper";const a=this.createTypeTabs();n.appendChild(a),s.appendChild(n);const o=document.createElement("div");if(o.className="gradient-editor-content",this.updatePopoverContent(o),s.appendChild(o),this.variant!=="global"&&e){const c=e.children[0],d=e.children[1],u=g=>{this.currentMode=g,g==="custom"?(c.classList.add("active"),d.classList.remove("active"),n.style.display="block"):(d.classList.add("active"),c.classList.remove("active"),n.style.display="none"),this.updatePopoverContent(o)};c.addEventListener("click",()=>u("custom")),d.addEventListener("click",()=>u("global")),(p=(r=(l=this.value)==null?void 0:l.stops)==null?void 0:r[0])!=null&&p.color.startsWith("var(--")?(this.currentMode="global",u("global")):(this.currentMode="custom",u("custom"))}this.popoverEl.appendChild(t),this.popoverEl.appendChild(s),document.body.appendChild(this.backdropEl),document.body.appendChild(this.popoverEl)}createTypeTabs(){var s,n;const t=document.createElement("div");t.className="gradient-type-tabs";const e=document.createElement("button");e.type="button",e.className=`gradient-type-tab ${((s=this.value)==null?void 0:s.type)==="solid"?"active":""}`,e.innerHTML=ce,e.style.minWidth="32px",e.addEventListener("click",()=>this.switchType("solid"));const i=document.createElement("button");return i.type="button",i.className=`gradient-type-tab ${((n=this.value)==null?void 0:n.type)!=="solid"?"active":""}`,i.innerHTML=he,i.style.minWidth="32px",i.addEventListener("click",()=>{var o,l;const a=((o=this.value)==null?void 0:o.type)==="solid"?"linear":((l=this.value)==null?void 0:l.type)||"linear";this.switchType(a)}),t.appendChild(e),t.appendChild(i),t}switchType(t){var i;if(!this.value)return;if(this.value.type=t,t!=="solid"&&(!this.value.stops||this.value.stops.length===0)&&(this.value.stops=[{color:"#a84b4b",position:0,opacity:100},{color:"#786666",position:100,opacity:100}]),t!=="solid"&&this.value.stops.length===1){const n=this.value.stops[0].color;if(n.startsWith("var(--")){const a=this.resolveGlobalVarColor(n),o=V(a);o&&o.type!=="solid"&&o.stops.length>=2?(this.value.stops=o.stops,this.value.angle=o.angle,this.value.type=o.type):(this.value.stops.push({color:"#786666",position:100,opacity:100}),this.value.angle=90)}else this.value.stops.push({color:"#786666",position:100,opacity:100}),this.value.angle=90}else t!=="solid"&&this.value.stops.length>=2&&(this.value.angle||(this.value.angle=90));if(this.popoverEl){const s=this.popoverEl.querySelectorAll(".gradient-type-tab");s.forEach(o=>o.classList.remove("active"));const n=s[0],a=s[1];t==="solid"?n==null||n.classList.add("active"):a==null||a.classList.add("active")}const e=(i=this.popoverEl)==null?void 0:i.querySelector(".gradient-editor-content");e&&this.updatePopoverContent(e),this.updateUI(),this.triggerChange()}updatePopoverContent(t){if(t.innerHTML="",!!this.value){if(this.variant!=="global"&&this.currentMode==="global"){this.renderGlobalColors(t);return}this.value.type==="solid"?this.renderSolid(t):this.renderGradient(t)}}renderGlobalColors(t){(!this.value||!this.value.stops||!this.value.stops.length)&&(this.value||(this.value=this.defaultValue()),this.value.stops=[{color:"#000000",position:0,opacity:100}]);const e=this.value.stops[0],i=c=>{c.innerHTML="";let d={};try{d=x.GlobalVariables||{}}catch(m){console.warn("Could not access Setting.GlobalVariables",m)}if(!d||Object.keys(d).length===0){const m=document.createElement("div");m.textContent="No global colors defined",m.style.fontSize="12px",m.style.color="#666",m.style.padding="8px",c.appendChild(m);return}const u=[{title:"Global Colors",keys:["primary","secondary","tertiary","accent","background"]},{title:"Text Color",keys:["text-dark","text-light"]}],g=this.globalSearchQuery.toLowerCase();let f;this.globalLayoutMode==="list"?(f=document.createElement("div"),f.className="global-colors-list"):(f=document.createElement("div"),f.className="global-colors-grid"),c.appendChild(f),u.forEach(m=>{const v=Object.entries(d).filter(([C])=>!m.keys.includes(C)&&m.title!=="Global Colors"?!1:m.keys.includes(C)&&C.toLowerCase().includes(g));v.length!==0&&v.forEach(([C,w])=>{if(this.globalLayoutMode==="list"){const E=document.createElement("div");E.className="global-color-row";const M=document.createElement("div");M.className="global-color-circle";const y=this.resolveGlobalVarColor(w);M.style.background=y,e.color===`var(--${C})`&&M.classList.add("selected");const b=document.createElement("span");b.className="global-color-label",b.textContent=C.split("-").map(k=>k.charAt(0).toUpperCase()+k.slice(1)).join(" "),E.appendChild(M),E.appendChild(b),E.addEventListener("click",k=>{k.preventDefault();const A=`var(--${C})`;this.setValue(A),this.pendingSolidColor=A,i(c)}),f.appendChild(E)}else{const E=document.createElement("div");E.className="global-color-circle";const M=this.resolveGlobalVarColor(w);E.style.background=M,E.title=C.split("-").map(y=>y.charAt(0).toUpperCase()+y.slice(1)).join(" "),e.color===`var(--${C})`&&E.classList.add("selected"),E.addEventListener("click",y=>{y.preventDefault();const b=`var(--${C})`;this.setValue(b),this.pendingSolidColor=b,i(c)}),f.appendChild(E)}})})},s=document.createElement("div");s.className="global-controls-row";const n=document.createElement("div");n.className="global-search-container";const a=document.createElement("span");a.className="global-search-icon",a.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="11" cy="11" r="8"></circle><line x1="21" y1="21" x2="16.65" y2="16.65"></line></svg>';const o=document.createElement("input");o.type="text",o.className="global-search-input",o.placeholder="Search",o.value=this.globalSearchQuery;const l=document.createElement("div");o.addEventListener("input",c=>{this.globalSearchQuery=c.target.value,i(l)}),n.appendChild(a),n.appendChild(o);const r=document.createElement("button");r.className="global-layout-toggle",r.type="button";const p=()=>{r.innerHTML=this.globalLayoutMode==="list"?'<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"><rect x="3" y="3" width="7" height="7"></rect><rect x="14" y="3" width="7" height="7"></rect><rect x="14" y="14" width="7" height="7"></rect><rect x="3" y="14" width="7" height="7"></rect></svg>':'<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"><line x1="8" y1="6" x2="21" y2="6"></line><line x1="8" y1="12" x2="21" y2="12"></line><line x1="8" y1="18" x2="21" y2="18"></line><line x1="3" y1="6" x2="3.01" y2="6"></line><line x1="3" y1="12" x2="3.01" y2="12"></line><line x1="3" y1="18" x2="3.01" y2="18"></line></svg>'};p(),r.addEventListener("click",()=>{this.globalLayoutMode=this.globalLayoutMode==="list"?"grid":"list",p(),i(l)}),s.appendChild(n),s.appendChild(r),t.appendChild(s),t.appendChild(l),i(l)}renderSolid(t){(!this.value||!this.value.stops||!this.value.stops.length)&&(this.value||(this.value=this.defaultValue()),this.value.stops=[{color:"#000000",position:0,opacity:100}]);const e=this.value.stops[0],i=new ue({initialColor:e.color.startsWith("var(--")?this.resolveGlobalVarColor(e.color):e.color,initialOpacity:e.opacity??100,onColorChange:(s,n)=>{if(this.value){const a=V(s);if(a&&a.type!=="solid"){this.value=a,this.switchType(a.type);return}this.value.stops[0].color=s,this.value.stops[0].opacity=n,this.updateUI(),this.triggerChange(),this.pendingSolidColor=s}}});this.solidPicker=i,t.appendChild(i.getElement())}renderGradient(t){this.solidPicker=null;const e=this.variant!=="global";let i=null;if(e){const c=document.createElement("div");c.className="gradient-subtype-inline";const d=document.createElement("select");d.className="gradient-subtype-select";const u=document.createElement("option");u.value="linear",u.textContent="Linear";const g=document.createElement("option");g.value="radial",g.textContent="Radial",d.appendChild(u),d.appendChild(g),d.value=this.value.type==="radial"?"radial":"linear",i=document.createElement("input"),i.type="text",i.inputMode="numeric",i.className="gradient-degree-input",i.value=`${this.value.angle??90}°`,i.style.width="75px",i.style.textAlign="center",(!this.value.angle||this.value.stops.length<2)&&(this.value.angle=90,i.value="90°");const f=document.createElement("button");f.type="button",f.className="gradient-flip-btn",f.innerHTML=le,d.addEventListener("change",()=>{this.switchType(d.value==="radial"?"radial":"linear"),i&&this.updateDegreeVisibility(i)}),i.addEventListener("focus",m=>{const v=m.target;v.value=v.value.replace(/[^0-9-]/g,""),setTimeout(()=>v.select(),0)}),i.addEventListener("input",m=>{const v=parseInt(m.target.value);!Number.isNaN(v)&&this.value&&(this.value.angle=Math.max(0,Math.min(360,v)),this.debouncedPreviewUpdate())}),i.addEventListener("blur",m=>{var w;this.previewUpdateTimeout&&(clearTimeout(this.previewUpdateTimeout),this.previewUpdateTimeout=null);const v=m.target;let C=parseInt(v.value);Number.isNaN(C)&&(C=((w=this.value)==null?void 0:w.angle)??0),C=Math.max(0,Math.min(360,C)),this.value&&(this.value.angle=C),v.value=`${C}°`,this.updateGradientPreview(),this.updateUI(),this.triggerChange()}),f.addEventListener("click",()=>{!this.value||!this.value.stops||(this.value.stops.forEach(m=>{m.position=100-m.position}),this.value.stops.sort((m,v)=>m.position-v.position),this.updateGradientPreview(s),this.createHandles(n,s),this.updateStopsList(r),this.updateUI(),this.triggerChange())}),c.appendChild(d),c.appendChild(i),c.appendChild(f),t.appendChild(c),this.updateDegreeVisibility(i)}const s=document.createElement("div");s.className="gradient-preview",this.updateGradientPreview(s);const n=document.createElement("div");n.className="gradient-handles",s.appendChild(n),t.appendChild(s),this.createHandles(n,s);const a=document.createElement("div");a.className="gradient-stops-header";const o=document.createElement("span");o.textContent="Stops";const l=document.createElement("button");l.type="button",l.className="gradient-add-stop",l.textContent="+",a.appendChild(o),a.appendChild(l);const r=document.createElement("div");r.className="gradient-stops",t.appendChild(a),t.appendChild(r),this.updateStopsList(r);const p=ot(c=>{const d=V(c);d&&(this.value=d,this.switchType(d.type),this.updateUI(),this.triggerChange())},"all");this.recentGradientRefresh=p.refresh,t.appendChild(p.container),l.addEventListener("click",()=>{var c;this.addStop(),this.updateStopsList(r),this.updateGradientPreview(s),this.createHandles(n,s),this.updateUI(),((c=document.activeElement)==null?void 0:c.tagName)!=="INPUT"&&this.repositionPopover(),this.triggerChange()})}updateDegreeVisibility(t){var e;t&&(((e=this.value)==null?void 0:e.type)==="radial"?(t.disabled=!0,t.style.opacity="0.5"):(t.disabled=!1,t.style.opacity="1"))}updateGradientPreview(t){var i;const e=t||((i=this.popoverEl)==null?void 0:i.querySelector(".gradient-preview"));e&&this.value&&(e.style.background=O(this.value))}debouncedPreviewUpdate(t){this.previewUpdateTimeout&&clearTimeout(this.previewUpdateTimeout),this.previewUpdateTimeout=window.setTimeout(()=>{this.updateGradientPreview(t),this.previewUpdateTimeout=null},16)}createHandles(t,e){t.innerHTML="",!(!this.value||this.value.type==="solid"||!this.value.stops)&&this.value.stops.forEach((i,s)=>{const n=document.createElement("div");n.className="gstop-handle",n.style.left=`${Math.max(0,Math.min(100,i.position))}%`,n.style.top="0%";const a=document.createElement("div");a.className="gstop-chip",a.style.backgroundColor=i.color,n.appendChild(a);let o=!1,l=0,r=0;const p=u=>{o=!0,l=u.clientX,r=this.value.stops[s].position,n.classList.add("selected"),document.addEventListener("mousemove",c),document.addEventListener("mouseup",d),u.preventDefault(),u.stopPropagation()},c=u=>{if(!o||!this.value)return;const g=e.getBoundingClientRect(),f=u.clientX-l;let m=r+f/g.width*100;m=Math.max(0,Math.min(100,m)),this.value.stops[s].position=Math.round(m),n.style.left=`${m}%`,this.updateGradientPreview()},d=()=>{o&&(o=!1,n.classList.remove("selected"),document.removeEventListener("mousemove",c),document.removeEventListener("mouseup",d),this.value&&(this.value.stops.sort((u,g)=>u.position-g.position),this.createHandles(t,e),this.updateStopsList()),this.updateUI(),this.triggerChange())};n.addEventListener("mousedown",p),t.appendChild(n)})}updateStopsList(t){var i;const e=t||((i=this.popoverEl)==null?void 0:i.querySelector(".gradient-stops"));!e||!this.value||this.value.type==="solid"||!this.value.stops||(e.innerHTML="",this.value.stops.forEach((s,n)=>{var E,M;const a=document.createElement("div");a.className="gstop-row";const o=document.createElement("div");o.className="gstop-position-group";const l=document.createElement("input");l.type="text",l.className="gstop-position-input",l.value=`${s.position}%`,l.style.width="60px",o.appendChild(l);const r=document.createElement("div");r.className="gstop-color-container";const p=document.createElement("div");p.className="gstop-color-preview",p.style.backgroundColor=s.color;const c=document.createElement("input");c.type="text",c.className="gstop-color-input",c.value=s.color.replace("#","").toUpperCase();const d=document.createElement("button");d.type="button",d.className="gstop-color-copy",d.textContent="Copy",r.appendChild(p),r.appendChild(c),r.appendChild(d);const u=document.createElement("button");u.type="button",u.className="gstop-del",u.innerHTML=re,u.disabled=(((M=(E=this.value)==null?void 0:E.stops)==null?void 0:M.length)||0)<=2,a.appendChild(o),a.appendChild(r),a.appendChild(u),e.appendChild(a);const g=document.createElement("span");g.className="gstop-opacity-label",g.textContent="Opacity";const f=document.createElement("div");f.className="gstop-opacity-group";const m=document.createElement("input");m.type="range",m.className="gstop-opacity-slider",m.min="0",m.max="100",m.value=String(s.opacity??100);const v=N(s.color);m.style.setProperty("--slider-color",`rgb(${v.r}, ${v.g}, ${v.b})`);const C=document.createElement("span");C.className="gstop-opacity-value",C.textContent=`${s.opacity??100}%`,f.appendChild(m),f.appendChild(C);const w=new pe((y,b)=>{c.value=y.replace("#","").toUpperCase(),p.style.backgroundColor=y,this.value.stops[n].color=y,b!==void 0&&(this.value.stops[n].opacity=b,m.value=String(b),C.textContent=`${b}%`);const k=N(y);m.style.setProperty("--slider-color",`rgb(${k.r}, ${k.g}, ${k.b})`),this.updateGradientPreview(),this.createHandles(this.popoverEl.querySelector(".gradient-handles"),this.popoverEl.querySelector(".gradient-preview")),this.updateUI(),this.triggerChange()},"solid");c.addEventListener("click",y=>{y.preventDefault(),y.stopPropagation(),w.open(s.color,c,s.opacity??100)}),c.addEventListener("input",()=>{const y=c.value.trim(),b=y.startsWith("#")?y:`#${y}`;if(/^#[0-9A-Fa-f]{6}$/.test(b)){this.value.stops[n].color=b,p.style.backgroundColor=b;const k=N(b);m.style.setProperty("--slider-color",`rgb(${k.r}, ${k.g}, ${k.b})`),this.debouncedPreviewUpdate()}}),c.addEventListener("blur",()=>{this.previewUpdateTimeout&&(clearTimeout(this.previewUpdateTimeout),this.previewUpdateTimeout=null),this.updateGradientPreview(),this.updateUI(),this.triggerChange()}),d.addEventListener("click",async y=>{y.stopPropagation();try{await navigator.clipboard.writeText(`#${c.value}`)}catch{}}),l.addEventListener("focus",y=>{const b=y.target;b.value=b.value.replace("%",""),b.select()}),l.addEventListener("input",y=>{const b=y.target,k=parseInt(b.value.replace(/[^\d]/g,""),10);if(!Number.isNaN(k)){const A=Math.max(0,Math.min(100,k));this.value.stops[n].position=A,b.value=`${A}%`,this.debouncedPreviewUpdate()}}),l.addEventListener("blur",y=>{this.previewUpdateTimeout&&(clearTimeout(this.previewUpdateTimeout),this.previewUpdateTimeout=null);const b=y.target,k=parseInt(b.value.replace(/[^\d]/g,""),10);if(Number.isNaN(k))b.value=`${this.value.stops[n].position}%`;else{const A=Math.max(0,Math.min(100,k));this.value.stops[n].position=A,b.value=`${A}%`}this.updateGradientPreview(),this.createHandles(this.popoverEl.querySelector(".gradient-handles"),this.popoverEl.querySelector(".gradient-preview")),this.updateStopsList(),this.updateUI(),this.triggerChange()}),u.addEventListener("click",()=>{var y;(this.value.stops.length||0)<=2||(this.value.stops.splice(n,1),this.createHandles(this.popoverEl.querySelector(".gradient-handles"),this.popoverEl.querySelector(".gradient-preview")),this.updateStopsList(),this.updateGradientPreview(),this.updateUI(),((y=document.activeElement)==null?void 0:y.tagName)!=="INPUT"&&this.repositionPopover(),this.triggerChange())}),m.addEventListener("input",()=>{const y=parseInt(m.value,10);this.value.stops[n].opacity=Math.max(0,Math.min(100,y)),C.textContent=`${this.value.stops[n].opacity}%`,this.debouncedPreviewUpdate()}),m.addEventListener("change",()=>{this.previewUpdateTimeout&&(clearTimeout(this.previewUpdateTimeout),this.previewUpdateTimeout=null),this.updateGradientPreview(),this.updateUI(),this.triggerChange()})}))}addStop(){if(!this.value||this.value.type==="solid"||!this.value.stops)return;const t=this.value.stops.map(a=>a.position).sort((a,o)=>a-o);let e=50,i=0;for(let a=0;a<t.length-1;a++){const o=t[a+1]-t[a];o>i&&(i=o,e=t[a]+o/2)}const s=this.value.stops.reduce((a,o)=>Math.abs(o.position-e)<Math.abs(a.position-e)?o:a),n={position:Math.round(e),color:s.color,opacity:s.opacity??100};this.value.stops.push(n),this.value.stops.sort((a,o)=>a.position-o.position)}openPopover(){if(this.popoverEl&&(H.openInstance&&H.openInstance!==this&&H.openInstance.closePopover(),!this.isPopoverOpen)){if(this.isPopoverOpen=!0,H.openInstance=this,this.backdropEl&&(this.backdropEl.style.display="block",this.backdropEl.parentElement||document.body.appendChild(this.backdropEl)),this.popoverEl.style.display="flex",this.refreshPopoverContent(),this.element){const t=this.element.getBoundingClientRect(),e=306,i=window.innerWidth,s=window.innerHeight,n=16;this.popoverEl.style.position="fixed",this.popoverEl.style.zIndex="10000",this.popoverEl.style.left="-9999px",this.popoverEl.style.top="0px";const a=this.popoverEl.offsetHeight;let o=t.right+8,l=t.top;const r=i-t.right,p=t.left,c=e+n;r<c&&p>r+100&&(o=t.left-e-8);const d=s-t.bottom,u=t.top;u>=a+n?l=t.top-a-8:d>=a+n?l=t.bottom+8:u>d?(l=t.top-a-8,l<n&&(l=n)):(l=t.bottom+8,l+a>s-n&&(l=s-a-n)),this.popoverEl.style.left=`${o}px`,this.popoverEl.style.top=`${l}px`,this.popoverPosition={left:o,top:l}}setTimeout(()=>document.addEventListener("click",this.onBackgroundClick,!0),200),document.addEventListener("keydown",this.handlePopoverKeydown,!0)}}repositionPopover(){var t;if(!(!this.popoverEl||!this.isPopoverOpen||!this.element)&&((t=document.activeElement)==null?void 0:t.tagName)!=="INPUT"){if(this.popoverPosition){this.popoverEl.style.left=`${this.popoverPosition.left}px`,this.popoverEl.style.top=`${this.popoverPosition.top}px`;return}requestAnimationFrame(()=>{if(!this.popoverEl||!this.element)return;const e=this.element.getBoundingClientRect(),i=306,s=window.innerWidth,n=window.innerHeight,a=16;this.popoverEl.style.left,this.popoverEl.style.top,this.popoverEl.style.left="-9999px",this.popoverEl.style.top="0px";const o=this.popoverEl.offsetHeight;let l=e.right+8,r=e.top;const p=s-e.right,c=e.left,d=i+a;p<d&&c>p+100&&(l=e.left-i-8);const u=n-e.bottom,g=e.top;g>=o+a?r=e.top-o-8:u>=o+a?r=e.bottom+8:g>u?(r=e.top-o-8,r<a&&(r=a)):(r=e.bottom+8,r+o>n-a&&(r=n-o-a)),this.popoverEl.style.left=`${l}px`,this.popoverEl.style.top=`${r}px`})}}refreshPopoverContent(){var n,a;if(!this.popoverEl)return;const t=this.popoverEl.querySelectorAll(".gradient-type-tab");t.forEach(o=>o.classList.remove("active"));const e=t[0],i=t[1];((n=this.value)==null?void 0:n.type)==="solid"?e.classList.add("active"):(i.classList.add("active"),(a=this.recentGradientRefresh)==null||a.call(this)),this.popoverEl.offsetHeight;const s=this.popoverEl.querySelector(".gradient-editor-content");s&&this.updatePopoverContent(s)}closePopover(){var t;if(!(!this.popoverEl||!this.isPopoverOpen)){if(this.isPopoverOpen=!1,this.popoverPosition=null,this.backdropEl&&(this.backdropEl.style.display="none"),this.popoverEl.style.display="none",document.removeEventListener("click",this.onBackgroundClick,!0),document.removeEventListener("keydown",this.handlePopoverKeydown,!0),this.commitPendingSolidColor(),this.value&&this.value.type!=="solid"){const e=O(this.value);G.addColor(e,"gradient"),(t=this.recentGradientRefresh)==null||t.call(this)}this.previewUpdateTimeout&&(clearTimeout(this.previewUpdateTimeout),this.previewUpdateTimeout=null),H.openInstance===this&&(H.openInstance=null)}}commitPendingSolidColor(){this.pendingSolidColor&&(this.solidPicker?this.solidPicker.commitRecentColor():G.addColor(this.pendingSolidColor,"solid"),this.pendingSolidColor=null)}handlePaste(t){var i;t.preventDefault();const e=((i=t.clipboardData)==null?void 0:i.getData("text"))||"";this.parseAndSet(e)}handleTextInput(t){const e=t.target;this.parseAndSet(e.value)}parseAndSet(t){const e=V(t.trim());e&&this.setValue(e)}triggerChange(){var t,e;this.value&&((t=this.onChange)==null||t.call(this,this.value),(e=this.detectChange)==null||e.call(this,this.value))}getElement(){return this.element}getValue(){return this.value?O(this.value):""}getCSSValue(){return this.value?O(this.value):""}getCSSForText(){return this.value?this.cssForTextValue():{}}getRawValue(){return this.value}};H.openInstance=null;let j=H;const ge=`
|
|
215
|
+
linear-gradient(to right, #fff, hsl(${n}, 100%, 50%))`,this.syncInput(),this.updateOpacityBg()}syncInput(){const t=this.select.value,{h:e,s:i,v:s}=R(this.currentColor);if(t==="hex")this.input.value=this.currentColor;else if(t==="rgb"){const{r:n,g:a,b:o}=N(this.currentColor);this.input.value=`rgb(${n}, ${a}, ${o})`}else{const{hue:n,sat:a,lightness:o}=vt(e,i,s);this.input.value=`hsl(${Math.round(n)}, ${Math.round(a*100)}%, ${Math.round(o*100)}%)`}}applyFromInput(){const t=this.input.value.trim();let e="";if(/^#[0-9A-Fa-f]{6}$/.test(t))e=t;else{const i=t.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);if(i){const s=parseInt(i[1],10),n=parseInt(i[2],10),a=parseInt(i[3],10);s<=255&&n<=255&&a<=255&&(e="#"+[s,n,a].map(o=>o.toString(16).padStart(2,"0")).join(""))}else{const s=t.match(/hsl\((\d+),\s*(\d+)%,\s*(\d+)%\)/);if(s){const n=parseInt(s[1],10),a=parseInt(s[2],10)/100,o=parseInt(s[3],10)/100,l=o+a*Math.min(o,1-o),r=l===0?0:2*(1-o/l);e=F(n,r,l)}}}e&&(this.setColor(e),this.onColorChange(this.currentColor,this.currentOpacity))}updateOpacityBg(){const{r:t,g:e,b:i}=N(this.currentColor);this.opacitySlider.style.setProperty("--base-color",`rgb(${t}, ${e}, ${i})`)}queueChange(){this.changeRafId===void 0&&(this.changeRafId=window.requestAnimationFrame(()=>{this.changeRafId=void 0,this.onColorChange(this.currentColor,this.currentOpacity)}))}flushChange(){this.changeRafId!==void 0&&(cancelAnimationFrame(this.changeRafId),this.changeRafId=void 0),this.onColorChange(this.currentColor,this.currentOpacity)}applyPendingExternal(){if(!this.pendingExternalUpdate)return;const{color:t,opacity:e}=this.pendingExternalUpdate;this.pendingExternalUpdate=void 0,this.initFromColor(t,e)}initFromColor(t,e){var o;this.currentColor=t,this.currentOpacity=e;const{h:i,s,v:n}=R(t),a=i>=360?i%360:i;this.hueMarker.style.left=`${a/360*100}%`,this.colorMarker.style.left=`${s*100}%`,this.colorMarker.style.top=`${(1-n)*100}%`,this.colorArea.style.background=`linear-gradient(to top, #000, transparent),
|
|
216
|
+
linear-gradient(to right, #fff, hsl(${a}, 100%, 50%))`,this.opacityMarker.style.left=`${e}%`,this.updateOpacityBg(),this.syncInput(),(o=this.recentSectionRefresh)==null||o.call(this)}commitRecentColor(){var t;this.recentScope==="solid"&&(G.addColor(this.currentColor,this.recentScope),(t=this.recentSectionRefresh)==null||t.call(this))}getElement(){return this.element}updateColor(t,e){if(this.isDragging){this.pendingExternalUpdate={color:t,opacity:e};return}this.initFromColor(t,e)}}const H=class H extends x{constructor(t={}){const e=typeof t.default=="string"?void 0:t.default;super({...t,title:t.title||"Color",default:e}),this.inputType={type:"text",angle:"number",stops:"text"},this.element=null,this.previewEl=null,this.inputEl=void 0,this.popoverEl=null,this.backdropEl=null,this.isPopoverOpen=!1,this.isEditing=!1,this.popoverPosition=null,this.previewUpdateTimeout=null,this.solidPicker=null,this.pendingSolidColor=null,this.variant="default",this.globalLayoutMode="list",this.globalSearchQuery="",this.currentMode="custom",this.unlinkButton=null,this.onBackgroundClick=i=>{var d;if(!this.popoverEl||!this.isPopoverOpen)return;const s=i.target,n=this.popoverEl.contains(s),a=(d=this.element)==null?void 0:d.contains(s),o=document.querySelectorAll(".custom-color-picker"),l=Array.from(o).some(u=>u.contains(s)),r=s.closest(".gstop-color-input, .gradient-mini-preview, .gstop-color-preview"),p=s.classList.contains("color-picker-backdrop"),c=s.classList.contains("gradient-popover-backdrop");!n&&!a&&!l&&!r&&!p&&!c&&this.closePopover()},this.handlePopoverKeydown=i=>{if(this.isPopoverOpen){if(i.key==="Escape"){i.preventDefault(),this.closePopover();return}if(i.key==="Enter"){const s=i.target;if(s&&(s.tagName==="INPUT"||s.tagName==="TEXTAREA"))return;i.preventDefault(),this.closePopover()}}},this.detectChange=t.detectChange,this.variant=t.variant??"default",this.originalDefault=t.default,this.value=this.defaultValue()}resolveGlobalVarColor(t){if(t.startsWith("var(--")){const e=t.replace("var(--","").replace(")","");return(x.GlobalVariables||{})[e]||t}return t}breakGlobalBinding(){if(!this.value||this.value.type!=="solid"||!this.value.stops.length)return;const e=this.value.stops[0].color;if(!e.startsWith("var(--"))return;const i=this.resolveGlobalVarColor(e);if(i===e){console.warn(`Could not resolve global variable: ${e}`);return}this.value.stops[0].color=i,this.updateUI(),this.triggerChange(),this.isPopoverOpen&&this.refreshPopoverContent()}defaultValue(){const t=this.originalDefault;if(typeof t=="string"){if(t.startsWith("var(--"))return $({type:"solid",angle:0,stops:[{color:t,position:0,opacity:100}]});const i=V(t);if(i)return $(i)}return $(t&&typeof t=="object"?t:{type:"linear",angle:90,stops:[{color:"#a84b4b",position:0,opacity:100},{color:"#786666",position:100,opacity:100}]})}setValue(t){var i,s;let e=null;typeof t=="string"?t.startsWith("var(--")?e=$({type:"solid",angle:0,stops:[{color:t,position:0,opacity:100}]}):e=V(t):t&&typeof t=="object"&&(e=$(t)),e||(e=this.defaultValue()),this.value=e,this.updateUI(),this.isPopoverOpen&&this.refreshPopoverContent(),(i=this.onChange)==null||i.call(this,this.value),(s=this.detectChange)==null||s.call(this,this.value),this.pendingSolidColor=null,this.updateUnlinkButtonVisibility()}updateUI(){if(this.previewEl&&this.value)if(this.value.type==="solid"){const t=this.value.stops[0],e=t.opacity??100,i=this.resolveGlobalVarColor(t.color);this.previewEl.style.background=ft(i,e)}else{const t=this.resolveGradientGlobalVars(this.value);this.previewEl.style.background=O(t)}this.inputEl&&this.value&&!this.isEditing&&(this.inputEl.value=Z(this.value)),this.updateUnlinkButtonVisibility()}resolveGradientGlobalVars(t){return{...t,stops:t.stops.map(e=>({...e,color:this.resolveGlobalVarColor(e.color)}))}}updateUnlinkButtonVisibility(){if(!this.unlinkButton||!this.value)return;this.value.type==="solid"&&this.value.stops.length>0&&this.value.stops[0].color.startsWith("var(--")?this.unlinkButton.classList.add("visible"):this.unlinkButton.classList.remove("visible")}cssForTextValue(){return this.value?{background:O(this.value),"-webkit-background-clip":"text","background-clip":"text",color:"transparent","-webkit-text-fill-color":"transparent"}:{}}draw(){const t=document.createElement("div");if(t.className="gradient-setting-wrapper",this.props.title){const i=document.createElement("div");i.className="icon-container";const s=document.createElement("span");s.className="input-label",s.textContent=this.props.title,i.appendChild(s),t.appendChild(i)}const e=document.createElement("div");return e.className="gradient-input-wrapper",this.previewEl=document.createElement("div"),this.previewEl.className="gradient-mini-preview",this.previewEl.style.background=this.value?O(this.value):"linear-gradient(90deg, #a84b4b 0%, #786666 100%)",this.previewEl.addEventListener("click",i=>{i.preventDefault(),i.stopPropagation(),this.openPopover()}),this.inputEl=document.createElement("input"),this.inputEl.type="text",this.inputEl.className="gradient-text-input",this.inputEl.placeholder="Enter gradient CSS or paste color...",this.inputEl.value=this.value?Z(this.value):"",this.inputEl.readOnly=!1,this.inputEl.addEventListener("focus",()=>{if(this.isEditing=!0,this.value)if(this.value.type==="solid"){const i=this.value.stops[0];if(i){const s=i.color.toUpperCase(),n=i.opacity??100;if(n===100)this.inputEl.value=s;else{const o=Math.round(n/100*255).toString(16).toUpperCase().padStart(2,"0");this.inputEl.value=`${s}${o}`}}}else this.inputEl.value=O(this.value)}),this.inputEl.addEventListener("blur",()=>{this.isEditing=!1,this.value&&(this.inputEl.value=Z(this.value))}),this.inputEl.addEventListener("paste",i=>this.handlePaste(i)),this.inputEl.addEventListener("input",i=>this.handleTextInput(i)),this.inputEl.addEventListener("keydown",i=>{i.key==="Enter"&&(this.handleTextInput(i),this.inputEl.blur()),i.key==="Escape"&&(this.value&&(this.inputEl.value=O(this.value)),this.inputEl.blur())}),e.appendChild(this.previewEl),this.unlinkButton=document.createElement("button"),this.unlinkButton.type="button",this.unlinkButton.className="gradient-unlink-button",this.unlinkButton.innerHTML=de,this.unlinkButton.title="Break global color binding",this.unlinkButton.addEventListener("click",i=>{i.preventDefault(),i.stopPropagation(),this.breakGlobalBinding()}),e.appendChild(this.unlinkButton),e.appendChild(this.inputEl),t.appendChild(e),this.createPopover(),this.element=t,this.updateUnlinkButtonVisibility(),t}createPopover(){var l,r,p;if(this.popoverEl)return;this.backdropEl=document.createElement("div"),this.backdropEl.className="gradient-popover-backdrop",this.backdropEl.style.display="none",this.backdropEl.addEventListener("click",c=>{c.preventDefault(),c.stopPropagation(),this.closePopover()}),this.popoverEl=document.createElement("div"),this.popoverEl.className="gradient-popover",this.popoverEl.style.display="none",this.popoverEl.addEventListener("click",c=>{c.stopPropagation()});const t=document.createElement("div");t.className="gradient-popover-header",t.style.cursor="move";let e=null;if(this.variant!=="global"){e=document.createElement("div"),e.className="color-setting-tabs header-tabs";const c=document.createElement("button");c.className="color-tab active",c.textContent="Custom";const d=document.createElement("button");d.className="color-tab",d.textContent="Global",e.appendChild(c),e.appendChild(d),t.appendChild(e)}else{const c=document.createElement("div");t.appendChild(c)}const i=document.createElement("button");i.type="button",i.className="gradient-popover-close",i.innerHTML=bt,i.addEventListener("click",()=>this.closePopover()),t.appendChild(i),mt(t,this.popoverEl,(c,d)=>{this.popoverPosition={left:c,top:d}});const s=document.createElement("div");s.className="gradient-editor";const n=document.createElement("div");n.className="type-tabs-wrapper";const a=this.createTypeTabs();n.appendChild(a),s.appendChild(n);const o=document.createElement("div");if(o.className="gradient-editor-content",this.updatePopoverContent(o),s.appendChild(o),this.variant!=="global"&&e){const c=e.children[0],d=e.children[1],u=g=>{this.currentMode=g,g==="custom"?(c.classList.add("active"),d.classList.remove("active"),n.style.display="block"):(d.classList.add("active"),c.classList.remove("active"),n.style.display="none"),this.updatePopoverContent(o)};c.addEventListener("click",()=>u("custom")),d.addEventListener("click",()=>u("global")),(p=(r=(l=this.value)==null?void 0:l.stops)==null?void 0:r[0])!=null&&p.color.startsWith("var(--")?(this.currentMode="global",u("global")):(this.currentMode="custom",u("custom"))}this.popoverEl.appendChild(t),this.popoverEl.appendChild(s),document.body.appendChild(this.backdropEl),document.body.appendChild(this.popoverEl)}createTypeTabs(){var s,n;const t=document.createElement("div");t.className="gradient-type-tabs";const e=document.createElement("button");e.type="button",e.className=`gradient-type-tab ${((s=this.value)==null?void 0:s.type)==="solid"?"active":""}`,e.innerHTML=ce,e.style.minWidth="32px",e.addEventListener("click",()=>this.switchType("solid"));const i=document.createElement("button");return i.type="button",i.className=`gradient-type-tab ${((n=this.value)==null?void 0:n.type)!=="solid"?"active":""}`,i.innerHTML=he,i.style.minWidth="32px",i.addEventListener("click",()=>{var o,l;const a=((o=this.value)==null?void 0:o.type)==="solid"?"linear":((l=this.value)==null?void 0:l.type)||"linear";this.switchType(a)}),t.appendChild(e),t.appendChild(i),t}switchType(t){var i;if(!this.value)return;if(this.value.type=t,t!=="solid"&&(!this.value.stops||this.value.stops.length===0)&&(this.value.stops=[{color:"#a84b4b",position:0,opacity:100},{color:"#786666",position:100,opacity:100}]),t!=="solid"&&this.value.stops.length===1){const n=this.value.stops[0].color;if(n.startsWith("var(--")){const a=this.resolveGlobalVarColor(n),o=V(a);o&&o.type!=="solid"&&o.stops.length>=2?(this.value.stops=o.stops,this.value.angle=o.angle,this.value.type=o.type):(this.value.stops.push({color:"#786666",position:100,opacity:100}),this.value.angle=90)}else this.value.stops.push({color:"#786666",position:100,opacity:100}),this.value.angle=90}else t!=="solid"&&this.value.stops.length>=2&&(this.value.angle||(this.value.angle=90));if(this.popoverEl){const s=this.popoverEl.querySelectorAll(".gradient-type-tab");s.forEach(o=>o.classList.remove("active"));const n=s[0],a=s[1];t==="solid"?n==null||n.classList.add("active"):a==null||a.classList.add("active")}const e=(i=this.popoverEl)==null?void 0:i.querySelector(".gradient-editor-content");e&&this.updatePopoverContent(e),this.updateUI(),this.triggerChange()}updatePopoverContent(t){if(t.innerHTML="",!!this.value){if(this.variant!=="global"&&this.currentMode==="global"){this.renderGlobalColors(t);return}this.value.type==="solid"?this.renderSolid(t):this.renderGradient(t)}}renderGlobalColors(t){(!this.value||!this.value.stops||!this.value.stops.length)&&(this.value||(this.value=this.defaultValue()),this.value.stops=[{color:"#000000",position:0,opacity:100}]);const e=this.value.stops[0],i=c=>{c.innerHTML="";let d={};try{d=x.GlobalVariables||{}}catch(m){console.warn("Could not access Setting.GlobalVariables",m)}if(!d||Object.keys(d).length===0){const m=document.createElement("div");m.textContent="No global colors defined",m.style.fontSize="12px",m.style.color="#666",m.style.padding="8px",c.appendChild(m);return}const u=[{title:"Global Colors",keys:["primary","secondary","tertiary","accent","background"]},{title:"Text Color",keys:["text-dark","text-light"]}],g=this.globalSearchQuery.toLowerCase();let v;this.globalLayoutMode==="list"?(v=document.createElement("div"),v.className="global-colors-list"):(v=document.createElement("div"),v.className="global-colors-grid"),c.appendChild(v),u.forEach(m=>{const f=Object.entries(d).filter(([C])=>!m.keys.includes(C)&&m.title!=="Global Colors"?!1:m.keys.includes(C)&&C.toLowerCase().includes(g));f.length!==0&&f.forEach(([C,w])=>{if(this.globalLayoutMode==="list"){const E=document.createElement("div");E.className="global-color-row";const M=document.createElement("div");M.className="global-color-circle";const y=this.resolveGlobalVarColor(w);M.style.background=y,e.color===`var(--${C})`&&M.classList.add("selected");const b=document.createElement("span");b.className="global-color-label",b.textContent=C.split("-").map(k=>k.charAt(0).toUpperCase()+k.slice(1)).join(" "),E.appendChild(M),E.appendChild(b),E.addEventListener("click",k=>{k.preventDefault();const A=`var(--${C})`;this.setValue(A),this.pendingSolidColor=A,i(c)}),v.appendChild(E)}else{const E=document.createElement("div");E.className="global-color-circle";const M=this.resolveGlobalVarColor(w);E.style.background=M,E.title=C.split("-").map(y=>y.charAt(0).toUpperCase()+y.slice(1)).join(" "),e.color===`var(--${C})`&&E.classList.add("selected"),E.addEventListener("click",y=>{y.preventDefault();const b=`var(--${C})`;this.setValue(b),this.pendingSolidColor=b,i(c)}),v.appendChild(E)}})})},s=document.createElement("div");s.className="global-controls-row";const n=document.createElement("div");n.className="global-search-container";const a=document.createElement("span");a.className="global-search-icon",a.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="11" cy="11" r="8"></circle><line x1="21" y1="21" x2="16.65" y2="16.65"></line></svg>';const o=document.createElement("input");o.type="text",o.className="global-search-input",o.placeholder="Search",o.value=this.globalSearchQuery;const l=document.createElement("div");o.addEventListener("input",c=>{this.globalSearchQuery=c.target.value,i(l)}),n.appendChild(a),n.appendChild(o);const r=document.createElement("button");r.className="global-layout-toggle",r.type="button";const p=()=>{r.innerHTML=this.globalLayoutMode==="list"?'<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"><rect x="3" y="3" width="7" height="7"></rect><rect x="14" y="3" width="7" height="7"></rect><rect x="14" y="14" width="7" height="7"></rect><rect x="3" y="14" width="7" height="7"></rect></svg>':'<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"><line x1="8" y1="6" x2="21" y2="6"></line><line x1="8" y1="12" x2="21" y2="12"></line><line x1="8" y1="18" x2="21" y2="18"></line><line x1="3" y1="6" x2="3.01" y2="6"></line><line x1="3" y1="12" x2="3.01" y2="12"></line><line x1="3" y1="18" x2="3.01" y2="18"></line></svg>'};p(),r.addEventListener("click",()=>{this.globalLayoutMode=this.globalLayoutMode==="list"?"grid":"list",p(),i(l)}),s.appendChild(n),s.appendChild(r),t.appendChild(s),t.appendChild(l),i(l)}renderSolid(t){(!this.value||!this.value.stops||!this.value.stops.length)&&(this.value||(this.value=this.defaultValue()),this.value.stops=[{color:"#000000",position:0,opacity:100}]);const e=this.value.stops[0],i=new ue({initialColor:e.color.startsWith("var(--")?this.resolveGlobalVarColor(e.color):e.color,initialOpacity:e.opacity??100,onColorChange:(s,n)=>{if(this.value){const a=V(s);if(a&&a.type!=="solid"){this.value=a,this.switchType(a.type);return}this.value.stops[0].color=s,this.value.stops[0].opacity=n,this.updateUI(),this.triggerChange(),this.pendingSolidColor=s}}});this.solidPicker=i,t.appendChild(i.getElement())}renderGradient(t){this.solidPicker=null;const e=this.variant!=="global";let i=null;if(e){const c=document.createElement("div");c.className="gradient-subtype-inline";const d=document.createElement("select");d.className="gradient-subtype-select";const u=document.createElement("option");u.value="linear",u.textContent="Linear";const g=document.createElement("option");g.value="radial",g.textContent="Radial",d.appendChild(u),d.appendChild(g),d.value=this.value.type==="radial"?"radial":"linear",i=document.createElement("input"),i.type="text",i.inputMode="numeric",i.className="gradient-degree-input",i.value=`${this.value.angle??90}°`,i.style.width="75px",i.style.textAlign="center",(!this.value.angle||this.value.stops.length<2)&&(this.value.angle=90,i.value="90°");const v=document.createElement("button");v.type="button",v.className="gradient-flip-btn",v.innerHTML=le,d.addEventListener("change",()=>{this.switchType(d.value==="radial"?"radial":"linear"),i&&this.updateDegreeVisibility(i)}),i.addEventListener("focus",m=>{const f=m.target;f.value=f.value.replace(/[^0-9-]/g,""),setTimeout(()=>f.select(),0)}),i.addEventListener("input",m=>{const f=parseInt(m.target.value);!Number.isNaN(f)&&this.value&&(this.value.angle=Math.max(0,Math.min(360,f)),this.debouncedPreviewUpdate())}),i.addEventListener("blur",m=>{var w;this.previewUpdateTimeout&&(clearTimeout(this.previewUpdateTimeout),this.previewUpdateTimeout=null);const f=m.target;let C=parseInt(f.value);Number.isNaN(C)&&(C=((w=this.value)==null?void 0:w.angle)??0),C=Math.max(0,Math.min(360,C)),this.value&&(this.value.angle=C),f.value=`${C}°`,this.updateGradientPreview(),this.updateUI(),this.triggerChange()}),v.addEventListener("click",()=>{!this.value||!this.value.stops||(this.value.stops.forEach(m=>{m.position=100-m.position}),this.value.stops.sort((m,f)=>m.position-f.position),this.updateGradientPreview(s),this.createHandles(n,s),this.updateStopsList(r),this.updateUI(),this.triggerChange())}),c.appendChild(d),c.appendChild(i),c.appendChild(v),t.appendChild(c),this.updateDegreeVisibility(i)}const s=document.createElement("div");s.className="gradient-preview",this.updateGradientPreview(s);const n=document.createElement("div");n.className="gradient-handles",s.appendChild(n),t.appendChild(s),this.createHandles(n,s);const a=document.createElement("div");a.className="gradient-stops-header";const o=document.createElement("span");o.textContent="Stops";const l=document.createElement("button");l.type="button",l.className="gradient-add-stop",l.textContent="+",a.appendChild(o),a.appendChild(l);const r=document.createElement("div");r.className="gradient-stops",t.appendChild(a),t.appendChild(r),this.updateStopsList(r);const p=ot(c=>{const d=V(c);d&&(this.value=d,this.switchType(d.type),this.updateUI(),this.triggerChange())},"all");this.recentGradientRefresh=p.refresh,t.appendChild(p.container),l.addEventListener("click",()=>{var c;this.addStop(),this.updateStopsList(r),this.updateGradientPreview(s),this.createHandles(n,s),this.updateUI(),((c=document.activeElement)==null?void 0:c.tagName)!=="INPUT"&&this.repositionPopover(),this.triggerChange()})}updateDegreeVisibility(t){var e;t&&(((e=this.value)==null?void 0:e.type)==="radial"?(t.disabled=!0,t.style.opacity="0.5"):(t.disabled=!1,t.style.opacity="1"))}updateGradientPreview(t){var i;const e=t||((i=this.popoverEl)==null?void 0:i.querySelector(".gradient-preview"));e&&this.value&&(e.style.background=O(this.value))}debouncedPreviewUpdate(t){this.previewUpdateTimeout&&clearTimeout(this.previewUpdateTimeout),this.previewUpdateTimeout=window.setTimeout(()=>{this.updateGradientPreview(t),this.previewUpdateTimeout=null},16)}createHandles(t,e){t.innerHTML="",!(!this.value||this.value.type==="solid"||!this.value.stops)&&this.value.stops.forEach((i,s)=>{const n=document.createElement("div");n.className="gstop-handle",n.style.left=`${Math.max(0,Math.min(100,i.position))}%`,n.style.top="0%";const a=document.createElement("div");a.className="gstop-chip",a.style.backgroundColor=i.color,n.appendChild(a);let o=!1,l=0,r=0;const p=u=>{o=!0,l=u.clientX,r=this.value.stops[s].position,n.classList.add("selected"),document.addEventListener("mousemove",c),document.addEventListener("mouseup",d),u.preventDefault(),u.stopPropagation()},c=u=>{if(!o||!this.value)return;const g=e.getBoundingClientRect(),v=u.clientX-l;let m=r+v/g.width*100;m=Math.max(0,Math.min(100,m)),this.value.stops[s].position=Math.round(m),n.style.left=`${m}%`,this.updateGradientPreview()},d=()=>{o&&(o=!1,n.classList.remove("selected"),document.removeEventListener("mousemove",c),document.removeEventListener("mouseup",d),this.value&&(this.value.stops.sort((u,g)=>u.position-g.position),this.createHandles(t,e),this.updateStopsList()),this.updateUI(),this.triggerChange())};n.addEventListener("mousedown",p),t.appendChild(n)})}updateStopsList(t){var i;const e=t||((i=this.popoverEl)==null?void 0:i.querySelector(".gradient-stops"));!e||!this.value||this.value.type==="solid"||!this.value.stops||(e.innerHTML="",this.value.stops.forEach((s,n)=>{var E,M;const a=document.createElement("div");a.className="gstop-row";const o=document.createElement("div");o.className="gstop-position-group";const l=document.createElement("input");l.type="text",l.className="gstop-position-input",l.value=`${s.position}%`,l.style.width="60px",o.appendChild(l);const r=document.createElement("div");r.className="gstop-color-container";const p=document.createElement("div");p.className="gstop-color-preview",p.style.backgroundColor=s.color;const c=document.createElement("input");c.type="text",c.className="gstop-color-input",c.value=s.color.replace("#","").toUpperCase();const d=document.createElement("button");d.type="button",d.className="gstop-color-copy",d.textContent="Copy",r.appendChild(p),r.appendChild(c),r.appendChild(d);const u=document.createElement("button");u.type="button",u.className="gstop-del",u.innerHTML=re,u.disabled=(((M=(E=this.value)==null?void 0:E.stops)==null?void 0:M.length)||0)<=2,a.appendChild(o),a.appendChild(r),a.appendChild(u),e.appendChild(a);const g=document.createElement("span");g.className="gstop-opacity-label",g.textContent="Opacity";const v=document.createElement("div");v.className="gstop-opacity-group";const m=document.createElement("input");m.type="range",m.className="gstop-opacity-slider",m.min="0",m.max="100",m.value=String(s.opacity??100);const f=N(s.color);m.style.setProperty("--slider-color",`rgb(${f.r}, ${f.g}, ${f.b})`);const C=document.createElement("span");C.className="gstop-opacity-value",C.textContent=`${s.opacity??100}%`,v.appendChild(m),v.appendChild(C);const w=new pe((y,b)=>{c.value=y.replace("#","").toUpperCase(),p.style.backgroundColor=y,this.value.stops[n].color=y,b!==void 0&&(this.value.stops[n].opacity=b,m.value=String(b),C.textContent=`${b}%`);const k=N(y);m.style.setProperty("--slider-color",`rgb(${k.r}, ${k.g}, ${k.b})`),this.updateGradientPreview(),this.createHandles(this.popoverEl.querySelector(".gradient-handles"),this.popoverEl.querySelector(".gradient-preview")),this.updateUI(),this.triggerChange()},"solid");c.addEventListener("click",y=>{y.preventDefault(),y.stopPropagation(),w.open(s.color,c,s.opacity??100)}),c.addEventListener("input",()=>{const y=c.value.trim(),b=y.startsWith("#")?y:`#${y}`;if(/^#[0-9A-Fa-f]{6}$/.test(b)){this.value.stops[n].color=b,p.style.backgroundColor=b;const k=N(b);m.style.setProperty("--slider-color",`rgb(${k.r}, ${k.g}, ${k.b})`),this.debouncedPreviewUpdate()}}),c.addEventListener("blur",()=>{this.previewUpdateTimeout&&(clearTimeout(this.previewUpdateTimeout),this.previewUpdateTimeout=null),this.updateGradientPreview(),this.updateUI(),this.triggerChange()}),d.addEventListener("click",async y=>{y.stopPropagation();try{await navigator.clipboard.writeText(`#${c.value}`)}catch{}}),l.addEventListener("focus",y=>{const b=y.target;b.value=b.value.replace("%",""),b.select()}),l.addEventListener("input",y=>{const b=y.target,k=parseInt(b.value.replace(/[^\d]/g,""),10);if(!Number.isNaN(k)){const A=Math.max(0,Math.min(100,k));this.value.stops[n].position=A,b.value=`${A}%`,this.debouncedPreviewUpdate()}}),l.addEventListener("blur",y=>{this.previewUpdateTimeout&&(clearTimeout(this.previewUpdateTimeout),this.previewUpdateTimeout=null);const b=y.target,k=parseInt(b.value.replace(/[^\d]/g,""),10);if(Number.isNaN(k))b.value=`${this.value.stops[n].position}%`;else{const A=Math.max(0,Math.min(100,k));this.value.stops[n].position=A,b.value=`${A}%`}this.updateGradientPreview(),this.createHandles(this.popoverEl.querySelector(".gradient-handles"),this.popoverEl.querySelector(".gradient-preview")),this.updateStopsList(),this.updateUI(),this.triggerChange()}),u.addEventListener("click",()=>{var y;(this.value.stops.length||0)<=2||(this.value.stops.splice(n,1),this.createHandles(this.popoverEl.querySelector(".gradient-handles"),this.popoverEl.querySelector(".gradient-preview")),this.updateStopsList(),this.updateGradientPreview(),this.updateUI(),((y=document.activeElement)==null?void 0:y.tagName)!=="INPUT"&&this.repositionPopover(),this.triggerChange())}),m.addEventListener("input",()=>{const y=parseInt(m.value,10);this.value.stops[n].opacity=Math.max(0,Math.min(100,y)),C.textContent=`${this.value.stops[n].opacity}%`,this.debouncedPreviewUpdate()}),m.addEventListener("change",()=>{this.previewUpdateTimeout&&(clearTimeout(this.previewUpdateTimeout),this.previewUpdateTimeout=null),this.updateGradientPreview(),this.updateUI(),this.triggerChange()})}))}addStop(){if(!this.value||this.value.type==="solid"||!this.value.stops)return;const t=this.value.stops.map(a=>a.position).sort((a,o)=>a-o);let e=50,i=0;for(let a=0;a<t.length-1;a++){const o=t[a+1]-t[a];o>i&&(i=o,e=t[a]+o/2)}const s=this.value.stops.reduce((a,o)=>Math.abs(o.position-e)<Math.abs(a.position-e)?o:a),n={position:Math.round(e),color:s.color,opacity:s.opacity??100};this.value.stops.push(n),this.value.stops.sort((a,o)=>a.position-o.position)}openPopover(){if(this.popoverEl&&(H.openInstance&&H.openInstance!==this&&H.openInstance.closePopover(),!this.isPopoverOpen)){if(this.isPopoverOpen=!0,H.openInstance=this,this.backdropEl&&(this.backdropEl.style.display="block",this.backdropEl.parentElement||document.body.appendChild(this.backdropEl)),this.popoverEl.style.display="flex",this.refreshPopoverContent(),this.element){const t=this.element.getBoundingClientRect(),e=306,i=window.innerWidth,s=window.innerHeight,n=16;this.popoverEl.style.position="fixed",this.popoverEl.style.zIndex="10000",this.popoverEl.style.left="-9999px",this.popoverEl.style.top="0px";const a=this.popoverEl.offsetHeight;let o=t.right+8,l=t.top;const r=i-t.right,p=t.left,c=e+n;r<c&&p>r+100&&(o=t.left-e-8);const d=s-t.bottom,u=t.top;u>=a+n?l=t.top-a-8:d>=a+n?l=t.bottom+8:u>d?(l=t.top-a-8,l<n&&(l=n)):(l=t.bottom+8,l+a>s-n&&(l=s-a-n)),this.popoverEl.style.left=`${o}px`,this.popoverEl.style.top=`${l}px`,this.popoverPosition={left:o,top:l}}setTimeout(()=>document.addEventListener("click",this.onBackgroundClick,!0),200),document.addEventListener("keydown",this.handlePopoverKeydown,!0)}}repositionPopover(){var t;if(!(!this.popoverEl||!this.isPopoverOpen||!this.element)&&((t=document.activeElement)==null?void 0:t.tagName)!=="INPUT"){if(this.popoverPosition){this.popoverEl.style.left=`${this.popoverPosition.left}px`,this.popoverEl.style.top=`${this.popoverPosition.top}px`;return}requestAnimationFrame(()=>{if(!this.popoverEl||!this.element)return;const e=this.element.getBoundingClientRect(),i=306,s=window.innerWidth,n=window.innerHeight,a=16;this.popoverEl.style.left,this.popoverEl.style.top,this.popoverEl.style.left="-9999px",this.popoverEl.style.top="0px";const o=this.popoverEl.offsetHeight;let l=e.right+8,r=e.top;const p=s-e.right,c=e.left,d=i+a;p<d&&c>p+100&&(l=e.left-i-8);const u=n-e.bottom,g=e.top;g>=o+a?r=e.top-o-8:u>=o+a?r=e.bottom+8:g>u?(r=e.top-o-8,r<a&&(r=a)):(r=e.bottom+8,r+o>n-a&&(r=n-o-a)),this.popoverEl.style.left=`${l}px`,this.popoverEl.style.top=`${r}px`})}}refreshPopoverContent(){var n,a;if(!this.popoverEl)return;const t=this.popoverEl.querySelectorAll(".gradient-type-tab");t.forEach(o=>o.classList.remove("active"));const e=t[0],i=t[1];((n=this.value)==null?void 0:n.type)==="solid"?e.classList.add("active"):(i.classList.add("active"),(a=this.recentGradientRefresh)==null||a.call(this)),this.popoverEl.offsetHeight;const s=this.popoverEl.querySelector(".gradient-editor-content");s&&this.updatePopoverContent(s)}closePopover(){var t;if(!(!this.popoverEl||!this.isPopoverOpen)){if(this.isPopoverOpen=!1,this.popoverPosition=null,this.backdropEl&&(this.backdropEl.style.display="none"),this.popoverEl.style.display="none",document.removeEventListener("click",this.onBackgroundClick,!0),document.removeEventListener("keydown",this.handlePopoverKeydown,!0),this.commitPendingSolidColor(),this.value&&this.value.type!=="solid"){const e=O(this.value);G.addColor(e,"gradient"),(t=this.recentGradientRefresh)==null||t.call(this)}this.previewUpdateTimeout&&(clearTimeout(this.previewUpdateTimeout),this.previewUpdateTimeout=null),H.openInstance===this&&(H.openInstance=null)}}commitPendingSolidColor(){this.pendingSolidColor&&(this.solidPicker?this.solidPicker.commitRecentColor():G.addColor(this.pendingSolidColor,"solid"),this.pendingSolidColor=null)}handlePaste(t){var i;t.preventDefault();const e=((i=t.clipboardData)==null?void 0:i.getData("text"))||"";this.parseAndSet(e)}handleTextInput(t){const e=t.target;this.parseAndSet(e.value)}parseAndSet(t){const e=V(t.trim());e&&this.setValue(e)}triggerChange(){var t,e;this.value&&((t=this.onChange)==null||t.call(this,this.value),(e=this.detectChange)==null||e.call(this,this.value))}getElement(){return this.element}getValue(){return this.value?O(this.value):""}getCSSValue(){return this.value?O(this.value):""}getCSSForText(){return this.value?this.cssForTextValue():{}}getRawValue(){return this.value}};H.openInstance=null;let j=H;const ge=`
|
|
217
217
|
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
218
218
|
<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"/>
|
|
219
219
|
</svg>
|
|
@@ -221,12 +221,12 @@
|
|
|
221
221
|
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
222
222
|
<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"/>
|
|
223
223
|
</svg>
|
|
224
|
-
`;class
|
|
224
|
+
`;class ve extends T{constructor(t){super({title:"Border",collapsed:t==null?void 0:t.collapsed,settings:{size:new I({title:"Size",icon:me,default:(t==null?void 0:t.size)??0,suffix:"px"}),color:new j({title:"Border Color",default:(t==null?void 0:t.color)||"#000000"}),radius:new I({title:"Radius",icon:ge,default:(t==null?void 0:t.radius)??12,suffix:"px"})}})}getValues(){const t=super.getValues(),e=this.settings.color.getValue();return{...t,color:e?`${e}`:t.color}}getCssCode(){const t=this.settings.color.getValue()??"#000000",e=this.settings.radius.value??0,i=this.settings.size.value??0;return`
|
|
225
225
|
border-image: ${t} 1;
|
|
226
226
|
border-width: ${i}px;
|
|
227
227
|
border-radius: ${e}px;
|
|
228
228
|
border-style: solid;
|
|
229
|
-
`}}const
|
|
229
|
+
`}}const fe=`
|
|
230
230
|
<svg xmlns="http://www.w3.org/2000/svg" width="14" height="13" viewBox="0 0 14 13" fill="none">
|
|
231
231
|
<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"/>
|
|
232
232
|
</svg>
|
|
@@ -238,7 +238,7 @@
|
|
|
238
238
|
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
239
239
|
<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"/>
|
|
240
240
|
</svg>
|
|
241
|
-
`;class be extends T{constructor(t={}){const{showAlign:e=t.showAlign??!0,...i}=t;super({title:i.title||"Typography",collapsed:i.collapsed,settings:(()=>{const s={color:new j({title:"Color",default:i.colorDefault??"#001E1E"}),fontFamily:new K({title:"Font",icon:
|
|
241
|
+
`;class be extends T{constructor(t={}){const{showAlign:e=t.showAlign??!0,...i}=t;super({title:i.title||"Typography",collapsed:i.collapsed,settings:(()=>{const s={color:new j({title:"Color",default:i.colorDefault??"#001E1E"}),fontFamily:new K({title:"Font",icon:fe,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 K({title:"Weight",icon:Ce,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 I({title:"Size",icon:ye,default:i.fontSizeDefault??12,suffix:"px",mobile:i.fontSizeMobileDefault})};return e?{...s,align:new gt({title:"Align",default:i.alignDefault??"center"})}:s})()})}getCssCode(){var a;const t=this.settings.color.getValue()??"#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`
|
|
242
242
|
color: ${t};
|
|
243
243
|
font-family: ${e};
|
|
244
244
|
font-weight: ${i};
|
|
@@ -271,4 +271,4 @@
|
|
|
271
271
|
opacity: ${e/100};
|
|
272
272
|
`:`
|
|
273
273
|
background-color: ${i};
|
|
274
|
-
`}}exports.AlignSetting=gt;exports.AnimationSetting=ee;exports.BackgroundSettingSet=Me;exports.BorderSettingSet=
|
|
274
|
+
`}}exports.AlignSetting=gt;exports.AnimationSetting=ee;exports.BackgroundSettingSet=Me;exports.BorderSettingSet=ve;exports.ButtonSetting=Ht;exports.ColorSetting=S;exports.ColorWithOpacitySetting=D;exports.DimensionSetting=$t;exports.GapSetting=Zt;exports.GradientSetting=j;exports.HeaderTypographySettingSet=be;exports.HeightSetting=Ft;exports.HtmlSetting=Tt;exports.MarginBottomSetting=Kt;exports.MarginSettingGroup=Ee;exports.MarginTopSetting=Qt;exports.MultiLanguageSetting=te;exports.NumberSetting=I;exports.OpacitySetting=ut;exports.SelectApiSettings=qt;exports.SelectSetting=K;exports.Setting=x;exports.SettingGroup=T;exports.StringSetting=pt;exports.TabSettingGroup=st;exports.TabsSettingGroup=st;exports.Toggle=_t;exports.UploadSetting=nt;exports.WidthSetting=Ut;exports.asSettingGroupWithSettings=Nt;exports.createSettingGroup=dt;exports.createTabSettingGroup=St;exports.isSetting=P;exports.isSettingChild=et;exports.isSettingGroup=L;exports.iterateSettings=U;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
const
|
|
1
|
+
const ft = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
|
|
2
2
|
let rt = (h = 21) => {
|
|
3
3
|
let t = "", e = crypto.getRandomValues(new Uint8Array(h |= 0));
|
|
4
4
|
for (; h--; )
|
|
5
|
-
t +=
|
|
5
|
+
t += ft[e[h] & 63];
|
|
6
6
|
return t;
|
|
7
7
|
};
|
|
8
8
|
function Ct(h) {
|
|
@@ -809,8 +809,8 @@ const K = class K {
|
|
|
809
809
|
d.stopPropagation(), d.preventDefault();
|
|
810
810
|
const u = this.getNextIndexFromPrefix(this.addItemCfg.keyPrefix), g = this.addItemCfg.createItem(u);
|
|
811
811
|
if (nt(g)) {
|
|
812
|
-
const
|
|
813
|
-
this.addSetting(
|
|
812
|
+
const v = `${this.addItemCfg.keyPrefix}${u}`;
|
|
813
|
+
this.addSetting(v, g);
|
|
814
814
|
}
|
|
815
815
|
}), o.appendChild(p);
|
|
816
816
|
}
|
|
@@ -871,7 +871,17 @@ class wt extends H {
|
|
|
871
871
|
return this.activeTabId;
|
|
872
872
|
}
|
|
873
873
|
switchToTab(t) {
|
|
874
|
-
|
|
874
|
+
var i;
|
|
875
|
+
if (!this.settings[t] || this.activeTabId === t) return;
|
|
876
|
+
this.activeTabId = t, this.updateTabUI();
|
|
877
|
+
const e = this.getValues();
|
|
878
|
+
this.initialValues = e, (i = this.onChange) == null || i.call(this, e);
|
|
879
|
+
}
|
|
880
|
+
getValues(t) {
|
|
881
|
+
return t !== void 0 ? super.getValues(t) : {
|
|
882
|
+
...super.getValues(),
|
|
883
|
+
activeTabId: this.activeTabId
|
|
884
|
+
};
|
|
875
885
|
}
|
|
876
886
|
updateTabUI() {
|
|
877
887
|
if (!this.tabsContainer || !this.contentContainers) return;
|
|
@@ -985,12 +995,12 @@ class N extends Lt {
|
|
|
985
995
|
if (t.className = "color-setting-wrapper " + (this.props.wrapperClassName || ""), this.props.title || this.props.icon) {
|
|
986
996
|
const g = document.createElement("div");
|
|
987
997
|
if (g.className = "icon-container", this.props.icon) {
|
|
988
|
-
const
|
|
989
|
-
|
|
998
|
+
const v = document.createElement("span");
|
|
999
|
+
v.className = "input-icon", v.innerHTML = this.props.icon, g.appendChild(v);
|
|
990
1000
|
}
|
|
991
1001
|
if (this.props.title) {
|
|
992
|
-
const
|
|
993
|
-
|
|
1002
|
+
const v = document.createElement("span");
|
|
1003
|
+
v.className = "input-label", v.textContent = this.props.title, g.appendChild(v);
|
|
994
1004
|
}
|
|
995
1005
|
t.appendChild(g);
|
|
996
1006
|
}
|
|
@@ -1010,26 +1020,26 @@ class N extends Lt {
|
|
|
1010
1020
|
try {
|
|
1011
1021
|
if (console.log("ColorSetting: renderGlobalOptions called"), o.innerHTML = "", !x) {
|
|
1012
1022
|
console.error("ColorSetting: Setting class is undefined");
|
|
1013
|
-
const
|
|
1014
|
-
|
|
1023
|
+
const v = document.createElement("div");
|
|
1024
|
+
v.textContent = "Error: System error (Setting undefined)", o.appendChild(v);
|
|
1015
1025
|
return;
|
|
1016
1026
|
}
|
|
1017
1027
|
const g = x.GlobalVariables || {};
|
|
1018
1028
|
if (console.log("ColorSetting: GlobalVariables:", g), !g || Object.keys(g).length === 0) {
|
|
1019
|
-
const
|
|
1020
|
-
|
|
1029
|
+
const v = document.createElement("div");
|
|
1030
|
+
v.textContent = "No global colors defined", v.style.gridColumn = "1 / -1", v.style.fontSize = "12px", v.style.color = "#666", o.appendChild(v);
|
|
1021
1031
|
return;
|
|
1022
1032
|
}
|
|
1023
|
-
Object.entries(g).forEach(([
|
|
1024
|
-
const
|
|
1025
|
-
|
|
1033
|
+
Object.entries(g).forEach(([v, m]) => {
|
|
1034
|
+
const f = document.createElement("button");
|
|
1035
|
+
f.className = "global-color-btn", f.title = v, f.style.width = "30px", f.style.height = "30px", f.style.borderRadius = "50%", f.style.border = "1px solid #ddd", f.style.backgroundColor = m, f.style.cursor = "pointer", this.value === `var(--${v})` && (f.style.border = "2px solid #2196f3"), f.addEventListener("click", (C) => {
|
|
1026
1036
|
var E, M;
|
|
1027
1037
|
C.preventDefault();
|
|
1028
|
-
const w = `var(--${
|
|
1038
|
+
const w = `var(--${v})`;
|
|
1029
1039
|
this.value = w, (E = this.onChange) == null || E.call(this, w), (M = this.detectChange) == null || M.call(this, w), Array.from(o.children).forEach((y) => {
|
|
1030
1040
|
y.style.border = "1px solid #ddd";
|
|
1031
|
-
}),
|
|
1032
|
-
}), o.appendChild(
|
|
1041
|
+
}), f.style.border = "2px solid #2196f3", c.style.backgroundColor = m;
|
|
1042
|
+
}), o.appendChild(f);
|
|
1033
1043
|
});
|
|
1034
1044
|
} catch (g) {
|
|
1035
1045
|
console.error("ColorSetting: Error in renderGlobalOptions", g), o.innerHTML = "Error loading global options";
|
|
@@ -1041,11 +1051,11 @@ class N extends Lt {
|
|
|
1041
1051
|
g.preventDefault(), n.classList.add("active"), s.classList.remove("active"), a.style.display = "none", o.style.display = "grid", l();
|
|
1042
1052
|
}), this.value && this.value.startsWith("var(--") ? n.click() : s.click();
|
|
1043
1053
|
const r = (g) => {
|
|
1044
|
-
const
|
|
1045
|
-
if (!
|
|
1054
|
+
const v = g.value.trim();
|
|
1055
|
+
if (!v)
|
|
1046
1056
|
return e.classList.remove("error"), !0;
|
|
1047
|
-
const
|
|
1048
|
-
return
|
|
1057
|
+
const f = /^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/.test(v);
|
|
1058
|
+
return f ? e.classList.remove("error") : e.classList.add("error"), f;
|
|
1049
1059
|
}, p = document.createElement("input");
|
|
1050
1060
|
p.type = "color", p.className = "color-picker", p.value = this.value && !this.value.startsWith("var(--") ? this.value : "#000000", p.setAttribute("aria-label", "Choose color"), p.setAttribute("title", "Click to open color picker"), this.getDataPropsPath() && p.setAttribute("data-test-id", this.getDataPropsPath()), this.colorInputEl = p;
|
|
1051
1061
|
const c = document.createElement("div");
|
|
@@ -1058,20 +1068,20 @@ class N extends Lt {
|
|
|
1058
1068
|
c.style.backgroundColor = d;
|
|
1059
1069
|
const u = document.createElement("input");
|
|
1060
1070
|
return u.type = "text", u.className = "color-text-input", u.value = this.value || "", u.placeholder = "#000000", u.setAttribute("pattern", "#[0-9A-Fa-f]{6}"), u.setAttribute("title", "Enter a hex color value (e.g., #ff0000)"), u.setAttribute("aria-label", "Hex color value"), u.setAttribute("maxlength", "7"), this.getDataPropsPath() && u.setAttribute("data-test-id", `${this.getDataPropsPath()}_text`), this.textInputEl = u, this.textInputEl.addEventListener("input", (g) => {
|
|
1061
|
-
var m,
|
|
1062
|
-
let
|
|
1071
|
+
var m, f;
|
|
1072
|
+
let v = g.target.value.trim();
|
|
1063
1073
|
if (this.textInputEl && r(this.textInputEl)) {
|
|
1064
|
-
const C = N.normalizeColorValue(
|
|
1065
|
-
this.value = C, (m = this.onChange) == null || m.call(this, C), (
|
|
1074
|
+
const C = N.normalizeColorValue(v);
|
|
1075
|
+
this.value = C, (m = this.onChange) == null || m.call(this, C), (f = this.detectChange) == null || f.call(this, C), this.colorInputEl && (this.colorInputEl.value = C), c.style.backgroundColor = C;
|
|
1066
1076
|
}
|
|
1067
1077
|
}), this.colorInputEl.addEventListener("input", (g) => {
|
|
1068
|
-
var
|
|
1069
|
-
const
|
|
1070
|
-
this.value = m, (
|
|
1078
|
+
var f, C;
|
|
1079
|
+
const v = g.target.value, m = N.normalizeColorValue(v);
|
|
1080
|
+
this.value = m, (f = this.onChange) == null || f.call(this, m), (C = this.detectChange) == null || C.call(this, m), this.textInputEl && (this.textInputEl.value = m), c.style.backgroundColor = m, e.classList.remove("error");
|
|
1071
1081
|
}), this.colorInputEl.addEventListener("change", (g) => {
|
|
1072
|
-
var
|
|
1073
|
-
const
|
|
1074
|
-
this.value = m, (
|
|
1082
|
+
var f, C;
|
|
1083
|
+
const v = g.target.value, m = N.normalizeColorValue(v);
|
|
1084
|
+
this.value = m, (f = this.onChange) == null || f.call(this, m), (C = this.detectChange) == null || C.call(this, m), this.textInputEl && (this.textInputEl.value = m), c.style.backgroundColor = m;
|
|
1075
1085
|
}), a.appendChild(p), a.appendChild(c), a.appendChild(u), e.appendChild(i), e.appendChild(a), e.appendChild(o), t.appendChild(e), this.element = t, t;
|
|
1076
1086
|
}
|
|
1077
1087
|
getElement() {
|
|
@@ -1849,7 +1859,7 @@ const Bt = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewB
|
|
|
1849
1859
|
<polyline points="6 9 12 15 18 9"></polyline>
|
|
1850
1860
|
</svg>
|
|
1851
1861
|
`;
|
|
1852
|
-
class
|
|
1862
|
+
class ve extends x {
|
|
1853
1863
|
constructor(t = {}) {
|
|
1854
1864
|
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) {
|
|
1855
1865
|
const e = this._options.findIndex(
|
|
@@ -1998,7 +2008,7 @@ class fe extends x {
|
|
|
1998
2008
|
), this.updateButtonText(), this.updateOptionsList(), this.detectChangeCallback && this.detectChangeCallback !== this.props.detectChange && this.detectChangeCallback(t);
|
|
1999
2009
|
}
|
|
2000
2010
|
}
|
|
2001
|
-
class
|
|
2011
|
+
class fe extends x {
|
|
2002
2012
|
constructor(t) {
|
|
2003
2013
|
var e, i;
|
|
2004
2014
|
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;
|
|
@@ -2173,8 +2183,8 @@ class Ee extends x {
|
|
|
2173
2183
|
const p = "...";
|
|
2174
2184
|
let c = 0, d = e.length, u = 0;
|
|
2175
2185
|
for (; c <= d; ) {
|
|
2176
|
-
const
|
|
2177
|
-
this.measureTextWidth(m, i) <= l ? (u =
|
|
2186
|
+
const v = Math.floor((c + d) / 2), m = e.slice(0, v).trimEnd() + p;
|
|
2187
|
+
this.measureTextWidth(m, i) <= l ? (u = v, c = v + 1) : d = v - 1;
|
|
2178
2188
|
}
|
|
2179
2189
|
const g = e.slice(0, u).trimEnd() + p;
|
|
2180
2190
|
t.placeholder = g;
|
|
@@ -2321,9 +2331,9 @@ const ht = (h, t, e) => {
|
|
|
2321
2331
|
a = d.left, o = d.top, document.addEventListener("mousemove", r), document.addEventListener("mouseup", p), document.body.style.userSelect = "none";
|
|
2322
2332
|
}, r = (c) => {
|
|
2323
2333
|
if (!i) return;
|
|
2324
|
-
const d = c.clientX - s, u = c.clientY - n, g = window.innerWidth,
|
|
2334
|
+
const d = c.clientX - s, u = c.clientY - n, g = window.innerWidth, v = window.innerHeight, m = t.offsetWidth, f = t.offsetHeight;
|
|
2325
2335
|
let C = a + d, w = o + u;
|
|
2326
|
-
C = Math.max(8, Math.min(g - m - 8, C)), w = Math.max(8, Math.min(
|
|
2336
|
+
C = Math.max(8, Math.min(g - m - 8, C)), w = Math.max(8, Math.min(v - f - 8, w)), t.style.left = `${C}px`, t.style.top = `${w}px`, e == null || e(C, w);
|
|
2327
2337
|
}, p = () => {
|
|
2328
2338
|
i = !1, document.removeEventListener("mousemove", r), document.removeEventListener("mouseup", p), document.body.style.userSelect = "";
|
|
2329
2339
|
};
|
|
@@ -2717,7 +2727,7 @@ const it = (h, t) => {
|
|
|
2717
2727
|
<path fill-rule="evenodd" clip-rule="evenodd"
|
|
2718
2728
|
d="M6.12347 4.96653L1.41158 0.254304C1.25449 0.102568 1.04409 0.0186071 0.825694 0.0205049C0.607302 0.0224037 0.398393 0.110007 0.24396 0.26445C0.0895282 0.418893 0.0019303 0.627818 3.24698e-05 0.846225C-0.00186536 1.06463 0.0820894 1.27505 0.233815 1.43215L4.9457 6.14438L0.233814 10.8566C0.0820886 11.0137 -0.00186625 11.2241 3.15434e-05 11.4425C0.00192934 11.6609 0.0895272 11.8699 0.243959 12.0243C0.398392 12.1787 0.607301 12.2663 0.825693 12.2682C1.04408 12.2701 1.25449 12.1862 1.41158 12.0344L6.12347 7.32222L10.8354 12.0344C10.9932 12.1824 11.2023 12.2632 11.4186 12.2597C11.6349 12.2562 11.8414 12.1687 11.9943 12.0156C12.1472 11.8626 12.2346 11.6561 12.2379 11.4398C12.2413 11.2234 12.1604 11.0143 12.0123 10.8566L7.30123 6.14438L12.0131 1.43215C12.0927 1.35531 12.1561 1.2634 12.1998 1.16177C12.2434 1.06014 12.2664 0.950833 12.2674 0.84023C12.2683 0.729626 12.2473 0.61994 12.2054 0.517568C12.1635 0.415196 12.1017 0.322191 12.0234 0.243979C11.9452 0.165768 11.8522 0.103916 11.7499 0.0620327C11.6475 0.0201492 11.5378 -0.000927989 11.4272 3.33052e-05C11.3166 0.000993646 11.2073 0.0239743 11.1057 0.0676297C11.0041 0.111286 10.9122 0.174745 10.8354 0.254305L6.12347 4.96653Z"
|
|
2719
2729
|
fill="#919EAB"/>
|
|
2720
|
-
</svg>`,
|
|
2730
|
+
</svg>`, vt = `<svg width="23" height="23" viewBox="0 0 23 23" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2721
2731
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M19.1972 3.29156C18.936 3.03034 18.6259 2.82313 18.2847 2.68176C17.9434 2.54039 17.5777 2.46763 17.2083 2.46763C16.8389 2.46763 16.4731 2.54039 16.1319 2.68176C15.7906 2.82313 15.4805 3.03034 15.2194 3.29156L13.7822 4.72875C13.2585 4.4772 12.6697 4.39449 12.097 4.49207C11.5243 4.58964 10.9961 4.86267 10.5853 5.27343L9.91687 5.94281C9.74268 6.11693 9.6045 6.32366 9.51023 6.5512C9.41595 6.77873 9.36743 7.02261 9.36743 7.2689C9.36743 7.5152 9.41595 7.75907 9.51023 7.98661C9.6045 8.21414 9.74268 8.42088 9.91687 8.595L3.83625 14.6747C3.57512 14.936 3.36803 15.2462 3.2268 15.5875C3.08556 15.9288 3.01296 16.2947 3.01312 16.6641V18.3516C3.01312 18.6499 3.13165 18.9361 3.34263 19.1471C3.55361 19.358 3.83975 19.4766 4.13812 19.4766H5.82562C6.57129 19.4759 7.28618 19.1792 7.81312 18.6516L13.8937 12.5728C14.0679 12.747 14.2746 12.8852 14.5021 12.9795C14.7297 13.0737 14.9735 13.1223 15.2198 13.1223C15.4661 13.1223 15.71 13.0737 15.9375 12.9795C16.1651 12.8852 16.3718 12.747 16.5459 12.5728L17.2153 11.9025C17.6261 11.4917 17.8991 10.9635 17.9967 10.3908C18.0942 9.81811 18.0115 9.22926 17.76 8.70562L19.1972 7.26937C19.4584 7.0082 19.6656 6.69813 19.807 6.35687C19.9484 6.01561 20.0211 5.64985 20.0211 5.28047C20.0211 4.91108 19.9484 4.54532 19.807 4.20406C19.6656 3.8628 19.4584 3.55273 19.1972 3.29156ZM5.16281 16.0012L11.2425 9.92062L12.5681 11.2462L6.48844 17.3269C6.31266 17.5027 6.07424 17.6015 5.82562 17.6016H4.88812V16.6641C4.88818 16.4154 4.98698 16.177 5.16281 16.0012Z" fill="#353C47"/>
|
|
2722
2732
|
</svg>`, _t = `<svg width="15" height="17" viewBox="0 0 15 17" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2723
2733
|
<path d="M14.1333 12.4667H0.8M0.8 12.4667L4.13333 9.13332M0.8 12.4667L4.13333 15.8M0.8 4.13332H14.1333M14.1333 4.13332L10.8 0.799988M14.1333 4.13332L10.8 7.46665" stroke="#919EAB" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/>
|
|
@@ -2788,7 +2798,7 @@ class Yt {
|
|
|
2788
2798
|
const o = document.createElement("div");
|
|
2789
2799
|
o.className = "color-picker-sliders-container";
|
|
2790
2800
|
const l = document.createElement("button");
|
|
2791
|
-
l.className = "color-picker-eyedropper", l.type = "button", l.innerHTML =
|
|
2801
|
+
l.className = "color-picker-eyedropper", l.type = "button", l.innerHTML = vt;
|
|
2792
2802
|
const r = document.createElement("div");
|
|
2793
2803
|
r.className = "color-picker-sliders-group";
|
|
2794
2804
|
const p = document.createElement("div");
|
|
@@ -2804,22 +2814,22 @@ class Yt {
|
|
|
2804
2814
|
this.setColor(b), (k = this.onChange) == null || k.call(this, b, this.currentOpacity);
|
|
2805
2815
|
}, this.recentScope);
|
|
2806
2816
|
this.recentSectionRefresh = g.refresh;
|
|
2807
|
-
const
|
|
2808
|
-
|
|
2817
|
+
const v = document.createElement("div");
|
|
2818
|
+
v.className = "color-picker-format-section";
|
|
2809
2819
|
const m = document.createElement("select");
|
|
2810
2820
|
m.className = "color-picker-format-select", this.select = m;
|
|
2811
|
-
const
|
|
2812
|
-
|
|
2821
|
+
const f = document.createElement("option");
|
|
2822
|
+
f.value = "hex", f.textContent = "HEX";
|
|
2813
2823
|
const C = document.createElement("option");
|
|
2814
2824
|
C.value = "rgb", C.textContent = "RGB";
|
|
2815
2825
|
const w = document.createElement("option");
|
|
2816
|
-
w.value = "hsl", w.textContent = "HSL", m.appendChild(
|
|
2826
|
+
w.value = "hsl", w.textContent = "HSL", m.appendChild(f), m.appendChild(C), m.appendChild(w);
|
|
2817
2827
|
const E = document.createElement("input");
|
|
2818
2828
|
E.type = "text", E.className = "color-picker-color-input", E.value = this.currentColor, this.input = E;
|
|
2819
2829
|
const M = document.createElement("div");
|
|
2820
2830
|
M.className = "color-picker-input-container";
|
|
2821
2831
|
const y = document.createElement("button");
|
|
2822
|
-
return y.className = "color-picker-copy-inside", y.textContent = "Copy", M.appendChild(E), M.appendChild(y),
|
|
2832
|
+
return y.className = "color-picker-copy-inside", y.textContent = "Copy", M.appendChild(E), M.appendChild(y), v.appendChild(m), v.appendChild(M), t.appendChild(e), t.appendChild(n), t.appendChild(o), t.appendChild(g.container), t.appendChild(v), t.addEventListener("click", (b) => b.stopPropagation()), this.bind(n, p, d, E, m, y, l), t;
|
|
2823
2833
|
}
|
|
2824
2834
|
createBackdrop() {
|
|
2825
2835
|
const t = document.createElement("div");
|
|
@@ -2832,15 +2842,15 @@ class Yt {
|
|
|
2832
2842
|
var C;
|
|
2833
2843
|
const d = t.getBoundingClientRect(), u = Math.max(0, Math.min(1, (c.clientX - d.left) / d.width)), g = Math.max(0, Math.min(1, (c.clientY - d.top) / d.height));
|
|
2834
2844
|
this.colorMarker.style.left = `${u * 100}%`, this.colorMarker.style.top = `${g * 100}%`;
|
|
2835
|
-
const m = this.parsePercentage(this.hueMarker.style.left || "0%") * 360,
|
|
2836
|
-
this.currentColor =
|
|
2845
|
+
const m = this.parsePercentage(this.hueMarker.style.left || "0%") * 360, f = F(m, u, 1 - g);
|
|
2846
|
+
this.currentColor = f, this.syncInput(), this.updateOpacityBg(), (C = this.onChange) == null || C.call(this, f, this.currentOpacity);
|
|
2837
2847
|
}, r = (c) => {
|
|
2838
2848
|
var C;
|
|
2839
2849
|
const d = e.getBoundingClientRect();
|
|
2840
2850
|
let u = Math.max(0, Math.min(1, (c.clientX - d.left) / d.width));
|
|
2841
2851
|
this.hueMarker.style.left = `${u * 100}%`;
|
|
2842
|
-
const g = u * 360,
|
|
2843
|
-
this.currentColor =
|
|
2852
|
+
const g = u * 360, v = this.parsePercentage(this.colorMarker.style.left || "0%"), m = this.parsePercentage(this.colorMarker.style.top || "0%"), f = F(g, v, 1 - m);
|
|
2853
|
+
this.currentColor = f, this.colorArea.style.background = `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(${g}, 100%, 50%))`, this.syncInput(), this.updateOpacityBg(), (C = this.onChange) == null || C.call(this, f, this.currentOpacity);
|
|
2844
2854
|
}, p = (c) => {
|
|
2845
2855
|
var g;
|
|
2846
2856
|
const d = i.getBoundingClientRect(), u = Math.max(0, Math.min(1, (c.clientX - d.left) / d.width));
|
|
@@ -2940,10 +2950,10 @@ class Yt {
|
|
|
2940
2950
|
this.hueMarker.style.left = `${s / 360 * 100}%`, this.colorMarker.style.left = `${n * 100}%`, this.colorMarker.style.top = `${(1 - a) * 100}%`, this.colorArea.style.background = `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(${s}, 100%, 50%))`, this.updateOpacityBg(), this.opacityMarker.style.left = `${this.currentOpacity}%`, (w = this.recentSectionRefresh) == null || w.call(this), this.isOpen = !0, this.backdrop.style.display = "block", this.backdrop.parentElement || document.body.appendChild(this.backdrop), this.element.style.display = "block", this.element.style.position = "fixed", this.element.style.zIndex = "10002", this.element.style.left = "-9999px", this.element.style.top = "0px", this.element.parentElement || document.body.appendChild(this.element);
|
|
2941
2951
|
const o = this.element.offsetWidth, l = this.element.offsetHeight, r = e.getBoundingClientRect(), p = window.innerWidth, c = window.innerHeight, d = 16;
|
|
2942
2952
|
let u = r.right + 8, g = r.top;
|
|
2943
|
-
const
|
|
2944
|
-
|
|
2945
|
-
const
|
|
2946
|
-
|
|
2953
|
+
const v = p - r.right, m = r.left;
|
|
2954
|
+
v >= o + d ? u = r.right + 8 : m >= o + d ? u = r.left - o - 8 : u = Math.max(d, (p - o) / 2);
|
|
2955
|
+
const f = c - r.bottom, C = r.top;
|
|
2956
|
+
f >= l + d ? g = r.bottom + 8 : C >= l + d ? g = r.top - l - 8 : f > C ? (g = r.bottom + 8, g + l > c - d && (g = c - l - d)) : (g = r.top - l - 8, g < d && (g = d)), this.element.style.left = `${u}px`, this.element.style.top = `${g}px`;
|
|
2947
2957
|
}
|
|
2948
2958
|
close(t) {
|
|
2949
2959
|
var e;
|
|
@@ -2971,7 +2981,7 @@ class Qt {
|
|
|
2971
2981
|
const s = document.createElement("div");
|
|
2972
2982
|
s.className = "color-picker-sliders-container embedded";
|
|
2973
2983
|
const n = document.createElement("button");
|
|
2974
|
-
n.className = "color-picker-eyedropper", n.type = "button", n.innerHTML =
|
|
2984
|
+
n.className = "color-picker-eyedropper", n.type = "button", n.innerHTML = vt;
|
|
2975
2985
|
const a = document.createElement("div");
|
|
2976
2986
|
a.className = "color-picker-sliders-group";
|
|
2977
2987
|
const o = document.createElement("div");
|
|
@@ -2993,28 +3003,28 @@ class Qt {
|
|
|
2993
3003
|
u.className = "color-picker-format-select", this.select = u;
|
|
2994
3004
|
const g = document.createElement("option");
|
|
2995
3005
|
g.value = "hex", g.textContent = "HEX";
|
|
2996
|
-
const
|
|
2997
|
-
|
|
3006
|
+
const v = document.createElement("option");
|
|
3007
|
+
v.value = "rgb", v.textContent = "RGB";
|
|
2998
3008
|
const m = document.createElement("option");
|
|
2999
|
-
m.value = "hsl", m.textContent = "HSL", u.appendChild(g), u.appendChild(
|
|
3000
|
-
const
|
|
3001
|
-
|
|
3009
|
+
m.value = "hsl", m.textContent = "HSL", u.appendChild(g), u.appendChild(v), u.appendChild(m);
|
|
3010
|
+
const f = document.createElement("input");
|
|
3011
|
+
f.type = "text", f.className = "color-picker-color-input", this.input = f;
|
|
3002
3012
|
const C = document.createElement("div");
|
|
3003
3013
|
C.className = "color-picker-input-container";
|
|
3004
3014
|
const w = document.createElement("button");
|
|
3005
|
-
return w.className = "color-picker-copy-inside", w.textContent = "Copy", C.appendChild(
|
|
3015
|
+
return w.className = "color-picker-copy-inside", w.textContent = "Copy", C.appendChild(f), C.appendChild(w), d.appendChild(u), d.appendChild(C), t.appendChild(e), t.appendChild(s), t.appendChild(d), t.appendChild(c.container), this.bind(e, o, r, f, u, w, n), t;
|
|
3006
3016
|
}
|
|
3007
3017
|
bind(t, e, i, s, n, a, o) {
|
|
3008
3018
|
const l = (c) => {
|
|
3009
3019
|
const d = t.getBoundingClientRect(), u = Math.max(0, Math.min(1, (c.clientX - d.left) / d.width)), g = Math.max(0, Math.min(1, (c.clientY - d.top) / d.height));
|
|
3010
3020
|
this.colorMarker.style.left = `${u * 100}%`, this.colorMarker.style.top = `${g * 100}%`;
|
|
3011
|
-
const m = this.parsePercentage(this.hueMarker.style.left || "0%") * 360,
|
|
3012
|
-
this.currentColor =
|
|
3021
|
+
const m = this.parsePercentage(this.hueMarker.style.left || "0%") * 360, f = F(m, u, 1 - g);
|
|
3022
|
+
this.currentColor = f, this.syncInput(), this.updateOpacityBg(), this.queueChange();
|
|
3013
3023
|
}, r = (c) => {
|
|
3014
3024
|
const d = e.getBoundingClientRect(), u = Math.max(0, Math.min(1, (c.clientX - d.left) / d.width));
|
|
3015
3025
|
this.hueMarker.style.left = `${u * 100}%`;
|
|
3016
|
-
const g = u * 360,
|
|
3017
|
-
this.currentColor =
|
|
3026
|
+
const g = u * 360, v = this.parsePercentage(this.colorMarker.style.left || "0%"), m = this.parsePercentage(this.colorMarker.style.top || "0%"), f = F(g, v, 1 - m);
|
|
3027
|
+
this.currentColor = f, this.colorArea.style.background = `linear-gradient(to top, #000, transparent),
|
|
3018
3028
|
linear-gradient(to right, #fff, hsl(${g}, 100%, 50%))`, this.syncInput(), this.updateOpacityBg(), this.queueChange();
|
|
3019
3029
|
}, p = (c) => {
|
|
3020
3030
|
const d = i.getBoundingClientRect(), u = Math.max(0, Math.min(1, (c.clientX - d.left) / d.width));
|
|
@@ -3422,10 +3432,10 @@ const P = class P extends x {
|
|
|
3422
3432
|
keys: ["text-dark", "text-light"]
|
|
3423
3433
|
}
|
|
3424
3434
|
], g = this.globalSearchQuery.toLowerCase();
|
|
3425
|
-
let
|
|
3426
|
-
this.globalLayoutMode === "list" ? (
|
|
3427
|
-
const
|
|
3428
|
-
|
|
3435
|
+
let v;
|
|
3436
|
+
this.globalLayoutMode === "list" ? (v = document.createElement("div"), v.className = "global-colors-list") : (v = document.createElement("div"), v.className = "global-colors-grid"), c.appendChild(v), u.forEach((m) => {
|
|
3437
|
+
const f = Object.entries(d).filter(([C]) => !m.keys.includes(C) && m.title !== "Global Colors" ? !1 : m.keys.includes(C) && C.toLowerCase().includes(g));
|
|
3438
|
+
f.length !== 0 && f.forEach(([C, w]) => {
|
|
3429
3439
|
if (this.globalLayoutMode === "list") {
|
|
3430
3440
|
const E = document.createElement("div");
|
|
3431
3441
|
E.className = "global-color-row";
|
|
@@ -3438,7 +3448,7 @@ const P = class P extends x {
|
|
|
3438
3448
|
k.preventDefault();
|
|
3439
3449
|
const $ = `var(--${C})`;
|
|
3440
3450
|
this.setValue($), this.pendingSolidColor = $, i(c);
|
|
3441
|
-
}),
|
|
3451
|
+
}), v.appendChild(E);
|
|
3442
3452
|
} else {
|
|
3443
3453
|
const E = document.createElement("div");
|
|
3444
3454
|
E.className = "global-color-circle";
|
|
@@ -3447,7 +3457,7 @@ const P = class P extends x {
|
|
|
3447
3457
|
y.preventDefault();
|
|
3448
3458
|
const b = `var(--${C})`;
|
|
3449
3459
|
this.setValue(b), this.pendingSolidColor = b, i(c);
|
|
3450
|
-
}),
|
|
3460
|
+
}), v.appendChild(E);
|
|
3451
3461
|
}
|
|
3452
3462
|
});
|
|
3453
3463
|
});
|
|
@@ -3503,26 +3513,26 @@ const P = class P extends x {
|
|
|
3503
3513
|
u.value = "linear", u.textContent = "Linear";
|
|
3504
3514
|
const g = document.createElement("option");
|
|
3505
3515
|
g.value = "radial", g.textContent = "Radial", d.appendChild(u), d.appendChild(g), d.value = this.value.type === "radial" ? "radial" : "linear", i = document.createElement("input"), i.type = "text", i.inputMode = "numeric", i.className = "gradient-degree-input", i.value = `${this.value.angle ?? 90}°`, i.style.width = "75px", i.style.textAlign = "center", (!this.value.angle || this.value.stops.length < 2) && (this.value.angle = 90, i.value = "90°");
|
|
3506
|
-
const
|
|
3507
|
-
|
|
3516
|
+
const v = document.createElement("button");
|
|
3517
|
+
v.type = "button", v.className = "gradient-flip-btn", v.innerHTML = _t, d.addEventListener("change", () => {
|
|
3508
3518
|
this.switchType(d.value === "radial" ? "radial" : "linear"), i && this.updateDegreeVisibility(i);
|
|
3509
3519
|
}), i.addEventListener("focus", (m) => {
|
|
3510
|
-
const
|
|
3511
|
-
|
|
3520
|
+
const f = m.target;
|
|
3521
|
+
f.value = f.value.replace(/[^0-9-]/g, ""), setTimeout(() => f.select(), 0);
|
|
3512
3522
|
}), i.addEventListener("input", (m) => {
|
|
3513
|
-
const
|
|
3514
|
-
!Number.isNaN(
|
|
3523
|
+
const f = parseInt(m.target.value);
|
|
3524
|
+
!Number.isNaN(f) && this.value && (this.value.angle = Math.max(0, Math.min(360, f)), this.debouncedPreviewUpdate());
|
|
3515
3525
|
}), i.addEventListener("blur", (m) => {
|
|
3516
3526
|
var w;
|
|
3517
3527
|
this.previewUpdateTimeout && (clearTimeout(this.previewUpdateTimeout), this.previewUpdateTimeout = null);
|
|
3518
|
-
const
|
|
3519
|
-
let C = parseInt(
|
|
3520
|
-
Number.isNaN(C) && (C = ((w = this.value) == null ? void 0 : w.angle) ?? 0), C = Math.max(0, Math.min(360, C)), this.value && (this.value.angle = C),
|
|
3521
|
-
}),
|
|
3528
|
+
const f = m.target;
|
|
3529
|
+
let C = parseInt(f.value);
|
|
3530
|
+
Number.isNaN(C) && (C = ((w = this.value) == null ? void 0 : w.angle) ?? 0), C = Math.max(0, Math.min(360, C)), this.value && (this.value.angle = C), f.value = `${C}°`, this.updateGradientPreview(), this.updateUI(), this.triggerChange();
|
|
3531
|
+
}), v.addEventListener("click", () => {
|
|
3522
3532
|
!this.value || !this.value.stops || (this.value.stops.forEach((m) => {
|
|
3523
3533
|
m.position = 100 - m.position;
|
|
3524
|
-
}), this.value.stops.sort((m,
|
|
3525
|
-
}), c.appendChild(d), c.appendChild(i), c.appendChild(
|
|
3534
|
+
}), this.value.stops.sort((m, f) => m.position - f.position), this.updateGradientPreview(s), this.createHandles(n, s), this.updateStopsList(r), this.updateUI(), this.triggerChange());
|
|
3535
|
+
}), c.appendChild(d), c.appendChild(i), c.appendChild(v), t.appendChild(c), this.updateDegreeVisibility(i);
|
|
3526
3536
|
}
|
|
3527
3537
|
const s = document.createElement("div");
|
|
3528
3538
|
s.className = "gradient-preview", this.updateGradientPreview(s);
|
|
@@ -3570,8 +3580,8 @@ const P = class P extends x {
|
|
|
3570
3580
|
o = !0, l = u.clientX, r = this.value.stops[s].position, n.classList.add("selected"), document.addEventListener("mousemove", c), document.addEventListener("mouseup", d), u.preventDefault(), u.stopPropagation();
|
|
3571
3581
|
}, c = (u) => {
|
|
3572
3582
|
if (!o || !this.value) return;
|
|
3573
|
-
const g = e.getBoundingClientRect(),
|
|
3574
|
-
let m = r +
|
|
3583
|
+
const g = e.getBoundingClientRect(), v = u.clientX - l;
|
|
3584
|
+
let m = r + v / g.width * 100;
|
|
3575
3585
|
m = Math.max(0, Math.min(100, m)), this.value.stops[s].position = Math.round(m), n.style.left = `${m}%`, this.updateGradientPreview();
|
|
3576
3586
|
}, d = () => {
|
|
3577
3587
|
o && (o = !1, n.classList.remove("selected"), document.removeEventListener("mousemove", c), document.removeEventListener("mouseup", d), this.value && (this.value.stops.sort((u, g) => u.position - g.position), this.createHandles(t, e), this.updateStopsList()), this.updateUI(), this.triggerChange());
|
|
@@ -3602,17 +3612,17 @@ const P = class P extends x {
|
|
|
3602
3612
|
u.type = "button", u.className = "gstop-del", u.innerHTML = Jt, u.disabled = (((M = (E = this.value) == null ? void 0 : E.stops) == null ? void 0 : M.length) || 0) <= 2, a.appendChild(o), a.appendChild(r), a.appendChild(u), e.appendChild(a);
|
|
3603
3613
|
const g = document.createElement("span");
|
|
3604
3614
|
g.className = "gstop-opacity-label", g.textContent = "Opacity";
|
|
3605
|
-
const
|
|
3606
|
-
|
|
3615
|
+
const v = document.createElement("div");
|
|
3616
|
+
v.className = "gstop-opacity-group";
|
|
3607
3617
|
const m = document.createElement("input");
|
|
3608
3618
|
m.type = "range", m.className = "gstop-opacity-slider", m.min = "0", m.max = "100", m.value = String(s.opacity ?? 100);
|
|
3609
|
-
const
|
|
3619
|
+
const f = S(s.color);
|
|
3610
3620
|
m.style.setProperty(
|
|
3611
3621
|
"--slider-color",
|
|
3612
|
-
`rgb(${
|
|
3622
|
+
`rgb(${f.r}, ${f.g}, ${f.b})`
|
|
3613
3623
|
);
|
|
3614
3624
|
const C = document.createElement("span");
|
|
3615
|
-
C.className = "gstop-opacity-value", C.textContent = `${s.opacity ?? 100}%`,
|
|
3625
|
+
C.className = "gstop-opacity-value", C.textContent = `${s.opacity ?? 100}%`, v.appendChild(m), v.appendChild(C);
|
|
3616
3626
|
const w = new Yt((y, b) => {
|
|
3617
3627
|
c.value = y.replace("#", "").toUpperCase(), p.style.backgroundColor = y, this.value.stops[n].color = y, b !== void 0 && (this.value.stops[n].opacity = b, m.value = String(b), C.textContent = `${b}%`);
|
|
3618
3628
|
const k = S(y);
|
|
@@ -4094,14 +4104,14 @@ export {
|
|
|
4094
4104
|
Ee as MultiLanguageSetting,
|
|
4095
4105
|
V as NumberSetting,
|
|
4096
4106
|
Nt as OpacitySetting,
|
|
4097
|
-
|
|
4107
|
+
ve as SelectApiSettings,
|
|
4098
4108
|
tt as SelectSetting,
|
|
4099
4109
|
x as Setting,
|
|
4100
4110
|
H as SettingGroup,
|
|
4101
4111
|
Lt as StringSetting,
|
|
4102
4112
|
wt as TabSettingGroup,
|
|
4103
4113
|
wt as TabsSettingGroup,
|
|
4104
|
-
|
|
4114
|
+
fe as Toggle,
|
|
4105
4115
|
ct as UploadSetting,
|
|
4106
4116
|
me as WidthSetting,
|
|
4107
4117
|
he as asSettingGroupWithSettings,
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Setting, SettingProps } from '../base/settings';
|
|
2
|
-
import { SettingGroup } from '../base/settings-group/settingsGroup';
|
|
2
|
+
import { SettingGroup, TabSettingGroup } from '../base/settings-group/settingsGroup';
|
|
3
3
|
import { HeaderTypographySettingSet } from '../groups/headerTypographySettingsSet';
|
|
4
4
|
import { AlignValue } from '../settings/align-settings/alignSettings';
|
|
5
5
|
import { GradientSetting } from '../settings/gradient-settings';
|
|
@@ -55,7 +55,15 @@ export declare type ExtractSettingGroupValues<T> = T extends SettingGroup<infer
|
|
|
55
55
|
[K in keyof S]: S[K] extends Setting<infer V, infer P> ? ExtractSettingValue<S[K]> : S[K] extends SettingGroup<infer U> ? ExtractSettingGroupValues<S[K]> : unknown;
|
|
56
56
|
} : never;
|
|
57
57
|
type GradientSettingValue<T> = T extends GradientSetting ? ReturnType<T["getValue"]> : never;
|
|
58
|
-
export type SettingsToProps<T> = T extends
|
|
58
|
+
export type SettingsToProps<T> = T extends TabSettingGroup<infer S> ? {
|
|
59
|
+
[K in keyof S]: S[K] extends GradientSetting ? GradientSettingValue<S[K]> : S[K] extends Setting<infer V, infer P> ? V : S[K] extends HeaderTypographySettingSet ? HeaderTypographyValue<S[K]> : S[K] extends SettingGroup<infer U> ? SettingsToProps<S[K]> : S[K] extends {
|
|
60
|
+
setValue(value: infer V | undefined): void;
|
|
61
|
+
} ? V : S[K] extends {
|
|
62
|
+
value: infer V;
|
|
63
|
+
} ? V : unknown;
|
|
64
|
+
} & {
|
|
65
|
+
activeTabId: string;
|
|
66
|
+
} : T extends SettingGroup<infer S> ? {
|
|
59
67
|
[K in keyof S]: S[K] extends GradientSetting ? GradientSettingValue<S[K]> : S[K] extends Setting<infer V, infer P> ? V : S[K] extends HeaderTypographySettingSet ? HeaderTypographyValue<S[K]> : S[K] extends SettingGroup<infer U> ? SettingsToProps<S[K]> : S[K] extends {
|
|
60
68
|
setValue(value: infer V | undefined): void;
|
|
61
69
|
} ? V : S[K] extends {
|
package/package.json
CHANGED