@rogieking/figui3 1.0.77 → 1.0.79
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 +25 -19
- package/package.json +1 -1
package/fig.js
CHANGED
|
@@ -641,7 +641,17 @@ class FigSlider extends HTMLElement {
|
|
|
641
641
|
constructor() {
|
|
642
642
|
super();
|
|
643
643
|
}
|
|
644
|
-
#
|
|
644
|
+
#regenerateInnerHTML() {
|
|
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
|
+
|
|
651
|
+
if (this.color) {
|
|
652
|
+
this.style.setProperty("--color", this.color);
|
|
653
|
+
}
|
|
654
|
+
|
|
645
655
|
let html = "";
|
|
646
656
|
let slider = `<div class="fig-slider-input-container">
|
|
647
657
|
<input
|
|
@@ -708,22 +718,12 @@ class FigSlider extends HTMLElement {
|
|
|
708
718
|
this.value = this.getAttribute("value");
|
|
709
719
|
this.default = this.getAttribute("default") || null;
|
|
710
720
|
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
721
|
this.text = this.getAttribute("text") || false;
|
|
718
722
|
this.units = this.getAttribute("units") || "";
|
|
719
723
|
this.disabled = this.getAttribute("disabled") ? true : false;
|
|
720
|
-
|
|
721
|
-
if (this.color) {
|
|
722
|
-
this.style.setProperty("--color", this.color);
|
|
723
|
-
}
|
|
724
724
|
this.initialInnerHTML = this.innerHTML;
|
|
725
|
-
this.innerHTML = this.#getInnerHTML();
|
|
726
725
|
|
|
726
|
+
this.#regenerateInnerHTML();
|
|
727
727
|
this.#setupBindings();
|
|
728
728
|
}
|
|
729
729
|
static get observedAttributes() {
|
|
@@ -750,11 +750,6 @@ class FigSlider extends HTMLElement {
|
|
|
750
750
|
this.color = newValue;
|
|
751
751
|
this.style.setProperty("--color", this.color);
|
|
752
752
|
break;
|
|
753
|
-
case "type":
|
|
754
|
-
this.type = newValue;
|
|
755
|
-
this.innerHTML = this.#getInnerHTML();
|
|
756
|
-
this.#setupBindings();
|
|
757
|
-
break;
|
|
758
753
|
case "disabled":
|
|
759
754
|
this.disabled = this.input.disabled =
|
|
760
755
|
newValue === "true" ||
|
|
@@ -764,10 +759,21 @@ class FigSlider extends HTMLElement {
|
|
|
764
759
|
this.figInputText.setAttribute("disabled", this.disabled);
|
|
765
760
|
}
|
|
766
761
|
break;
|
|
762
|
+
case "min":
|
|
763
|
+
case "max":
|
|
764
|
+
case "step":
|
|
765
|
+
this[name] = this.input[name] = newValue;
|
|
766
|
+
this.input.setAttribute(name, newValue);
|
|
767
|
+
if (this.figInputText) {
|
|
768
|
+
this.figInputText[name] = newValue;
|
|
769
|
+
this.figInputText.setAttribute(name, newValue);
|
|
770
|
+
}
|
|
771
|
+
break;
|
|
772
|
+
case "type":
|
|
767
773
|
case "text":
|
|
768
774
|
case "units":
|
|
769
775
|
this[name] = newValue;
|
|
770
|
-
this
|
|
776
|
+
this.#regenerateInnerHTML();
|
|
771
777
|
this.#setupBindings();
|
|
772
778
|
break;
|
|
773
779
|
default:
|
|
@@ -877,7 +883,7 @@ class FigInputText extends HTMLElement {
|
|
|
877
883
|
attributeChangedCallback(name, oldValue, newValue) {
|
|
878
884
|
if (this.input) {
|
|
879
885
|
switch (name) {
|
|
880
|
-
case "
|
|
886
|
+
case "disabled":
|
|
881
887
|
this.disabled = this.input.disabled = newValue;
|
|
882
888
|
break;
|
|
883
889
|
default:
|
package/package.json
CHANGED