@rogieking/figui3 1.9.2 → 1.9.3

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 (3) hide show
  1. package/example.html +17 -0
  2. package/fig.js +27 -5
  3. package/package.json +1 -1
package/example.html CHANGED
@@ -28,6 +28,16 @@
28
28
  </fig-header>
29
29
 
30
30
 
31
+ <fig-field direction="horizontal">
32
+ <label>Position</label>
33
+ <fig-dropdown value="outside">
34
+ <option value="inside">Inside</option>
35
+ <option value="center">Center</option>
36
+ <option value="outside">Outside</option>
37
+ </fig-dropdown>
38
+ </fig-field>
39
+
40
+
31
41
 
32
42
 
33
43
 
@@ -981,6 +991,13 @@
981
991
  </fig-field>
982
992
  </fig-content>
983
993
 
994
+ <script>
995
+ document.addEventListener("input", (e) => {
996
+ console.log("input", e.target, e.target.value);
997
+ });
998
+
999
+ </script>
1000
+
984
1001
  </body>
985
1002
 
986
1003
  </html>
package/fig.js CHANGED
@@ -170,11 +170,25 @@ class FigDropdown extends HTMLElement {
170
170
  #handleSelectInput(e) {
171
171
  this.value = e.target.value;
172
172
  this.setAttribute("value", this.value);
173
+ this.dispatchEvent(
174
+ new CustomEvent("input", {
175
+ detail: this.value,
176
+ bubbles: true,
177
+ composed: true,
178
+ })
179
+ );
173
180
  }
174
- #handleSelectChange() {
181
+ #handleSelectChange(e) {
175
182
  if (this.type === "dropdown") {
176
183
  this.select.selectedIndex = -1;
177
184
  }
185
+ this.dispatchEvent(
186
+ new CustomEvent("change", {
187
+ detail: this.value,
188
+ bubbles: true,
189
+ composed: true,
190
+ })
191
+ );
178
192
  }
179
193
  focus() {
180
194
  this.select.focus();
@@ -965,7 +979,9 @@ class FigSlider extends HTMLElement {
965
979
  if (this.figInputText) {
966
980
  this.value = this.input.value = this.figInputText.value;
967
981
  this.#syncProperties();
968
- this.dispatchEvent(new CustomEvent("input", { bubbles: true }));
982
+ this.dispatchEvent(
983
+ new CustomEvent("input", { detail: this.value, bubbles: true })
984
+ );
969
985
  }
970
986
  }
971
987
  #calculateNormal(value) {
@@ -991,7 +1007,9 @@ class FigSlider extends HTMLElement {
991
1007
 
992
1008
  #handleInput() {
993
1009
  this.#syncValue();
994
- this.dispatchEvent(new CustomEvent("input", { bubbles: true }));
1010
+ this.dispatchEvent(
1011
+ new CustomEvent("input", { detail: this.value, bubbles: true })
1012
+ );
995
1013
  }
996
1014
 
997
1015
  static get observedAttributes() {
@@ -1178,8 +1196,12 @@ class FigInputText extends HTMLElement {
1178
1196
  }
1179
1197
  this.value = value;
1180
1198
  this.input.value = valueTransformed;
1181
- this.dispatchEvent(new CustomEvent("input", { bubbles: true }));
1182
- this.dispatchEvent(new CustomEvent("change", { bubbles: true }));
1199
+ this.dispatchEvent(
1200
+ new CustomEvent("input", { detail: this.value, bubbles: true })
1201
+ );
1202
+ this.dispatchEvent(
1203
+ new CustomEvent("change", { detail: this.value, bubbles: true })
1204
+ );
1183
1205
  }
1184
1206
  #handleMouseMove(e) {
1185
1207
  if (this.type !== "number") return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rogieking/figui3",
3
- "version": "1.9.2",
3
+ "version": "1.9.3",
4
4
  "module": "index.ts",
5
5
  "type": "module",
6
6
  "devDependencies": {