builder-settings-types 0.0.275 → 0.0.277

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.
@@ -11,14 +11,14 @@ function ft(c) {
11
11
  e.classList.contains("setting-group") && e !== c && t++, e = e.parentElement;
12
12
  return t;
13
13
  }
14
- function _(c, t) {
14
+ function J(c, t) {
15
15
  const e = Math.min(Math.max(t, 0), 5);
16
16
  c.setAttribute("data-nesting-level", e.toString()), e > 0 ? c.style.setProperty("--visual-indent", `${e * 2}px`) : (c.style.removeProperty("--visual-indent"), c.style.marginLeft = "");
17
17
  }
18
- function tt(c, t = 0) {
18
+ function et(c, t = 0) {
19
19
  c.querySelectorAll(":scope > .setting-group-content > .setting-group").forEach((i) => {
20
20
  const s = i, n = t + 1;
21
- _(s, n), tt(s, n);
21
+ J(s, n), et(s, n);
22
22
  });
23
23
  }
24
24
  const vt = {
@@ -112,14 +112,14 @@ class Ct {
112
112
  }
113
113
  }
114
114
  const st = new Ct();
115
- function J(c) {
115
+ function Z(c) {
116
116
  if (c === null || typeof c != "object") return c;
117
117
  if (c instanceof Date) return new Date(c.getTime());
118
- if (c instanceof Array) return c.map((t) => J(t));
118
+ if (c instanceof Array) return c.map((t) => Z(t));
119
119
  if (typeof c == "object") {
120
120
  const t = {};
121
121
  for (const e in c)
122
- Object.prototype.hasOwnProperty.call(c, e) && (t[e] = J(c[e]));
122
+ Object.prototype.hasOwnProperty.call(c, e) && (t[e] = Z(c[e]));
123
123
  return t;
124
124
  }
125
125
  return c;
@@ -171,8 +171,8 @@ class b {
171
171
  this.value = t, this.inputEl && (this.inputEl.value = String(t)), this.onChange && this.onChange(t), this.props.detectChange && this.props.detectChange(t);
172
172
  }
173
173
  clone() {
174
- const t = this.constructor, e = J(this.props), i = new t(e);
175
- return i.value = J(this.value), i;
174
+ const t = this.constructor, e = Z(this.props), i = new t(e);
175
+ return i.value = Z(this.value), i;
176
176
  }
177
177
  createInput(t) {
178
178
  t = { ...this.props.inputProps, ...t };
@@ -237,26 +237,26 @@ function D(c) {
237
237
  return c instanceof b;
238
238
  }
239
239
  function L(c) {
240
- return c instanceof O;
240
+ return c instanceof T;
241
241
  }
242
242
  function nt(c) {
243
243
  return D(c) || L(c);
244
244
  }
245
- function q(c, t) {
245
+ function j(c, t) {
246
246
  for (const e in c)
247
247
  if (Object.prototype.hasOwnProperty.call(c, e)) {
248
248
  const i = c[e];
249
249
  t(e, i);
250
250
  }
251
251
  }
252
- const X = class X {
252
+ const Y = class Y {
253
253
  constructor(t) {
254
254
  this.elementRef = null, this.isHidden = !1, this.custom = !1, this.initialValues = {}, this.changeTimeout = null, this.isHandlingChange = !1, this.changeHandlers = /* @__PURE__ */ new Set(), this.blurTimeout = null, this.lastChangeTime = 0, this.handleBlur = () => {
255
255
  }, this.pendingBlurHandler = null, this.originalDefaultValues = {}, this.nestingLevel = 0, this.dataPropsPath = "", this.hide = !1, this.id = t.id || ct(), this.title = t.title, this.settings = t.settings, this.isCollapsed = t.collapsed ?? !1, this.isMain = t.main ?? !1, this.custom = t.custom ?? !1, this.nestingLevel = 0, this.includeGetJson = t.includeGetJson ?? !0, this.addItemCfg = t.addItem, this.deleteItemCfg = t.deleteItem, this.dataProps = t.dataProps, this.dataPropsPath = t.dataProps || "", this.hide = t.hide ?? !1, Object.assign(this, t.settings), this.initialValues = this.getValues(), this.originalDefaultValues = this.getDefaultValues(), this.propagateNestingLevel(), this.propagateDataPropsPath();
256
256
  }
257
257
  propagateNestingLevel() {
258
258
  const t = this.nestingLevel + 1;
259
- q(this.settings, (e, i) => {
259
+ j(this.settings, (e, i) => {
260
260
  L(i) && (i.nestingLevel = t, i.propagateNestingLevel());
261
261
  });
262
262
  }
@@ -273,13 +273,13 @@ const X = class X {
273
273
  this.dataPropsPath = t, this.propagateDataPropsPath();
274
274
  }
275
275
  propagateDataPropsPath() {
276
- q(this.settings, (t, e) => {
276
+ j(this.settings, (t, e) => {
277
277
  const i = String(t), s = this.dataPropsPath ? `${this.dataPropsPath}_${i}` : i;
278
278
  (L(e) || D(e) && typeof e.setDataPropsPath == "function") && e.setDataPropsPath(s);
279
279
  });
280
280
  }
281
281
  updateNestingStyles() {
282
- this.elementRef && (_(this.elementRef, this.nestingLevel), tt(this.elementRef, this.nestingLevel));
282
+ this.elementRef && (J(this.elementRef, this.nestingLevel), et(this.elementRef, this.nestingLevel));
283
283
  }
284
284
  forceChildUIRefresh() {
285
285
  Object.entries(this.settings).forEach(([t, e]) => {
@@ -328,7 +328,7 @@ const X = class X {
328
328
  }
329
329
  clone() {
330
330
  const t = {};
331
- q(this.settings, (s, n) => {
331
+ j(this.settings, (s, n) => {
332
332
  const o = String(s);
333
333
  typeof n.clone == "function" ? t[o] = n.clone() : (console.warn(
334
334
  `Setting with key '${o}' does not have a clone method. Copying reference.`
@@ -391,7 +391,7 @@ const X = class X {
391
391
  Object.keys(s).length > 0 && (this.lastChangeTime = Date.now(), this.initialValues = i, t(i), this.updateVisibility()), this.isHandlingChange = !1;
392
392
  }, 50));
393
393
  };
394
- return this.changeHandlers.clear(), q(this.settings, (i, s) => {
394
+ return this.changeHandlers.clear(), j(this.settings, (i, s) => {
395
395
  var n;
396
396
  if (L(s))
397
397
  s.setOnChange(() => {
@@ -454,7 +454,7 @@ const X = class X {
454
454
  p && t.startsWith(p) && this.addDeleteButtonToElement(a, t);
455
455
  }
456
456
  const r = o.querySelector(".sg-add-button-bottom");
457
- r ? o.insertBefore(a, r) : o.appendChild(a), st.trackElement(a), _(a, this.nestingLevel + 1), tt(a, this.nestingLevel + 1);
457
+ r ? o.insertBefore(a, r) : o.appendChild(a), st.trackElement(a), J(a, this.nestingLevel + 1), et(a, this.nestingLevel + 1);
458
458
  const h = a.style.display;
459
459
  a.style.display = "none", a.offsetHeight, a.style.display = h, this.updateNestingStyles();
460
460
  }
@@ -705,7 +705,7 @@ const X = class X {
705
705
  }
706
706
  draw() {
707
707
  const t = document.createElement("div");
708
- t.className = "setting-group", t.id = `setting-group-${this.id}`, X.hiddenElements.add(t), this.hide && (t.style.display = "none"), this.isMain && t.classList.add("main-group"), this.custom && t.classList.add("custom_class"), _(t, this.nestingLevel);
708
+ t.className = "setting-group", t.id = `setting-group-${this.id}`, Y.hiddenElements.add(t), this.hide && (t.style.display = "none"), this.isMain && t.classList.add("main-group"), this.custom && t.classList.add("custom_class"), J(t, this.nestingLevel);
709
709
  const e = document.createElement("div");
710
710
  e.className = "setting-group-title", this.isCollapsed && e.classList.add("collapsed-view"), e.setAttribute("role", "button"), e.setAttribute(
711
711
  "aria-expanded",
@@ -809,12 +809,12 @@ const X = class X {
809
809
  }
810
810
  }
811
811
  };
812
- X.hiddenElements = /* @__PURE__ */ new Set();
813
- let O = X;
812
+ Y.hiddenElements = /* @__PURE__ */ new Set();
813
+ let T = Y;
814
814
  function ae(c) {
815
815
  return new Et(c);
816
816
  }
817
- class Et extends O {
817
+ class Et extends T {
818
818
  constructor(t) {
819
819
  super(t);
820
820
  const e = Object.keys(this.settings)[0];
@@ -866,7 +866,7 @@ class Et extends O {
866
866
  }
867
867
  }
868
868
  function bt(c) {
869
- return new O(c);
869
+ return new T(c);
870
870
  }
871
871
  function le(c) {
872
872
  return c;
@@ -1245,7 +1245,7 @@ const St = `
1245
1245
  <polyline points="6 9 12 15 18 9"></polyline>
1246
1246
  </svg>
1247
1247
  `;
1248
- class et extends b {
1248
+ class it extends b {
1249
1249
  constructor(t = {}) {
1250
1250
  if (super(t), this.inputType = "select", this._options = [], this.isOpen = !1, this.selectedOptionIndex = null, this.optionsListEl = null, this.svgContainer = null, this.buttonEl = null, this.isLoading = !1, this.container = null, this.clickOutsideListener = null, this.resizeListener = null, t.options && (this._options = [...t.options]), t.getOptions && this._options.push(...t.getOptions()), t.getOptionsAsync && (this.isLoading = !0), this.value !== void 0) {
1251
1251
  const e = this._options.findIndex((i) => i.value === this.value);
@@ -1561,16 +1561,16 @@ const Nt = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewB
1561
1561
  <path d="M4.5 9.5H13.5M4.5 9.5L6 7.25M4.5 9.5L6 11.75M13.5 9.5L12 7.25M13.5 9.5L12 11.75M15.75 16.25V2.75M2.25 16.25V2.75" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"/>
1562
1562
  </svg>`, Vt = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
1563
1563
  <path d="M9 14L9 5M9 14L6.75 12.5M9 14L11.25 12.5M9 5L6.75 6.5M9 5L11.25 6.5M15.75 2.75H2.25M15.75 16.25H2.25" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"/>
1564
- </svg>`, Y = `
1564
+ </svg>`, K = `
1565
1565
  <svg xmlns="http://www.w3.org/2000/svg" width="15" height="16" viewBox="0 0 15 16" fill="none">
1566
1566
  <path d="M5 10.5L7.5 8M7.5 8L10 10.5M7.5 8V13.625M12.5 10.9643C13.2634 10.3338 13.75 9.37996 13.75 8.3125C13.75 6.41402 12.211 4.875 10.3125 4.875C10.1759 4.875 10.0482 4.80375 9.97882 4.68609C9.16379 3.30302 7.65902 2.375 5.9375 2.375C3.34867 2.375 1.25 4.47367 1.25 7.0625C1.25 8.35381 1.77215 9.52317 2.61684 10.371" stroke="#475467" stroke-linecap="round" stroke-linejoin="round"/>
1567
1567
  </svg>
1568
- `, Ot = `
1568
+ `, Tt = `
1569
1569
  <svg width="91" height="71" viewBox="0 0 91 71" fill="none" xmlns="http://www.w3.org/2000/svg">
1570
1570
  <rect width="91" height="71" rx="4" fill="#F2F4F7"/>
1571
1571
  <path d="M37 31.5L39.5 29M39.5 29L42 31.5M39.5 29V34.625M44.5 31.9643C45.2634 31.3338 45.75 30.38 45.75 29.3125C45.75 27.414 44.211 25.875 42.3125 25.875C42.1759 25.875 42.0482 25.8037 41.9788 25.6861C41.1638 24.303 39.659 23.375 37.9375 23.375C35.3487 23.375 33.25 25.4737 33.25 28.0625C33.25 29.3538 33.7721 30.5232 34.6168 31.371" stroke="#475467" stroke-linecap="round" stroke-linejoin="round"/>
1572
1572
  </svg>
1573
- `, Tt = `
1573
+ `, Ot = `
1574
1574
  <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 12 12" fill="none">
1575
1575
  <path d="M8 3V2.6C8 2.03995 8 1.75992 7.89101 1.54601C7.79513 1.35785 7.64215 1.20487 7.45399 1.10899C7.24008 1 6.96005 1 6.4 1H5.6C5.03995 1 4.75992 1 4.54601 1.10899C4.35785 1.20487 4.20487 1.35785 4.10899 1.54601C4 1.75992 4 2.03995 4 2.6V3M5 5.75V8.25M7 5.75V8.25M1.5 3H10.5M9.5 3V8.6C9.5 9.44008 9.5 9.86012 9.33651 10.181C9.1927 10.4632 8.96323 10.6927 8.68099 10.8365C8.36012 11 7.94008 11 7.1 11H4.9C4.05992 11 3.63988 11 3.31901 10.8365C3.03677 10.6927 2.8073 10.4632 2.66349 10.181C2.5 9.86012 2.5 9.44008 2.5 8.6V3" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
1576
1576
  </svg>
@@ -1647,7 +1647,7 @@ class ht extends b {
1647
1647
  );
1648
1648
  if (t && t !== "") {
1649
1649
  this.showLoading(), s && s instanceof HTMLElement && (s.style.display = "none"), e && e.classList.remove("no-image"), i && (i.innerHTML = `
1650
- <span class="upload-icon">${Y}</span>
1650
+ <span class="upload-icon">${K}</span>
1651
1651
  <span class="upload-label">Replace</span>
1652
1652
  `);
1653
1653
  const n = () => {
@@ -1658,7 +1658,7 @@ class ht extends b {
1658
1658
  this.previewEl.addEventListener("load", n), this.previewEl.addEventListener("error", o), this.previewEl.src = t;
1659
1659
  } else
1660
1660
  this.hideLoading(), this.previewWrapper.classList.remove("has-image"), this.previewEl.src = "", this.previewEl.style.display = "none", this.previewWrapper.style.display = "none", s && s instanceof HTMLElement && (s.style.display = "block"), e && e.classList.add("no-image"), i && (i.innerHTML = `
1661
- <span class="upload-icon">${Y}</span>
1661
+ <span class="upload-icon">${K}</span>
1662
1662
  <span class="upload-label">Upload</span>
1663
1663
  `);
1664
1664
  }
@@ -1691,9 +1691,9 @@ class ht extends b {
1691
1691
  const s = this.value && this.value !== "";
1692
1692
  s || i.classList.add("no-image");
1693
1693
  const n = document.createElement("div");
1694
- if (n.className = "preview-placeholder", n.innerHTML = Ot, this.previewWrapper = document.createElement("div"), this.previewWrapper.className = "preview-wrapper", this.loadingSpinner = document.createElement("div"), this.loadingSpinner.className = "loading-spinner", this.loadingSpinner.innerHTML = Pt, this.loadingSpinner.style.display = "none", this.previewWrapper.appendChild(this.loadingSpinner), this.previewEl = document.createElement("img"), this.previewEl.className = "upload-preview", this.props.delete) {
1694
+ if (n.className = "preview-placeholder", n.innerHTML = Tt, this.previewWrapper = document.createElement("div"), this.previewWrapper.className = "preview-wrapper", this.loadingSpinner = document.createElement("div"), this.loadingSpinner.className = "loading-spinner", this.loadingSpinner.innerHTML = Pt, this.loadingSpinner.style.display = "none", this.previewWrapper.appendChild(this.loadingSpinner), this.previewEl = document.createElement("img"), this.previewEl.className = "upload-preview", this.props.delete) {
1695
1695
  const a = document.createElement("button");
1696
- a.className = "delete-button", a.type = "button", a.title = "Delete image", a.innerHTML = Tt, this.previewWrapper.appendChild(a), a.onclick = (l) => {
1696
+ a.className = "delete-button", a.type = "button", a.title = "Delete image", a.innerHTML = Ot, this.previewWrapper.appendChild(a), a.onclick = (l) => {
1697
1697
  var r;
1698
1698
  l.stopPropagation(), this.value = "", this.updatePreviewState(null), (r = this.onChange) == null || r.call(this, ""), this.hideError();
1699
1699
  };
@@ -1701,7 +1701,7 @@ class ht extends b {
1701
1701
  this.previewWrapper.appendChild(this.previewEl);
1702
1702
  const o = document.createElement("button");
1703
1703
  return o.className = "upload-button", this.getDataPropsPath() && o.setAttribute("data-test-id", this.getDataPropsPath()), o.innerHTML = `
1704
- <span class="upload-icon">${Y}</span>
1704
+ <span class="upload-icon">${K}</span>
1705
1705
  <span class="upload-label">Upload</span>
1706
1706
  `, i.appendChild(n), i.appendChild(this.previewWrapper), i.appendChild(o), t.appendChild(i), s ? this.updatePreviewState(this.value) : this.updatePreviewState(null), o.onclick = () => {
1707
1707
  window.postMessage(
@@ -2205,7 +2205,7 @@ class ye extends b {
2205
2205
  { name: "Bounce", value: "bounce 1.5s ease-in-out infinite" },
2206
2206
  { name: "Pulse", value: "pulse 1.5s ease-in-out infinite" }
2207
2207
  ];
2208
- this.selectSetting = new et({
2208
+ this.selectSetting = new it({
2209
2209
  title: this.title || "Animation",
2210
2210
  options: e,
2211
2211
  default: this.props.default || "none"
@@ -2262,10 +2262,10 @@ const Ft = (c, t) => {
2262
2262
  Math.round((l + o) * 255),
2263
2263
  Math.round((r + o) * 255)
2264
2264
  );
2265
- }, Gt = (c, t, e) => {
2265
+ }, Ut = (c, t, e) => {
2266
2266
  const i = e * (1 - t / 2), s = i === 0 || i === 1 ? 0 : (e - i) / Math.min(i, 1 - i);
2267
2267
  return { hue: c, sat: s, lightness: i };
2268
- }, Z = (c, t, e) => {
2268
+ }, X = (c, t, e) => {
2269
2269
  const i = (1 - Math.abs(2 * e - 1)) * t, s = i * (1 - Math.abs(c / 60 % 2 - 1)), n = e - i / 2;
2270
2270
  let o = 0, a = 0, l = 0;
2271
2271
  return c < 60 ? (o = i, a = s, l = 0) : c < 120 ? (o = s, a = i, l = 0) : c < 180 ? (o = 0, a = i, l = s) : c < 240 ? (o = 0, a = s, l = i) : c < 300 ? (o = s, a = 0, l = i) : (o = i, a = 0, l = s), {
@@ -2286,7 +2286,7 @@ const Ft = (c, t) => {
2286
2286
  if (c.startsWith("hsl(")) {
2287
2287
  const s = c.match(/hsl\((\d+),\s*(\d+)%,\s*(\d+)%\)/);
2288
2288
  if (s) {
2289
- const { r: n, g: o, b: a } = Z(
2289
+ const { r: n, g: o, b: a } = X(
2290
2290
  parseInt(s[1]),
2291
2291
  parseInt(s[2]) / 100,
2292
2292
  parseInt(s[3]) / 100
@@ -2297,7 +2297,7 @@ const Ft = (c, t) => {
2297
2297
  if (c.startsWith("hsla(")) {
2298
2298
  const s = c.match(/hsla\((\d+),\s*(\d+)%,\s*(\d+)%,\s*[\d.]+\)/);
2299
2299
  if (s) {
2300
- const { r: n, g: o, b: a } = Z(
2300
+ const { r: n, g: o, b: a } = X(
2301
2301
  parseInt(s[1]),
2302
2302
  parseInt(s[2]) / 100,
2303
2303
  parseInt(s[3]) / 100
@@ -2311,7 +2311,7 @@ const Ft = (c, t) => {
2311
2311
  return `rgba(${s}, ${n}, ${o}, ${e})`;
2312
2312
  }
2313
2313
  return c;
2314
- }, Wt = (c) => [
2314
+ }, Gt = (c) => [
2315
2315
  "red",
2316
2316
  "green",
2317
2317
  "blue",
@@ -2340,7 +2340,7 @@ const Ft = (c, t) => {
2340
2340
  /^rgba?\s*\([^)]+\)$/,
2341
2341
  /^hsla?\s*\([^)]+\)$/,
2342
2342
  /^[a-zA-Z]+$/
2343
- ].some((e) => e.test(c.trim())), zt = (c) => {
2343
+ ].some((e) => e.test(c.trim())), Wt = (c) => {
2344
2344
  if (typeof document > "u")
2345
2345
  return dt(c) || !!F(c);
2346
2346
  const t = document.createElement("div");
@@ -2370,7 +2370,7 @@ const Ft = (c, t) => {
2370
2370
  /hsla?\s*\(\s*([\d.]+)\s*,\s*([\d.]+)%\s*,\s*([\d.]+)%(?:\s*,\s*([\d.]+))?\s*\)/
2371
2371
  );
2372
2372
  if (i) {
2373
- const { r: n, g: o, b: a } = Z(
2373
+ const { r: n, g: o, b: a } = X(
2374
2374
  parseFloat(i[1]),
2375
2375
  parseFloat(i[2]) / 100,
2376
2376
  parseFloat(i[3]) / 100
@@ -2382,7 +2382,7 @@ const Ft = (c, t) => {
2382
2382
  };
2383
2383
  }
2384
2384
  return { color: F(t) || t, position: 0, opacity: 100 };
2385
- }, U = class U {
2385
+ }, q = class q {
2386
2386
  static defaults() {
2387
2387
  return { solid: [], gradient: [] };
2388
2388
  }
@@ -2425,9 +2425,9 @@ const Ft = (c, t) => {
2425
2425
  n !== -1 && s.splice(n, 1), s.unshift(i), s.length > this.MAX_COLORS && (s.length = this.MAX_COLORS), this.persist();
2426
2426
  }
2427
2427
  };
2428
- U.STORAGE_KEY = "settingsLib_recentColors", U.MAX_COLORS = 12, U.colors = null;
2429
- let V = U;
2430
- const Ut = (c, t) => {
2428
+ q.STORAGE_KEY = "settingsLib_recentColors", q.MAX_COLORS = 12, q.colors = null;
2429
+ let V = q;
2430
+ const zt = (c, t) => {
2431
2431
  const e = document.createElement("div");
2432
2432
  e.className = "color-picker-recent-section";
2433
2433
  const i = document.createElement("div");
@@ -2513,9 +2513,9 @@ class Jt {
2513
2513
  p.className = "color-picker-opacity", this.opacitySlider = p;
2514
2514
  const d = document.createElement("div");
2515
2515
  d.className = "color-picker-opacity-marker", this.opacityMarker = d, p.appendChild(d);
2516
- const g = Ut(($) => {
2517
- var G, W;
2518
- this.setColor($), (G = this.onChange) == null || G.call(this, $, this.currentOpacity), V.addColor($, this.recentScope), (W = this.recentSectionRefresh) == null || W.call(this);
2516
+ const g = zt(($) => {
2517
+ var U, G;
2518
+ this.setColor($), (U = this.onChange) == null || U.call(this, $, this.currentOpacity), V.addColor($, this.recentScope), (G = this.recentSectionRefresh) == null || G.call(this);
2519
2519
  }, this.recentScope);
2520
2520
  this.recentSectionRefresh = g.refresh;
2521
2521
  const u = document.createElement("div");
@@ -2530,10 +2530,10 @@ class Jt {
2530
2530
  x.value = "hsl", x.textContent = "HSL", m.appendChild(f), m.appendChild(C), m.appendChild(x);
2531
2531
  const y = document.createElement("input");
2532
2532
  y.type = "text", y.className = "color-picker-color-input", y.value = this.currentColor, this.input = y;
2533
- const T = document.createElement("div");
2534
- T.className = "color-picker-input-container";
2533
+ const O = document.createElement("div");
2534
+ O.className = "color-picker-input-container";
2535
2535
  const k = document.createElement("button");
2536
- return k.className = "color-picker-copy-inside", k.textContent = "Copy", T.appendChild(y), T.appendChild(k), u.appendChild(m), u.appendChild(T), t.appendChild(e), t.appendChild(n), t.appendChild(a), t.appendChild(p), t.appendChild(g.container), t.appendChild(u), t.addEventListener("click", ($) => $.stopPropagation()), this.bind(n, r, p, y, m, k, l), t;
2536
+ return k.className = "color-picker-copy-inside", k.textContent = "Copy", O.appendChild(y), O.appendChild(k), u.appendChild(m), u.appendChild(O), t.appendChild(e), t.appendChild(n), t.appendChild(a), t.appendChild(p), t.appendChild(g.container), t.appendChild(u), t.addEventListener("click", ($) => $.stopPropagation()), this.bind(n, r, p, y, m, k, l), t;
2537
2537
  }
2538
2538
  createBackdrop() {
2539
2539
  const t = document.createElement("div");
@@ -2618,7 +2618,7 @@ class Jt {
2618
2618
  const { r: n, g: o, b: a } = S(this.currentColor);
2619
2619
  this.input.value = `rgb(${n}, ${o}, ${a})`;
2620
2620
  } else {
2621
- const { hue: n, sat: o, lightness: a } = Gt(e, i, s);
2621
+ const { hue: n, sat: o, lightness: a } = Ut(e, i, s);
2622
2622
  this.input.value = `hsl(${Math.round(n)}, ${Math.round(
2623
2623
  o * 100
2624
2624
  )}%, ${Math.round(a * 100)}%)`;
@@ -2865,7 +2865,7 @@ class Zt {
2865
2865
  if (e) {
2866
2866
  const i = parseFloat(e[1]), s = parseFloat(e[2]) / 100, n = parseFloat(e[3]) / 100;
2867
2867
  if (i >= 0 && i <= 360 && s >= 0 && s <= 1 && n >= 0 && n <= 1) {
2868
- const o = Z(i, s, n);
2868
+ const o = X(i, s, n);
2869
2869
  return R(o.r, o.g, o.b);
2870
2870
  }
2871
2871
  }
@@ -2951,7 +2951,7 @@ const ot = (c) => {
2951
2951
  "at",
2952
2952
  "contain",
2953
2953
  "cover"
2954
- ].includes(t) ? !1 : /^#[0-9a-f]{3,8}$/i.test(t) || /^rgb/i.test(c) || /^hsl/i.test(c) || Wt(t);
2954
+ ].includes(t) ? !1 : /^#[0-9a-f]{3,8}$/i.test(t) || /^rgb/i.test(c) || /^hsl/i.test(c) || Gt(t);
2955
2955
  }, lt = (c) => {
2956
2956
  const t = [];
2957
2957
  return c.forEach((e, i) => {
@@ -2974,9 +2974,9 @@ const ot = (c) => {
2974
2974
  opacity: e.opacity === void 0 || Number.isNaN(e.opacity) ? 100 : e.opacity
2975
2975
  }))
2976
2976
  };
2977
- }, K = (c) => {
2977
+ }, Q = (c) => {
2978
2978
  const t = c.replace(/;$/, "").trim();
2979
- if (zt(t)) {
2979
+ if (Wt(t)) {
2980
2980
  const s = ut(t);
2981
2981
  return B({ type: "solid", angle: 0, stops: [s] });
2982
2982
  }
@@ -3016,7 +3016,7 @@ const ot = (c) => {
3016
3016
  (e) => `${pt(e.color, e.opacity ?? 100)} ${e.position}%`
3017
3017
  ).join(", ");
3018
3018
  return c.type === "radial" ? `radial-gradient(circle, ${t})` : `linear-gradient(${c.angle}deg, ${t})`;
3019
- }, Q = (c) => {
3019
+ }, tt = (c) => {
3020
3020
  if (c.type === "solid") {
3021
3021
  const t = c.stops[0];
3022
3022
  return t ? t.color.replace("#", "").toUpperCase() : "Color";
@@ -3045,7 +3045,7 @@ const ot = (c) => {
3045
3045
  defaultValue() {
3046
3046
  const t = this.originalDefault;
3047
3047
  if (typeof t == "string") {
3048
- const i = K(t);
3048
+ const i = Q(t);
3049
3049
  if (i)
3050
3050
  return B(i);
3051
3051
  }
@@ -3061,7 +3061,7 @@ const ot = (c) => {
3061
3061
  setValue(t) {
3062
3062
  var i, s;
3063
3063
  let e = null;
3064
- typeof t == "string" ? e = K(t) : t && typeof t == "object" && (e = B(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);
3064
+ typeof t == "string" ? e = Q(t) : t && typeof t == "object" && (e = B(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);
3065
3065
  }
3066
3066
  updateUI() {
3067
3067
  if (this.previewEl && this.value)
@@ -3070,7 +3070,7 @@ const ot = (c) => {
3070
3070
  this.previewEl.style.background = pt(t.color, e);
3071
3071
  } else
3072
3072
  this.previewEl.style.background = P(this.value);
3073
- this.inputEl && this.value && !this.isEditing && (this.inputEl.value = Q(this.value));
3073
+ this.inputEl && this.value && !this.isEditing && (this.inputEl.value = tt(this.value));
3074
3074
  }
3075
3075
  cssForTextValue() {
3076
3076
  return this.value ? {
@@ -3092,10 +3092,10 @@ const ot = (c) => {
3092
3092
  const e = document.createElement("div");
3093
3093
  return e.className = "gradient-input-wrapper", this.previewEl = document.createElement("div"), this.previewEl.className = "gradient-mini-preview", this.previewEl.style.background = this.value ? P(this.value) : "linear-gradient(90deg, #a84b4b 0%, #786666 100%)", this.previewEl.addEventListener("mousedown", (i) => {
3094
3094
  i.preventDefault(), i.stopPropagation(), this.openPopover();
3095
- }), 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 ? Q(this.value) : "", this.inputEl.readOnly = !1, this.inputEl.addEventListener("focus", () => {
3095
+ }), 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 ? tt(this.value) : "", this.inputEl.readOnly = !1, this.inputEl.addEventListener("focus", () => {
3096
3096
  this.isEditing = !0, this.value && (this.inputEl.value = P(this.value));
3097
3097
  }), this.inputEl.addEventListener("blur", () => {
3098
- this.isEditing = !1, this.value && (this.inputEl.value = Q(this.value));
3098
+ this.isEditing = !1, this.value && (this.inputEl.value = tt(this.value));
3099
3099
  }), this.inputEl.addEventListener(
3100
3100
  "paste",
3101
3101
  (i) => this.handlePaste(i)
@@ -3252,7 +3252,7 @@ const ot = (c) => {
3252
3252
  (n, o) => n.position - o.position
3253
3253
  );
3254
3254
  i.forEach((n, o) => {
3255
- var G, W;
3255
+ var U, G;
3256
3256
  const a = this.value.stops.findIndex(
3257
3257
  (v, E) => v.position === n.position && v.color === n.color && v.opacity === n.opacity && this.value.stops.slice(0, E).filter(
3258
3258
  (w) => w.position === n.position && w.color === n.color && w.opacity === n.opacity
@@ -3274,17 +3274,17 @@ const ot = (c) => {
3274
3274
  const m = document.createElement("button");
3275
3275
  m.type = "button", m.className = "gstop-color-copy", m.textContent = "Copy", d.appendChild(g), d.appendChild(u), d.appendChild(m);
3276
3276
  const f = document.createElement("button");
3277
- f.type = "button", f.className = "gstop-del", f.innerHTML = _t, f.disabled = (((W = (G = this.value) == null ? void 0 : G.stops) == null ? void 0 : W.length) || 0) <= 2, r.appendChild(h), r.appendChild(d), r.appendChild(f), e.appendChild(r);
3277
+ f.type = "button", f.className = "gstop-del", f.innerHTML = _t, f.disabled = (((G = (U = this.value) == null ? void 0 : U.stops) == null ? void 0 : G.length) || 0) <= 2, r.appendChild(h), r.appendChild(d), r.appendChild(f), e.appendChild(r);
3278
3278
  const C = document.createElement("span");
3279
3279
  C.className = "gstop-opacity-label", C.textContent = "Opacity";
3280
3280
  const x = document.createElement("div");
3281
3281
  x.className = "gstop-opacity-group";
3282
3282
  const y = document.createElement("input");
3283
3283
  y.type = "range", y.className = "gstop-opacity-slider", y.min = "0", y.max = "100", y.value = String(n.opacity ?? 100);
3284
- const T = S(n.color);
3284
+ const O = S(n.color);
3285
3285
  y.style.setProperty(
3286
3286
  "--slider-color",
3287
- `rgb(${T.r}, ${T.g}, ${T.b})`
3287
+ `rgb(${O.r}, ${O.g}, ${O.b})`
3288
3288
  );
3289
3289
  const k = document.createElement("span");
3290
3290
  k.className = "gstop-opacity-value", k.textContent = `${n.opacity ?? 100}%`, x.appendChild(y), x.appendChild(k);
@@ -3309,8 +3309,10 @@ const ot = (c) => {
3309
3309
  y.style.setProperty(
3310
3310
  "--slider-color",
3311
3311
  `rgb(${w.r}, ${w.g}, ${w.b})`
3312
- ), this.updateGradientPreview(), this.updateUI(), this.triggerChange();
3312
+ ), this.debouncedPreviewUpdate();
3313
3313
  }
3314
+ }), u.addEventListener("blur", () => {
3315
+ this.previewUpdateTimeout && (clearTimeout(this.previewUpdateTimeout), this.previewUpdateTimeout = null), this.updateGradientPreview(), this.updateUI(), this.triggerChange();
3314
3316
  }), m.addEventListener("click", async (v) => {
3315
3317
  v.stopPropagation();
3316
3318
  try {
@@ -3323,15 +3325,22 @@ const ot = (c) => {
3323
3325
  }), p.addEventListener("input", (v) => {
3324
3326
  const E = v.target, w = parseInt(E.value.replace(/[^\d]/g, ""), 10);
3325
3327
  if (!Number.isNaN(w)) {
3326
- const it = Math.max(0, Math.min(100, w));
3327
- this.value.stops[l].position = it, E.value = `${it}%`, this.updateGradientPreview(), this.createHandles(
3328
- this.popoverEl.querySelector(".gradient-handles"),
3329
- this.popoverEl.querySelector(".gradient-preview")
3330
- ), this.updateUI(), this.triggerChange();
3328
+ const W = Math.max(0, Math.min(100, w));
3329
+ this.value.stops[l].position = W, E.value = `${W}%`, this.debouncedPreviewUpdate();
3331
3330
  }
3332
3331
  }), p.addEventListener("blur", (v) => {
3332
+ this.previewUpdateTimeout && (clearTimeout(this.previewUpdateTimeout), this.previewUpdateTimeout = null);
3333
3333
  const E = v.target, w = parseInt(E.value.replace(/[^\d]/g, ""), 10);
3334
- Number.isNaN(w) ? E.value = `${this.value.stops[l].position}%` : E.value = `${Math.max(0, Math.min(100, w))}%`;
3334
+ if (Number.isNaN(w))
3335
+ E.value = `${this.value.stops[l].position}%`;
3336
+ else {
3337
+ const W = Math.max(0, Math.min(100, w));
3338
+ this.value.stops[l].position = W, E.value = `${W}%`;
3339
+ }
3340
+ this.updateGradientPreview(), this.createHandles(
3341
+ this.popoverEl.querySelector(".gradient-handles"),
3342
+ this.popoverEl.querySelector(".gradient-preview")
3343
+ ), this.updateStopsList(), this.updateUI(), this.triggerChange();
3335
3344
  }), f.addEventListener("click", () => {
3336
3345
  var v;
3337
3346
  (this.value.stops.length || 0) <= 2 || (this.value.stops.splice(l, 1), this.createHandles(
@@ -3340,7 +3349,9 @@ const ot = (c) => {
3340
3349
  ), this.updateStopsList(), this.updateGradientPreview(), this.updateUI(), ((v = document.activeElement) == null ? void 0 : v.tagName) !== "INPUT" && this.repositionPopover(), this.triggerChange());
3341
3350
  }), y.addEventListener("input", () => {
3342
3351
  const v = parseInt(y.value, 10);
3343
- this.value.stops[l].opacity = Math.max(0, Math.min(100, v)), k.textContent = `${this.value.stops[l].opacity}%`, this.updateGradientPreview(), this.updateUI(), this.triggerChange();
3352
+ this.value.stops[l].opacity = Math.max(0, Math.min(100, v)), k.textContent = `${this.value.stops[l].opacity}%`, this.debouncedPreviewUpdate();
3353
+ }), y.addEventListener("change", () => {
3354
+ this.previewUpdateTimeout && (clearTimeout(this.previewUpdateTimeout), this.previewUpdateTimeout = null), this.updateGradientPreview(), this.updateUI(), this.triggerChange();
3344
3355
  });
3345
3356
  });
3346
3357
  }
@@ -3417,7 +3428,7 @@ const ot = (c) => {
3417
3428
  this.parseAndSet(e.value);
3418
3429
  }
3419
3430
  parseAndSet(t) {
3420
- const e = K(t.trim());
3431
+ const e = Q(t.trim());
3421
3432
  e && this.setValue(e);
3422
3433
  }
3423
3434
  triggerChange() {
@@ -3448,7 +3459,7 @@ const Yt = `
3448
3459
  <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"/>
3449
3460
  </svg>
3450
3461
  `;
3451
- class Ee extends O {
3462
+ class Ee extends T {
3452
3463
  constructor(t) {
3453
3464
  super({
3454
3465
  title: "Border",
@@ -3497,7 +3508,7 @@ const Qt = `
3497
3508
  <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"/>
3498
3509
  </svg>
3499
3510
  `;
3500
- class be extends O {
3511
+ class be extends T {
3501
3512
  constructor(t = {}) {
3502
3513
  const { showAlign: e = t.showAlign ?? !0, ...i } = t;
3503
3514
  super({
@@ -3508,7 +3519,7 @@ class be extends O {
3508
3519
  color: new H({
3509
3520
  default: i.colorDefault ?? "0, 0, 30"
3510
3521
  }),
3511
- fontFamily: new et({
3522
+ fontFamily: new it({
3512
3523
  title: "Font",
3513
3524
  icon: Qt,
3514
3525
  default: i.fontFamilyDefault ?? "Satoshi",
@@ -3521,7 +3532,7 @@ class be extends O {
3521
3532
  getOptions: i.fontFamilyGetOptions,
3522
3533
  getOptionsAsync: i.fontFamilyGetOptionsAsync
3523
3534
  }),
3524
- fontWeight: new et({
3535
+ fontWeight: new it({
3525
3536
  title: "Weight",
3526
3537
  icon: te,
3527
3538
  default: i.fontWeightDefault ?? "400",
@@ -3563,7 +3574,7 @@ class be extends O {
3563
3574
  `;
3564
3575
  }
3565
3576
  }
3566
- class j extends b {
3577
+ class _ extends b {
3567
3578
  constructor(t) {
3568
3579
  super({
3569
3580
  ...t,
@@ -3609,31 +3620,31 @@ class j extends b {
3609
3620
  }), i;
3610
3621
  }
3611
3622
  }
3612
- class we extends O {
3623
+ class we extends T {
3613
3624
  constructor(t) {
3614
3625
  super({
3615
3626
  title: "Margins",
3616
3627
  collapsed: t == null ? void 0 : t.collapsed,
3617
3628
  settings: {
3618
- marginTop: new j({
3629
+ marginTop: new _({
3619
3630
  title: "Top",
3620
3631
  icon: ie,
3621
3632
  suffix: "px",
3622
3633
  default: (t == null ? void 0 : t.marginTop) ?? "auto"
3623
3634
  }),
3624
- marginRight: new j({
3635
+ marginRight: new _({
3625
3636
  title: "Right",
3626
3637
  icon: se,
3627
3638
  suffix: "px",
3628
3639
  default: (t == null ? void 0 : t.marginRight) ?? 0
3629
3640
  }),
3630
- marginBottom: new j({
3641
+ marginBottom: new _({
3631
3642
  title: "Bottom",
3632
3643
  icon: ne,
3633
3644
  suffix: "px",
3634
3645
  default: (t == null ? void 0 : t.marginBottom) ?? 0
3635
3646
  }),
3636
- marginLeft: new j({
3647
+ marginLeft: new _({
3637
3648
  title: "Left",
3638
3649
  icon: oe,
3639
3650
  suffix: "px",
@@ -3661,7 +3672,7 @@ const ie = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewB
3661
3672
  </svg>`, oe = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
3662
3673
  <path d="M5.625 2.75H5.6325M5.625 9.5H5.6325M5.625 16.25H5.6325M12.375 2.75H12.3825M12.375 9.5H12.3825M12.375 16.25H12.3825M9 2.75H9.0075M9 9.5H9.0075M9 16.25H9.0075M9 12.875H9.0075M9 6.125H9.0075M15.75 2.75H15.7575M15.75 9.5H15.7575M15.75 16.25H15.7575M15.75 12.875H15.7575M15.75 6.125H15.7575M2.25 16.25V2.75" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
3663
3674
  </svg>`;
3664
- class xe extends O {
3675
+ class xe extends T {
3665
3676
  constructor(t) {
3666
3677
  super({
3667
3678
  title: "Background Image",
@@ -3721,9 +3732,9 @@ export {
3721
3732
  I as NumberSetting,
3722
3733
  Mt as OpacitySetting,
3723
3734
  ue as SelectApiSettings,
3724
- et as SelectSetting,
3735
+ it as SelectSetting,
3725
3736
  b as Setting,
3726
- O as SettingGroup,
3737
+ T as SettingGroup,
3727
3738
  wt as StringSetting,
3728
3739
  Et as TabSettingGroup,
3729
3740
  Et as TabsSettingGroup,
@@ -3736,5 +3747,5 @@ export {
3736
3747
  D as isSetting,
3737
3748
  nt as isSettingChild,
3738
3749
  L as isSettingGroup,
3739
- q as iterateSettings
3750
+ j as iterateSettings
3740
3751
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "builder-settings-types",
3
3
  "description": "builder settings",
4
- "version": "0.0.275",
4
+ "version": "0.0.277",
5
5
  "type": "module",
6
6
  "main": "dist/builder-settings-types.cjs.js",
7
7
  "module": "dist/builder-settings-types.es.js",