@rogieking/figui3 1.0.77 → 1.0.78

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.
Files changed (2) hide show
  1. package/fig.js +11 -11
  2. package/package.json +1 -1
package/fig.js CHANGED
@@ -641,6 +641,13 @@ class FigSlider extends HTMLElement {
641
641
  constructor() {
642
642
  super();
643
643
  }
644
+ #syncTypeDefaults() {
645
+ const defaults = this.#typeDefaults[this.type];
646
+ this.min = this.getAttribute("min") || defaults.min;
647
+ this.max = this.getAttribute("max") || defaults.max;
648
+ this.step = this.getAttribute("step") || defaults.step;
649
+ this.color = this.getAttribute("color") || defaults?.color;
650
+ }
644
651
  #getInnerHTML() {
645
652
  let html = "";
646
653
  let slider = `<div class="fig-slider-input-container">
@@ -708,16 +715,12 @@ class FigSlider extends HTMLElement {
708
715
  this.value = this.getAttribute("value");
709
716
  this.default = this.getAttribute("default") || null;
710
717
  this.type = this.getAttribute("type") || "range";
711
-
712
- const defaults = this.#typeDefaults[this.type];
713
- this.min = this.getAttribute("min") || defaults.min;
714
- this.max = this.getAttribute("max") || defaults.max;
715
- this.step = this.getAttribute("step") || defaults.step;
716
- this.color = this.getAttribute("color") || defaults?.color;
717
718
  this.text = this.getAttribute("text") || false;
718
719
  this.units = this.getAttribute("units") || "";
719
720
  this.disabled = this.getAttribute("disabled") ? true : false;
720
721
 
722
+ this.#syncTypeDefaults();
723
+
721
724
  if (this.color) {
722
725
  this.style.setProperty("--color", this.color);
723
726
  }
@@ -750,11 +753,6 @@ class FigSlider extends HTMLElement {
750
753
  this.color = newValue;
751
754
  this.style.setProperty("--color", this.color);
752
755
  break;
753
- case "type":
754
- this.type = newValue;
755
- this.innerHTML = this.#getInnerHTML();
756
- this.#setupBindings();
757
- break;
758
756
  case "disabled":
759
757
  this.disabled = this.input.disabled =
760
758
  newValue === "true" ||
@@ -764,9 +762,11 @@ class FigSlider extends HTMLElement {
764
762
  this.figInputText.setAttribute("disabled", this.disabled);
765
763
  }
766
764
  break;
765
+ case "type":
767
766
  case "text":
768
767
  case "units":
769
768
  this[name] = newValue;
769
+ this.#syncTypeDefaults();
770
770
  this.innerHTML = this.#getInnerHTML();
771
771
  this.#setupBindings();
772
772
  break;
package/package.json CHANGED
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "name": "@rogieking/figui3",
3
- "version": "1.0.77"
3
+ "version": "1.0.78"
4
4
  }