@rogieking/figui3 1.0.78 → 1.0.80

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 +20 -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
@@ -679,6 +682,7 @@ class FigSlider extends HTMLElement {
679
682
  } else {
680
683
  html = slider;
681
684
  }
685
+ this.innerHTML = html;
682
686
  return html;
683
687
  }
684
688
  #setupBindings() {
@@ -718,15 +722,9 @@ class FigSlider extends HTMLElement {
718
722
  this.text = this.getAttribute("text") || false;
719
723
  this.units = this.getAttribute("units") || "";
720
724
  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
725
  this.initialInnerHTML = this.innerHTML;
728
- this.innerHTML = this.#getInnerHTML();
729
726
 
727
+ this.#regenerateInnerHTML();
730
728
  this.#setupBindings();
731
729
  }
732
730
  static get observedAttributes() {
@@ -762,12 +760,21 @@ class FigSlider extends HTMLElement {
762
760
  this.figInputText.setAttribute("disabled", this.disabled);
763
761
  }
764
762
  break;
763
+ case "min":
764
+ case "max":
765
+ case "step":
766
+ this[name] = this.input[name] = newValue;
767
+ this.input.setAttribute(name, newValue);
768
+ if (this.figInputText) {
769
+ this.figInputText[name] = newValue;
770
+ this.figInputText.setAttribute(name, newValue);
771
+ }
772
+ break;
765
773
  case "type":
766
774
  case "text":
767
775
  case "units":
768
776
  this[name] = newValue;
769
- this.#syncTypeDefaults();
770
- this.innerHTML = this.#getInnerHTML();
777
+ this.#regenerateInnerHTML();
771
778
  this.#setupBindings();
772
779
  break;
773
780
  default:
@@ -877,7 +884,7 @@ class FigInputText extends HTMLElement {
877
884
  attributeChangedCallback(name, oldValue, newValue) {
878
885
  if (this.input) {
879
886
  switch (name) {
880
- case "label":
887
+ case "disabled":
881
888
  this.disabled = this.input.disabled = newValue;
882
889
  break;
883
890
  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.80"
4
4
  }