@rogieking/figui3 1.0.49 → 1.0.51
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 +15 -20
- package/package.json +1 -1
package/fig.js
CHANGED
|
@@ -577,7 +577,7 @@ class FigSlider extends HTMLElement {
|
|
|
577
577
|
hue: { min: 0, max: 255, step: 1 },
|
|
578
578
|
delta: { min: -100, max: 100, step: 1 },
|
|
579
579
|
stepper: { min: 0, max: 100, step: 25 },
|
|
580
|
-
opacity: { min: 0, max:
|
|
580
|
+
opacity: { min: 0, max: 100, step: 0.01, color: "#FF0000" },
|
|
581
581
|
};
|
|
582
582
|
constructor() {
|
|
583
583
|
super();
|
|
@@ -644,7 +644,6 @@ class FigSlider extends HTMLElement {
|
|
|
644
644
|
|
|
645
645
|
this.datalist = this.querySelector("datalist");
|
|
646
646
|
this.figInputText = this.querySelector("fig-input-text");
|
|
647
|
-
this.textInput = this.querySelector("input[type=number]");
|
|
648
647
|
if (this.datalist) {
|
|
649
648
|
this.datalist.setAttribute(
|
|
650
649
|
"id",
|
|
@@ -698,9 +697,6 @@ class FigSlider extends HTMLElement {
|
|
|
698
697
|
break;
|
|
699
698
|
default:
|
|
700
699
|
this[name] = this.input[name] = newValue;
|
|
701
|
-
if (this.figInputText) {
|
|
702
|
-
this.figInputText.setAttribute(name, newValue);
|
|
703
|
-
}
|
|
704
700
|
this.handleInput();
|
|
705
701
|
break;
|
|
706
702
|
}
|
|
@@ -727,8 +723,8 @@ class FigSlider extends HTMLElement {
|
|
|
727
723
|
this.style.setProperty("--slider-complete", complete);
|
|
728
724
|
this.style.setProperty("--default", defaultValue);
|
|
729
725
|
this.style.setProperty("--unchanged", complete === defaultValue ? 1 : 0);
|
|
730
|
-
if (this.
|
|
731
|
-
this.
|
|
726
|
+
if (this.figInputText) {
|
|
727
|
+
this.figInputText.setAttribute("value", val);
|
|
732
728
|
}
|
|
733
729
|
}
|
|
734
730
|
}
|
|
@@ -1133,16 +1129,17 @@ class FigCheckbox extends HTMLElement {
|
|
|
1133
1129
|
constructor() {
|
|
1134
1130
|
super();
|
|
1135
1131
|
this.input = document.createElement("input");
|
|
1132
|
+
this.name = this.getAttribute("name") || "checkbox";
|
|
1133
|
+
this.value = this.getAttribute("value") || "";
|
|
1136
1134
|
this.input.setAttribute("id", uniqueId());
|
|
1137
|
-
this.input.setAttribute("name", this.
|
|
1135
|
+
this.input.setAttribute("name", this.name);
|
|
1138
1136
|
this.input.setAttribute("type", "checkbox");
|
|
1139
1137
|
this.labelElement = document.createElement("label");
|
|
1140
1138
|
this.labelElement.setAttribute("for", this.input.id);
|
|
1141
1139
|
}
|
|
1142
1140
|
connectedCallback() {
|
|
1143
|
-
this.checked = this.input.checked =
|
|
1144
|
-
|
|
1145
|
-
: false;
|
|
1141
|
+
this.checked = this.input.checked =
|
|
1142
|
+
this.hasAttribute("checked") && this.getAttribute("checked") !== "false";
|
|
1146
1143
|
this.input.addEventListener("change", this.handleInput.bind(this));
|
|
1147
1144
|
|
|
1148
1145
|
if (this.hasAttribute("disabled")) {
|
|
@@ -1159,7 +1156,7 @@ class FigCheckbox extends HTMLElement {
|
|
|
1159
1156
|
this.render();
|
|
1160
1157
|
}
|
|
1161
1158
|
static get observedAttributes() {
|
|
1162
|
-
return ["
|
|
1159
|
+
return ["disabled", "label", "checked", "name", "value"];
|
|
1163
1160
|
}
|
|
1164
1161
|
|
|
1165
1162
|
render() {}
|
|
@@ -1178,12 +1175,13 @@ class FigCheckbox extends HTMLElement {
|
|
|
1178
1175
|
this.labelElement.innerText = newValue;
|
|
1179
1176
|
break;
|
|
1180
1177
|
case "checked":
|
|
1181
|
-
this.checked = this.input.checked =
|
|
1182
|
-
|
|
1183
|
-
|
|
1178
|
+
this.checked = this.input.checked =
|
|
1179
|
+
this.hasAttribute("checked") &&
|
|
1180
|
+
this.getAttribute("checked") !== "false";
|
|
1181
|
+
|
|
1184
1182
|
break;
|
|
1185
|
-
|
|
1186
|
-
|
|
1183
|
+
default:
|
|
1184
|
+
this.input[name] = newValue;
|
|
1187
1185
|
this.input.setAttribute(name, newValue);
|
|
1188
1186
|
break;
|
|
1189
1187
|
}
|
|
@@ -1211,9 +1209,6 @@ window.customElements.define("fig-radio", FigRadio);
|
|
|
1211
1209
|
class FigSwitch extends FigCheckbox {
|
|
1212
1210
|
render() {
|
|
1213
1211
|
this.input.setAttribute("class", "switch");
|
|
1214
|
-
this.on = this.input.checked = this.hasAttribute("on")
|
|
1215
|
-
? this.getAttribute("on").toLowerCase() === "true"
|
|
1216
|
-
: false;
|
|
1217
1212
|
}
|
|
1218
1213
|
}
|
|
1219
1214
|
window.customElements.define("fig-switch", FigSwitch);
|
package/package.json
CHANGED