@rogieking/figui3 1.0.76 → 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.
- package/fig.js +11 -10
- 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,10 +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.input.className = newValue;
|
|
756
|
-
break;
|
|
757
756
|
case "disabled":
|
|
758
757
|
this.disabled = this.input.disabled =
|
|
759
758
|
newValue === "true" ||
|
|
@@ -763,9 +762,11 @@ class FigSlider extends HTMLElement {
|
|
|
763
762
|
this.figInputText.setAttribute("disabled", this.disabled);
|
|
764
763
|
}
|
|
765
764
|
break;
|
|
765
|
+
case "type":
|
|
766
766
|
case "text":
|
|
767
767
|
case "units":
|
|
768
768
|
this[name] = newValue;
|
|
769
|
+
this.#syncTypeDefaults();
|
|
769
770
|
this.innerHTML = this.#getInnerHTML();
|
|
770
771
|
this.#setupBindings();
|
|
771
772
|
break;
|
package/package.json
CHANGED