@rogieking/figui3 1.0.78 → 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.
Files changed (2) hide show
  1. package/fig.js +19 -13
  2. package/package.json +1 -1
package/fig.js CHANGED
@@ -641,14 +641,17 @@ class FigSlider extends HTMLElement {
641
641
  constructor() {
642
642
  super();
643
643
  }
644
- #syncTypeDefaults() {
644
+ #regenerateInnerHTML() {
645
645
  const defaults = this.#typeDefaults[this.type];
646
646
  this.min = this.getAttribute("min") || defaults.min;
647
647
  this.max = this.getAttribute("max") || defaults.max;
648
648
  this.step = this.getAttribute("step") || defaults.step;
649
649
  this.color = this.getAttribute("color") || defaults?.color;
650
- }
651
- #getInnerHTML() {
650
+
651
+ if (this.color) {
652
+ this.style.setProperty("--color", this.color);
653
+ }
654
+
652
655
  let html = "";
653
656
  let slider = `<div class="fig-slider-input-container">
654
657
  <input
@@ -718,15 +721,9 @@ class FigSlider extends HTMLElement {
718
721
  this.text = this.getAttribute("text") || false;
719
722
  this.units = this.getAttribute("units") || "";
720
723
  this.disabled = this.getAttribute("disabled") ? true : false;
721
-
722
- this.#syncTypeDefaults();
723
-
724
- if (this.color) {
725
- this.style.setProperty("--color", this.color);
726
- }
727
724
  this.initialInnerHTML = this.innerHTML;
728
- this.innerHTML = this.#getInnerHTML();
729
725
 
726
+ this.#regenerateInnerHTML();
730
727
  this.#setupBindings();
731
728
  }
732
729
  static get observedAttributes() {
@@ -762,12 +759,21 @@ class FigSlider extends HTMLElement {
762
759
  this.figInputText.setAttribute("disabled", this.disabled);
763
760
  }
764
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;
765
772
  case "type":
766
773
  case "text":
767
774
  case "units":
768
775
  this[name] = newValue;
769
- this.#syncTypeDefaults();
770
- this.innerHTML = this.#getInnerHTML();
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 "label":
886
+ case "disabled":
881
887
  this.disabled = this.input.disabled = newValue;
882
888
  break;
883
889
  default:
package/package.json CHANGED
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "name": "@rogieking/figui3",
3
- "version": "1.0.78"
3
+ "version": "1.0.79"
4
4
  }