@rogieking/figui3 1.0.72 → 1.0.74
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.css +5 -13
- package/fig.js +35 -21
- package/package.json +1 -1
package/fig.css
CHANGED
|
@@ -934,11 +934,13 @@ input[type="color"] {
|
|
|
934
934
|
background: var(--checkerboard);
|
|
935
935
|
overflow: hidden;
|
|
936
936
|
grid-area: 1/1;
|
|
937
|
+
outline: 0;
|
|
937
938
|
}
|
|
938
939
|
|
|
939
940
|
&::-webkit-color-swatch {
|
|
940
941
|
padding: 0;
|
|
941
942
|
border: 0;
|
|
943
|
+
box-shadow: inset 0 0 0 1px var(--figma-color-bordertranslucent);
|
|
942
944
|
border-radius: 0.125rem;
|
|
943
945
|
mask-image: linear-gradient(
|
|
944
946
|
to right,
|
|
@@ -1012,11 +1014,11 @@ fig-chit {
|
|
|
1012
1014
|
border-radius: var(--radius-medium);
|
|
1013
1015
|
}
|
|
1014
1016
|
|
|
1015
|
-
input[type="color"]::-
|
|
1017
|
+
input[type="color"]::-webkit-color-swatch {
|
|
1016
1018
|
border-radius: var(--radius-medium);
|
|
1017
1019
|
}
|
|
1018
1020
|
|
|
1019
|
-
input[type="color"]::-
|
|
1021
|
+
input[type="color"]::-moz-color-swatch {
|
|
1020
1022
|
border-radius: var(--radius-medium);
|
|
1021
1023
|
}
|
|
1022
1024
|
}
|
|
@@ -1050,17 +1052,7 @@ fig-chit {
|
|
|
1050
1052
|
opacity: 0;
|
|
1051
1053
|
}
|
|
1052
1054
|
}
|
|
1053
|
-
|
|
1054
|
-
&::after {
|
|
1055
|
-
content: "";
|
|
1056
|
-
width: 0.875rem;
|
|
1057
|
-
height: 0.875rem;
|
|
1058
|
-
grid-area: 1/1;
|
|
1059
|
-
place-self: center;
|
|
1060
|
-
border-radius: 0.125rem;
|
|
1061
|
-
box-shadow: inset 0 0 0 1px var(--figma-color-bordertranslucent);
|
|
1062
|
-
}
|
|
1063
|
-
}
|
|
1055
|
+
|
|
1064
1056
|
&[type="image"] {
|
|
1065
1057
|
&:not([src])::after {
|
|
1066
1058
|
background: var(--checkerboard);
|
package/fig.js
CHANGED
|
@@ -641,23 +641,7 @@ class FigSlider extends HTMLElement {
|
|
|
641
641
|
constructor() {
|
|
642
642
|
super();
|
|
643
643
|
}
|
|
644
|
-
|
|
645
|
-
this.value = this.getAttribute("value");
|
|
646
|
-
this.default = this.getAttribute("default") || null;
|
|
647
|
-
this.type = this.getAttribute("type") || "range";
|
|
648
|
-
|
|
649
|
-
const defaults = this.#typeDefaults[this.type];
|
|
650
|
-
this.min = this.getAttribute("min") || defaults.min;
|
|
651
|
-
this.max = this.getAttribute("max") || defaults.max;
|
|
652
|
-
this.step = this.getAttribute("step") || defaults.step;
|
|
653
|
-
this.color = this.getAttribute("color") || defaults?.color;
|
|
654
|
-
this.units = this.getAttribute("units") || "";
|
|
655
|
-
this.disabled = this.getAttribute("disabled") ? true : false;
|
|
656
|
-
|
|
657
|
-
if (this.color) {
|
|
658
|
-
this.style.setProperty("--color", this.color);
|
|
659
|
-
}
|
|
660
|
-
|
|
644
|
+
#getInnerHTML() {
|
|
661
645
|
let html = "";
|
|
662
646
|
let slider = `<div class="fig-slider-input-container">
|
|
663
647
|
<input
|
|
@@ -670,7 +654,7 @@ class FigSlider extends HTMLElement {
|
|
|
670
654
|
value="${this.value}">
|
|
671
655
|
${this.innerHTML}
|
|
672
656
|
</div>`;
|
|
673
|
-
if (this.
|
|
657
|
+
if (this.text) {
|
|
674
658
|
html = `${slider}
|
|
675
659
|
<fig-input-text
|
|
676
660
|
placeholder="##"
|
|
@@ -688,12 +672,13 @@ class FigSlider extends HTMLElement {
|
|
|
688
672
|
} else {
|
|
689
673
|
html = slider;
|
|
690
674
|
}
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
675
|
+
return html;
|
|
676
|
+
}
|
|
677
|
+
#setupBindings() {
|
|
694
678
|
//child nodes hack
|
|
695
679
|
requestAnimationFrame(() => {
|
|
696
680
|
this.input = this.querySelector("[type=range]");
|
|
681
|
+
this.input.removeEventListener("input", this.handleInput);
|
|
697
682
|
this.input.addEventListener("input", this.handleInput.bind(this));
|
|
698
683
|
this.handleInput();
|
|
699
684
|
|
|
@@ -711,6 +696,7 @@ class FigSlider extends HTMLElement {
|
|
|
711
696
|
this.input.setAttribute("list", this.datalist.getAttribute("id"));
|
|
712
697
|
}
|
|
713
698
|
if (this.figInputText) {
|
|
699
|
+
this.figInputText.removeEventListener("input", this.handleTextInput);
|
|
714
700
|
this.figInputText.addEventListener(
|
|
715
701
|
"input",
|
|
716
702
|
this.handleTextInput.bind(this)
|
|
@@ -718,6 +704,28 @@ class FigSlider extends HTMLElement {
|
|
|
718
704
|
}
|
|
719
705
|
});
|
|
720
706
|
}
|
|
707
|
+
connectedCallback() {
|
|
708
|
+
this.value = this.getAttribute("value");
|
|
709
|
+
this.default = this.getAttribute("default") || null;
|
|
710
|
+
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
|
+
this.text = this.getAttribute("text") || false;
|
|
718
|
+
this.units = this.getAttribute("units") || "";
|
|
719
|
+
this.disabled = this.getAttribute("disabled") ? true : false;
|
|
720
|
+
|
|
721
|
+
if (this.color) {
|
|
722
|
+
this.style.setProperty("--color", this.color);
|
|
723
|
+
}
|
|
724
|
+
|
|
725
|
+
this.innerHTML = this.#getInnerHTML();
|
|
726
|
+
|
|
727
|
+
this.#setupBindings();
|
|
728
|
+
}
|
|
721
729
|
static get observedAttributes() {
|
|
722
730
|
return [
|
|
723
731
|
"value",
|
|
@@ -754,6 +762,12 @@ class FigSlider extends HTMLElement {
|
|
|
754
762
|
this.figInputText.setAttribute("disabled", this.disabled);
|
|
755
763
|
}
|
|
756
764
|
break;
|
|
765
|
+
case "text":
|
|
766
|
+
case "units":
|
|
767
|
+
this[name] = newValue;
|
|
768
|
+
this.innerHTML = this.#getInnerHTML();
|
|
769
|
+
this.#setupBindings();
|
|
770
|
+
break;
|
|
757
771
|
default:
|
|
758
772
|
this[name] = this.input[name] = newValue;
|
|
759
773
|
this.handleInput();
|
package/package.json
CHANGED