builder-settings-types 0.0.155 → 0.0.156
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let B=(c=21)=>{let t="",e=crypto.getRandomValues(new Uint8Array(c|=0));for(;c--;)t+=_[e[c]&63];return t};function T(c){if(c===null||typeof c!="object")return c;if(c instanceof Date)return new Date(c.getTime());if(Array.isArray(c)){const i=[];for(let s=0;s<c.length;s++)i[s]=T(c[s]);return i}const t={};for(const i in c)Object.prototype.hasOwnProperty.call(c,i)&&(t[i]=T(c[i]));const e=Object.getPrototypeOf(c);return e!==Object.prototype&&Object.setPrototypeOf(t,e),t}function $(c){switch(c){case"number":return 0;case"text":return"";case"select":return null;case"color":return"#000000";case"date":return new Date().toISOString().split("T")[0];case"button":return"";default:return""}}class g{constructor(t={}){this.props=t,this.id=t.id||B(),this.value=this.props.default,this.desktop=this.props.default,this.title=t.title||""}destroy(){throw new Error("Method not implemented.")}setOnChange(t){return this.onChange=t,this}setOnBlur(t){return this.onBlur=t,this}setValue(t){this.value=t,this.inputEl&&(this.inputEl.value=String(t)),this.onChange&&this.onChange(t),this.props.detectChange&&this.props.detectChange(t)}clone(){const t=this.constructor,e=T(this.props),i=new t(e);return i.value=T(this.value),i}createInput(t){t={...this.props.inputProps,...t};const e=document.createElement("div");if(e.className=t.wrapperClassName||"",t.title||t.icon){const o=document.createElement("div");if(o.className="icon-container",t.icon){const l=this.createIcon(t.icon,t.iconClassName);o.appendChild(l)}if(t.title){const l=this.createLabel(t.title,t.labelClassName);o.appendChild(l)}e.appendChild(o)}const i=document.createElement("div");i.className=t.wrapperClassName||"";const s=document.createElement("input");this.inputEl=s,s.value=String(t.value||$(t.inputType)),s.type=t.inputType,s.placeholder=t.placeholder||"",s.className=t.inputClassName||"";const n=o=>{const l=o.target;let r=l.value;switch(t.inputType){case"number":r=Number(l.value);break;case"color":r=l.value;break;case"date":r=l.value;break;case"select":r=l.value;break;case"text":r=l.value;break;case"button":r=l.value;break;default:r=l.value}this.value=r,this.onChange&&this.onChange(this.value),this.props.detectChange&&this.props.detectChange(this.value)},a=o=>{o.target,this.onBlur&&this.onBlur(this.value)};return s.addEventListener("input",n),s.addEventListener("change",n),s.addEventListener("blur",a),t.inputCustomizer&&t.inputCustomizer(s),i.appendChild(s),e.appendChild(i),e}createLabel(t,e){const i=document.createElement("span");return i.textContent=t,i.className="input-label "+(e||""),i}createIcon(t,e){const i=document.createElement("span");return i.className="input-icon "+(e||""),i.innerHTML=t,i}}function V(c,t){for(const e in c)if(c.hasOwnProperty(e)){const i=c[e];t(e,i)}}const w=class w{constructor(t){this.elementRef=null,this.isHidden=!1,this.custom=!1,this.initialValues={},this.changeTimeout=null,this.isHandlingChange=!1,this.changeHandlers=new Set,this.blurTimeout=null,this.lastValues={},this.lastChangeTime=0,this.CHANGE_DEBOUNCE=100,this.handleBlur=()=>{},this.pendingBlurHandler=null,this.id=t.id||B(),this.title=t.title,this.settings=t.settings,this.description=t.description,this.icon=t.icon,this.isCollapsed=t.collapsed??!1,this.isMain=t.main??!1,this.custom=t.custom??!1,this.hideCondition=t.hideCondition,this.onBlur=t.onBlur,Object.assign(this,t.settings),this.initialValues=this.getValues()}static hide(){this.hiddenElements.forEach(t=>{t&&(t.style.display="none")})}static show(){this.hiddenElements.forEach(t=>{t&&(t.style.display="")})}setOnChange(t){this.onChange=t;const e=()=>{this.isHandlingChange||(this.isHandlingChange=!0,this.changeTimeout&&clearTimeout(this.changeTimeout),this.changeTimeout=setTimeout(()=>{const i=this.getValues(),s=this.calculateChanges(this.initialValues,i);Object.keys(s).length>0&&(this.lastChangeTime=Date.now(),this.initialValues=i,t(i),this.updateVisibility()),this.isHandlingChange=!1},50))};return this.changeHandlers.clear(),V(this.settings,(i,s)=>{var n;if(s instanceof w)s.setOnChange(a=>{const o=this.getValues();this.initialValues=o,t(o)}),this.changeHandlers.add(()=>t(this.getValues()));else if(s instanceof g){const a=()=>{e()};this.changeHandlers.add(a),s.setOnChange(a)}else{const a=()=>{e()};this.changeHandlers.add(a),(n=s.setOnChange)==null||n.call(s,a)}}),this}setOnBlur(t){return this.onBlur=t,this.pendingBlurHandler=t,this.handleBlur=e=>{(e==null?void 0:e.target)instanceof HTMLElement&&e.target.closest(".setting-group")!==this.elementRef||(this.blurTimeout&&clearTimeout(this.blurTimeout),this.blurTimeout=setTimeout(()=>{t()},100))},this.elementRef&&this.setupBlurHandlers(),this}setupBlurHandlers(){this.elementRef&&this.elementRef.removeEventListener("focusout",this.handleBlur),this.elementRef&&this.elementRef.addEventListener("focusout",this.handleBlur,!0),V(this.settings,(t,e)=>{var i;if(e instanceof w)e.setOnBlur(this.handleBlur);else{const s=(i=this.elementRef)==null?void 0:i.querySelector(`[data-setting-id="${e.id}"]`);s&&s.addEventListener("focusout",this.handleBlur,!0)}})}cleanup(){this.changeTimeout&&(clearTimeout(this.changeTimeout),this.changeTimeout=null),this.blurTimeout&&(clearTimeout(this.blurTimeout),this.blurTimeout=null),this.elementRef&&this.elementRef.removeEventListener("focusout",this.handleBlur),this.changeHandlers.clear()}clone(){const t={};V(this.settings,(n,a)=>{typeof a.clone=="function"?t[n]=a.clone():(console.warn(`Setting with key '${n}' does not have a clone method. Copying reference.`),t[n]=a)});const e={title:this.title,settings:t,description:this.description,icon:this.icon,collapsed:this.isCollapsed,main:this.isMain,custom:this.custom,hideCondition:this.hideCondition},i=this.constructor,s=new i(e);return s.initialValues=this.getValues(),s}calculateChanges(t,e){const i={};return new Set([...Object.keys(t),...Object.keys(e)]).forEach(n=>{const a=t[n],o=e[n];JSON.stringify(a)!==JSON.stringify(o)&&(i[n]={from:a,to:o})}),i}hide(){this.elementRef&&(this.elementRef.style.display="none",this.isHidden=!0)}show(){this.elementRef&&(this.elementRef.style.display="",this.isHidden=!1)}getValues(t){if(t===void 0){const e={};for(const i in this.settings)if(this.settings.hasOwnProperty(i)){const s=this.settings[i];s instanceof w?e[i]=s.getValues():e[i]=s.value}return e}else{const e=this.settings[t];return e?e instanceof w?e.getValues():e.value:void 0}}draw(){const t=document.createElement("div");t.className="setting-group",t.id=`setting-group-${this.id}`,w.hiddenElements.add(t),this.hideCondition&&this.hideCondition()&&(t.style.display="none"),this.isMain&&t.classList.add("main-group");const e=document.createElement("div");e.className="setting-group-title",this.isCollapsed&&e.classList.add("collapsed-view"),e.setAttribute("role","button"),e.setAttribute("aria-expanded",(!this.isCollapsed).toString()),e.setAttribute("tabindex","0");const i=document.createElement("div");if(i.className="title-section",this.icon){const h=document.createElement("span");h.className="group-icon",h.innerHTML=this.icon,i.appendChild(h)}this.custom&&t.classList.add("custom_class");const s=document.createElement("h3");s.textContent=this.title,i.appendChild(s);const n=document.createElement("div");if(n.className="actions-section",this.description&&this.isCollapsed){const h=document.createElement("span");h.className="info-marker",h.innerHTML=`
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let B=(c=21)=>{let t="",e=crypto.getRandomValues(new Uint8Array(c|=0));for(;c--;)t+=_[e[c]&63];return t};function T(c){if(c===null||typeof c!="object")return c;if(c instanceof Date)return new Date(c.getTime());if(Array.isArray(c)){const i=[];for(let s=0;s<c.length;s++)i[s]=T(c[s]);return i}const t={};for(const i in c)Object.prototype.hasOwnProperty.call(c,i)&&(t[i]=T(c[i]));const e=Object.getPrototypeOf(c);return e!==Object.prototype&&Object.setPrototypeOf(t,e),t}function $(c){switch(c){case"number":return 0;case"text":return"";case"select":return null;case"color":return"#000000";case"date":return new Date().toISOString().split("T")[0];case"button":return"";default:return""}}class g{constructor(t={}){this.props=t,this.id=t.id||B(),this.value=this.props.default,this.desktop=this.props.default,this.title=t.title||""}destroy(){throw new Error("Method not implemented.")}setOnChange(t){return this.onChange=t,this}setOnBlur(t){return this.onBlur=t,this}setValue(t){this.value=t,this.inputEl&&(this.inputEl.value=String(t)),this.onChange&&this.onChange(t),this.props.detectChange&&this.props.detectChange(t)}clone(){const t=this.constructor,e=T(this.props),i=new t(e);return i.value=T(this.value),i}createInput(t){t={...this.props.inputProps,...t};const e=document.createElement("div");if(e.className=t.wrapperClassName||"",t.title||t.icon){const o=document.createElement("div");if(o.className="icon-container",t.icon){const l=this.createIcon(t.icon,t.iconClassName);o.appendChild(l)}if(t.title){const l=this.createLabel(t.title,t.labelClassName);o.appendChild(l)}e.appendChild(o)}const i=document.createElement("div");i.className=t.wrapperClassName||"";const s=document.createElement("input");this.inputEl=s,s.value=String(t.value||$(t.inputType)),s.type=t.inputType,s.placeholder=t.placeholder||"",s.className=t.inputClassName||"";const n=o=>{const l=o.target;let r=l.value;switch(t.inputType){case"number":r=Number(l.value);break;case"color":r=l.value;break;case"date":r=l.value;break;case"select":r=l.value;break;case"text":r=l.value;break;case"button":r=l.value;break;default:r=l.value}this.value=r,this.onChange&&this.onChange(this.value),this.props.detectChange&&this.props.detectChange(this.value)},a=o=>{o.target,this.onBlur&&this.onBlur(this.value)};return s.addEventListener("input",n),s.addEventListener("change",n),s.addEventListener("blur",a),t.inputCustomizer&&t.inputCustomizer(s),i.appendChild(s),e.appendChild(i),e}createLabel(t,e){const i=document.createElement("span");return i.textContent=t,i.className="input-label "+(e||""),i}createIcon(t,e){const i=document.createElement("span");return i.className="input-icon "+(e||""),i.innerHTML=t,i}}function V(c,t){for(const e in c)if(c.hasOwnProperty(e)){const i=c[e];t(e,i)}}const w=class w{constructor(t){this.elementRef=null,this.isHidden=!1,this.custom=!1,this.initialValues={},this.changeTimeout=null,this.isHandlingChange=!1,this.changeHandlers=new Set,this.blurTimeout=null,this.lastValues={},this.lastChangeTime=0,this.CHANGE_DEBOUNCE=100,this.handleBlur=()=>{},this.pendingBlurHandler=null,this.id=t.id||B(),this.title=t.title,this.settings=t.settings,this.description=t.description,this.icon=t.icon,this.isCollapsed=t.collapsed??!1,this.isMain=t.main??!1,this.custom=t.custom??!1,this.hideCondition=t.hideCondition,this.onBlur=t.onBlur,Object.assign(this,t.settings),this.initialValues=this.getValues()}static hide(){this.hiddenElements.forEach(t=>{t&&(t.style.display="none")})}static show(){this.hiddenElements.forEach(t=>{t&&(t.style.display="")})}setOnChange(t){this.onChange=t;const e=()=>{this.isHandlingChange||(this.isHandlingChange=!0,this.changeTimeout&&clearTimeout(this.changeTimeout),this.changeTimeout=setTimeout(()=>{const i=this.getValues(),s=this.calculateChanges(this.initialValues,i);Object.keys(s).length>0&&(this.lastChangeTime=Date.now(),this.initialValues=i,t(i),this.updateVisibility()),this.isHandlingChange=!1},50))};return this.changeHandlers.clear(),V(this.settings,(i,s)=>{var n;if(s instanceof w)s.setOnChange(a=>{const o=this.getValues();this.initialValues=o,t(o)}),this.changeHandlers.add(()=>t(this.getValues()));else if(s instanceof g){const a=()=>{e()};this.changeHandlers.add(a),s.setOnChange(a)}else{const a=()=>{e()};this.changeHandlers.add(a),(n=s.setOnChange)==null||n.call(s,a)}}),this}setOnBlur(t){return this.onBlur=t,this.pendingBlurHandler=t,this.handleBlur=e=>{(e==null?void 0:e.target)instanceof HTMLElement&&e.target.closest(".setting-group")!==this.elementRef||(this.blurTimeout&&clearTimeout(this.blurTimeout),this.blurTimeout=setTimeout(()=>{t()},100))},this.elementRef&&this.setupBlurHandlers(),this}setupBlurHandlers(){this.elementRef&&this.elementRef.removeEventListener("focusout",this.handleBlur),this.elementRef&&this.elementRef.addEventListener("focusout",this.handleBlur,!0),V(this.settings,(t,e)=>{var i;if(e instanceof w)e.setOnBlur(this.handleBlur);else{const s=(i=this.elementRef)==null?void 0:i.querySelector(`[data-setting-id="${e.id}"]`);s&&s.addEventListener("focusout",this.handleBlur,!0)}})}cleanup(){this.changeTimeout&&(clearTimeout(this.changeTimeout),this.changeTimeout=null),this.blurTimeout&&(clearTimeout(this.blurTimeout),this.blurTimeout=null),this.elementRef&&this.elementRef.removeEventListener("focusout",this.handleBlur),this.changeHandlers.clear()}clone(){const t={};V(this.settings,(n,a)=>{typeof a.clone=="function"?t[n]=a.clone():(console.warn(`Setting with key '${n}' does not have a clone method. Copying reference.`),t[n]=a)});const e={title:this.title,settings:t,description:this.description,icon:this.icon,collapsed:this.isCollapsed,main:this.isMain,custom:this.custom,hideCondition:this.hideCondition},i=this.constructor,s=new i(e);return s.initialValues=this.getValues(),s}setValue(t){if(!t||typeof t!="object")return;Object.entries(t).forEach(([i,s])=>{const n=this.settings[i];n&&(n instanceof w||n instanceof g)&&typeof n.setValue=="function"&&n.setValue(s)});const e=this.getValues();this.initialValues=e,this.onChange&&this.onChange(e)}calculateChanges(t,e){const i={};return new Set([...Object.keys(t),...Object.keys(e)]).forEach(n=>{const a=t[n],o=e[n];JSON.stringify(a)!==JSON.stringify(o)&&(i[n]={from:a,to:o})}),i}hide(){this.elementRef&&(this.elementRef.style.display="none",this.isHidden=!0)}show(){this.elementRef&&(this.elementRef.style.display="",this.isHidden=!1)}getValues(t){if(t===void 0){const e={};for(const i in this.settings)if(this.settings.hasOwnProperty(i)){const s=this.settings[i];s instanceof w?e[i]=s.getValues():e[i]=s.value}return e}else{const e=this.settings[t];return e?e instanceof w?e.getValues():e.value:void 0}}draw(){const t=document.createElement("div");t.className="setting-group",t.id=`setting-group-${this.id}`,w.hiddenElements.add(t),this.hideCondition&&this.hideCondition()&&(t.style.display="none"),this.isMain&&t.classList.add("main-group");const e=document.createElement("div");e.className="setting-group-title",this.isCollapsed&&e.classList.add("collapsed-view"),e.setAttribute("role","button"),e.setAttribute("aria-expanded",(!this.isCollapsed).toString()),e.setAttribute("tabindex","0");const i=document.createElement("div");if(i.className="title-section",this.icon){const h=document.createElement("span");h.className="group-icon",h.innerHTML=this.icon,i.appendChild(h)}this.custom&&t.classList.add("custom_class");const s=document.createElement("h3");s.textContent=this.title,i.appendChild(s);const n=document.createElement("div");if(n.className="actions-section",this.description&&this.isCollapsed){const h=document.createElement("span");h.className="info-marker",h.innerHTML=`
|
|
2
2
|
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
3
3
|
<path d="M8 5.33333V8M8 10.6667H8.00667M14 8C14 11.3137 11.3137 14 8 14C4.68629 14 2 11.3137 2 8C2 4.68629 4.68629 2 8 2C11.3137 2 14 4.68629 14 8Z"
|
|
4
4
|
stroke="currentColor" stroke-width="1.33333" stroke-linecap="round" stroke-linejoin="round"/>
|
|
@@ -127,7 +127,7 @@ function M(c, t) {
|
|
|
127
127
|
t(e, i);
|
|
128
128
|
}
|
|
129
129
|
}
|
|
130
|
-
const
|
|
130
|
+
const b = class b {
|
|
131
131
|
constructor(t) {
|
|
132
132
|
this.elementRef = null, this.isHidden = !1, this.custom = !1, this.initialValues = {}, this.changeTimeout = null, this.isHandlingChange = !1, this.changeHandlers = /* @__PURE__ */ new Set(), this.blurTimeout = null, this.lastValues = {}, this.lastChangeTime = 0, this.CHANGE_DEBOUNCE = 100, this.handleBlur = () => {
|
|
133
133
|
}, this.pendingBlurHandler = null, this.id = t.id || B(), this.title = t.title, this.settings = t.settings, this.description = t.description, this.icon = t.icon, this.isCollapsed = t.collapsed ?? !1, this.isMain = t.main ?? !1, this.custom = t.custom ?? !1, this.hideCondition = t.hideCondition, this.onBlur = t.onBlur, Object.assign(this, t.settings), this.initialValues = this.getValues();
|
|
@@ -155,7 +155,7 @@ const w = class w {
|
|
|
155
155
|
};
|
|
156
156
|
return this.changeHandlers.clear(), M(this.settings, (i, s) => {
|
|
157
157
|
var n;
|
|
158
|
-
if (s instanceof
|
|
158
|
+
if (s instanceof b)
|
|
159
159
|
s.setOnChange((a) => {
|
|
160
160
|
const o = this.getValues();
|
|
161
161
|
this.initialValues = o, t(o);
|
|
@@ -181,25 +181,43 @@ const w = class w {
|
|
|
181
181
|
}, this.elementRef && this.setupBlurHandlers(), this;
|
|
182
182
|
}
|
|
183
183
|
setupBlurHandlers() {
|
|
184
|
-
this.elementRef && this.elementRef.removeEventListener(
|
|
184
|
+
this.elementRef && this.elementRef.removeEventListener(
|
|
185
|
+
"focusout",
|
|
186
|
+
this.handleBlur
|
|
187
|
+
), this.elementRef && this.elementRef.addEventListener(
|
|
188
|
+
"focusout",
|
|
189
|
+
this.handleBlur,
|
|
190
|
+
!0
|
|
191
|
+
), M(this.settings, (t, e) => {
|
|
185
192
|
var i;
|
|
186
|
-
if (e instanceof
|
|
193
|
+
if (e instanceof b)
|
|
187
194
|
e.setOnBlur(this.handleBlur);
|
|
188
195
|
else {
|
|
189
|
-
const s = (i = this.elementRef) == null ? void 0 : i.querySelector(
|
|
190
|
-
|
|
196
|
+
const s = (i = this.elementRef) == null ? void 0 : i.querySelector(
|
|
197
|
+
`[data-setting-id="${e.id}"]`
|
|
198
|
+
);
|
|
199
|
+
s && s.addEventListener(
|
|
200
|
+
"focusout",
|
|
201
|
+
this.handleBlur,
|
|
202
|
+
!0
|
|
203
|
+
);
|
|
191
204
|
}
|
|
192
205
|
});
|
|
193
206
|
}
|
|
194
207
|
// Clean up method to be called when the group is destroyed
|
|
195
208
|
cleanup() {
|
|
196
|
-
this.changeTimeout && (clearTimeout(this.changeTimeout), this.changeTimeout = null), this.blurTimeout && (clearTimeout(this.blurTimeout), this.blurTimeout = null), this.elementRef && this.elementRef.removeEventListener(
|
|
209
|
+
this.changeTimeout && (clearTimeout(this.changeTimeout), this.changeTimeout = null), this.blurTimeout && (clearTimeout(this.blurTimeout), this.blurTimeout = null), this.elementRef && this.elementRef.removeEventListener(
|
|
210
|
+
"focusout",
|
|
211
|
+
this.handleBlur
|
|
212
|
+
), this.changeHandlers.clear();
|
|
197
213
|
}
|
|
198
214
|
// Add the clone method here
|
|
199
215
|
clone() {
|
|
200
216
|
const t = {};
|
|
201
217
|
M(this.settings, (n, a) => {
|
|
202
|
-
typeof a.clone == "function" ? t[n] = a.clone() : (console.warn(
|
|
218
|
+
typeof a.clone == "function" ? t[n] = a.clone() : (console.warn(
|
|
219
|
+
`Setting with key '${n}' does not have a clone method. Copying reference.`
|
|
220
|
+
), t[n] = a);
|
|
203
221
|
});
|
|
204
222
|
const e = {
|
|
205
223
|
title: this.title,
|
|
@@ -218,9 +236,21 @@ const w = class w {
|
|
|
218
236
|
}, i = this.constructor, s = new i(e);
|
|
219
237
|
return s.initialValues = this.getValues(), s;
|
|
220
238
|
}
|
|
239
|
+
setValue(t) {
|
|
240
|
+
if (!t || typeof t != "object") return;
|
|
241
|
+
Object.entries(t).forEach(([i, s]) => {
|
|
242
|
+
const n = this.settings[i];
|
|
243
|
+
n && (n instanceof b || n instanceof g) && typeof n.setValue == "function" && n.setValue(s);
|
|
244
|
+
});
|
|
245
|
+
const e = this.getValues();
|
|
246
|
+
this.initialValues = e, this.onChange && this.onChange(e);
|
|
247
|
+
}
|
|
221
248
|
calculateChanges(t, e) {
|
|
222
249
|
const i = {};
|
|
223
|
-
return (/* @__PURE__ */ new Set([
|
|
250
|
+
return (/* @__PURE__ */ new Set([
|
|
251
|
+
...Object.keys(t),
|
|
252
|
+
...Object.keys(e)
|
|
253
|
+
])).forEach((n) => {
|
|
224
254
|
const a = t[n], o = e[n];
|
|
225
255
|
JSON.stringify(a) !== JSON.stringify(o) && (i[n] = {
|
|
226
256
|
from: a,
|
|
@@ -240,17 +270,17 @@ const w = class w {
|
|
|
240
270
|
for (const i in this.settings)
|
|
241
271
|
if (this.settings.hasOwnProperty(i)) {
|
|
242
272
|
const s = this.settings[i];
|
|
243
|
-
s instanceof
|
|
273
|
+
s instanceof b ? e[i] = s.getValues() : e[i] = s.value;
|
|
244
274
|
}
|
|
245
275
|
return e;
|
|
246
276
|
} else {
|
|
247
277
|
const e = this.settings[t];
|
|
248
|
-
return e ? e instanceof
|
|
278
|
+
return e ? e instanceof b ? e.getValues() : e.value : void 0;
|
|
249
279
|
}
|
|
250
280
|
}
|
|
251
281
|
draw() {
|
|
252
282
|
const t = document.createElement("div");
|
|
253
|
-
t.className = "setting-group", t.id = `setting-group-${this.id}`,
|
|
283
|
+
t.className = "setting-group", t.id = `setting-group-${this.id}`, b.hiddenElements.add(t), this.hideCondition && this.hideCondition() && (t.style.display = "none"), this.isMain && t.classList.add("main-group");
|
|
254
284
|
const e = document.createElement("div");
|
|
255
285
|
e.className = "setting-group-title", this.isCollapsed && e.classList.add("collapsed-view"), e.setAttribute("role", "button"), e.setAttribute(
|
|
256
286
|
"aria-expanded",
|
|
@@ -354,8 +384,8 @@ const w = class w {
|
|
|
354
384
|
this.isHidden ? this.show() : this.hide();
|
|
355
385
|
}
|
|
356
386
|
};
|
|
357
|
-
|
|
358
|
-
let f =
|
|
387
|
+
b.hiddenElements = /* @__PURE__ */ new Set();
|
|
388
|
+
let f = b;
|
|
359
389
|
class S extends g {
|
|
360
390
|
constructor(t = {}) {
|
|
361
391
|
super(t), this.inputType = "text", t.onChange && this.setOnChange(t.onChange);
|
|
@@ -445,7 +475,7 @@ class O extends S {
|
|
|
445
475
|
return this.element;
|
|
446
476
|
}
|
|
447
477
|
}
|
|
448
|
-
class
|
|
478
|
+
class w extends g {
|
|
449
479
|
constructor(t) {
|
|
450
480
|
super(t), this.inputType = "number", this.inputElement = null, this.mobileValue = t.mobile, this.validateProps(), this.value = this.validateValue(this.value);
|
|
451
481
|
}
|
|
@@ -500,7 +530,7 @@ const _ = `
|
|
|
500
530
|
<path d="M9 17C13.4183 17 17 13.4183 17 9C17 4.58172 13.4183 1 9 1C4.58172 1 1 4.58172 1 9C1 13.4183 4.58172 17 9 17Z" stroke="#667085" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
501
531
|
<path d="M9 1V17C4.58172 17 1 13.4183 1 9C1 4.58172 4.58172 1 9 1Z" fill="#667085" stroke="#667085" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
502
532
|
</svg>`;
|
|
503
|
-
class y extends
|
|
533
|
+
class y extends w {
|
|
504
534
|
constructor(t = {}) {
|
|
505
535
|
const e = {
|
|
506
536
|
title: "Opacity",
|
|
@@ -680,14 +710,14 @@ class lt extends g {
|
|
|
680
710
|
this.value || (this.value = {
|
|
681
711
|
width: e,
|
|
682
712
|
height: i
|
|
683
|
-
}), this.minWidth = t.minWidth ?? 0, this.maxWidth = t.maxWidth, this.minHeight = t.minHeight ?? 0, this.maxHeight = t.maxHeight, this.locked = t.locked ?? !1, this.value.height > 0 && (this.aspectRatio = this.value.width / this.value.height), this.widthSetting = new
|
|
713
|
+
}), this.minWidth = t.minWidth ?? 0, this.maxWidth = t.maxWidth, this.minHeight = t.minHeight ?? 0, this.maxHeight = t.maxHeight, this.locked = t.locked ?? !1, this.value.height > 0 && (this.aspectRatio = this.value.width / this.value.height), this.widthSetting = new w({
|
|
684
714
|
title: "Width",
|
|
685
715
|
default: this.value.width,
|
|
686
716
|
suffix: "px",
|
|
687
717
|
minValue: this.minWidth,
|
|
688
718
|
maxValue: this.maxWidth,
|
|
689
719
|
icon: W
|
|
690
|
-
}), this.heightSetting = new
|
|
720
|
+
}), this.heightSetting = new w({
|
|
691
721
|
title: "Height",
|
|
692
722
|
default: this.value.height,
|
|
693
723
|
suffix: "px",
|
|
@@ -893,7 +923,7 @@ class F extends g {
|
|
|
893
923
|
}, t;
|
|
894
924
|
}
|
|
895
925
|
}
|
|
896
|
-
class rt extends
|
|
926
|
+
class rt extends w {
|
|
897
927
|
// Store mobile value
|
|
898
928
|
constructor(t = {}) {
|
|
899
929
|
const e = {
|
|
@@ -914,7 +944,7 @@ class rt extends b {
|
|
|
914
944
|
const U = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
915
945
|
<path d="M9 14L9 5M9 14L6.75 12.5M9 14L11.25 12.5M9 5L6.75 6.5M9 5L11.25 6.5M15.75 2.75H2.25M15.75 16.25H2.25" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
|
|
916
946
|
</svg>`;
|
|
917
|
-
class ht extends
|
|
947
|
+
class ht extends w {
|
|
918
948
|
// Store mobile value
|
|
919
949
|
constructor(t = {}) {
|
|
920
950
|
const e = {
|
|
@@ -1442,7 +1472,7 @@ class k extends f {
|
|
|
1442
1472
|
const J = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
1443
1473
|
<path d="M2.25 11.75H15.75M5.85 2.75H12.15C13.4101 2.75 14.0402 2.75 14.5215 2.99524C14.9448 3.21095 15.289 3.55516 15.5048 3.97852C15.75 4.45982 15.75 5.08988 15.75 6.35V12.65C15.75 13.9101 15.75 14.5402 15.5048 15.0215C15.289 15.4448 14.9448 15.789 14.5215 16.0048C14.0402 16.25 13.4101 16.25 12.15 16.25H5.85C4.58988 16.25 3.95982 16.25 3.47852 16.0048C3.05516 15.789 2.71095 15.4448 2.49524 15.0215C2.25 14.5402 2.25 13.9101 2.25 12.65V6.35C2.25 5.08988 2.25 4.45982 2.49524 3.97852C2.71095 3.55516 3.05516 3.21095 3.47852 2.99524C3.95982 2.75 4.58988 2.75 5.85 2.75Z" stroke="#667085" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
1444
1474
|
</svg>`;
|
|
1445
|
-
class pt extends
|
|
1475
|
+
class pt extends w {
|
|
1446
1476
|
constructor(t = {}) {
|
|
1447
1477
|
super({
|
|
1448
1478
|
...t,
|
|
@@ -1471,7 +1501,7 @@ class gt extends f {
|
|
|
1471
1501
|
collapsed: t == null ? void 0 : t.collapsed,
|
|
1472
1502
|
hideCondition: t == null ? void 0 : t.hideCondition,
|
|
1473
1503
|
settings: {
|
|
1474
|
-
size: new
|
|
1504
|
+
size: new w({
|
|
1475
1505
|
title: "Size",
|
|
1476
1506
|
icon: Q,
|
|
1477
1507
|
default: (t == null ? void 0 : t.size) ?? 0,
|
|
@@ -1485,7 +1515,7 @@ class gt extends f {
|
|
|
1485
1515
|
minValue: 0,
|
|
1486
1516
|
maxValue: 100
|
|
1487
1517
|
}),
|
|
1488
|
-
radius: new
|
|
1518
|
+
radius: new w({
|
|
1489
1519
|
title: "Radius",
|
|
1490
1520
|
icon: X,
|
|
1491
1521
|
default: (t == null ? void 0 : t.radius) ?? 12,
|
|
@@ -1557,7 +1587,7 @@ class mt extends f {
|
|
|
1557
1587
|
getOptions: t.fontWeightGetOptions,
|
|
1558
1588
|
getOptionsAsync: t.fontWeightGetOptionsAsync
|
|
1559
1589
|
}),
|
|
1560
|
-
fontSize: new
|
|
1590
|
+
fontSize: new w({
|
|
1561
1591
|
title: "Size",
|
|
1562
1592
|
icon: tt,
|
|
1563
1593
|
default: t.fontSizeDefault ?? 12,
|
|
@@ -1881,7 +1911,7 @@ export {
|
|
|
1881
1911
|
rt as HeightSetting,
|
|
1882
1912
|
pt as MarginBottomSetting,
|
|
1883
1913
|
ft as MarginSettingGroup,
|
|
1884
|
-
|
|
1914
|
+
w as NumberSetting,
|
|
1885
1915
|
y as OpacitySetting,
|
|
1886
1916
|
ct as SelectApiSettings,
|
|
1887
1917
|
I as SelectSetting,
|
package/dist/index.d.ts
CHANGED
|
@@ -453,6 +453,7 @@ export declare class SettingGroup<T extends Record<string, Setting<any, any> | S
|
|
|
453
453
|
private setupBlurHandlers;
|
|
454
454
|
cleanup(): void;
|
|
455
455
|
clone(): SettingGroup<T>;
|
|
456
|
+
setValue(values: Record<string, any>): void;
|
|
456
457
|
calculateChanges(oldValues: Record<string, any>, newValues: Record<string, any>): Record<string, any>;
|
|
457
458
|
hide(): void;
|
|
458
459
|
show(): void;
|
package/package.json
CHANGED