@rogieking/figui3 3.20.0 → 3.20.2

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 +22 -10
  2. package/package.json +1 -1
package/fig.js CHANGED
@@ -3533,8 +3533,8 @@ class FigInputText extends HTMLElement {
3533
3533
  valueTransformed = this.#formatNumber(valueTransformed);
3534
3534
  this.value = value;
3535
3535
  this.input.value = valueTransformed;
3536
- this.dispatchEvent(new CustomEvent("input", { bubbles: true }));
3537
- this.dispatchEvent(new CustomEvent("change", { bubbles: true }));
3536
+ this.dispatchEvent(new CustomEvent("input", { detail: this.value, bubbles: true }));
3537
+ this.dispatchEvent(new CustomEvent("change", { detail: this.value, bubbles: true }));
3538
3538
  }
3539
3539
  #handleMouseDown(e) {
3540
3540
  if (this.type !== "number") return;
@@ -3656,6 +3656,10 @@ class FigInputText extends HTMLElement {
3656
3656
  this[name] = this.input[name] = newValue;
3657
3657
  this.input.setAttribute("name", newValue);
3658
3658
  break;
3659
+ case "placeholder":
3660
+ this.placeholder = newValue ?? "";
3661
+ this.input.placeholder = this.placeholder;
3662
+ break;
3659
3663
  default:
3660
3664
  this[name] = this.input[name] = newValue;
3661
3665
  break;
@@ -4019,8 +4023,8 @@ class FigInputNumber extends HTMLElement {
4019
4023
  value = this.#sanitizeInput(value, false);
4020
4024
  this.value = value;
4021
4025
  this.input.value = this.#formatWithUnit(this.value);
4022
- this.dispatchEvent(new CustomEvent("input", { bubbles: true }));
4023
- this.dispatchEvent(new CustomEvent("change", { bubbles: true }));
4026
+ this.dispatchEvent(new CustomEvent("input", { detail: this.value, bubbles: true }));
4027
+ this.dispatchEvent(new CustomEvent("change", { detail: this.value, bubbles: true }));
4024
4028
  }
4025
4029
 
4026
4030
  #handleMouseDown(e) {
@@ -4141,6 +4145,10 @@ class FigInputNumber extends HTMLElement {
4141
4145
  this[name] = this.input[name] = newValue;
4142
4146
  this.input.setAttribute("name", newValue);
4143
4147
  break;
4148
+ case "placeholder":
4149
+ this.placeholder = newValue ?? "";
4150
+ this.input.placeholder = this.placeholder;
4151
+ break;
4144
4152
  default:
4145
4153
  this[name] = this.input[name] = newValue;
4146
4154
  break;
@@ -4793,18 +4801,18 @@ class FigInputColor extends HTMLElement {
4793
4801
  }
4794
4802
 
4795
4803
  #emitInputEvent() {
4796
- const e = new CustomEvent("input", {
4804
+ this.dispatchEvent(new CustomEvent("input", {
4797
4805
  bubbles: true,
4798
4806
  cancelable: true,
4799
- });
4800
- this.dispatchEvent(e);
4807
+ detail: { value: this.value, hex: this.hex, rgba: this.rgba },
4808
+ }));
4801
4809
  }
4802
4810
  #emitChangeEvent() {
4803
- const e = new CustomEvent("change", {
4811
+ this.dispatchEvent(new CustomEvent("change", {
4804
4812
  bubbles: true,
4805
4813
  cancelable: true,
4806
- });
4807
- this.dispatchEvent(e);
4814
+ detail: { value: this.value, hex: this.hex, rgba: this.rgba },
4815
+ }));
4808
4816
  }
4809
4817
 
4810
4818
  static get observedAttributes() {
@@ -9607,6 +9615,7 @@ class FigInputJoystick extends HTMLElement {
9607
9615
  new CustomEvent("input", {
9608
9616
  bubbles: true,
9609
9617
  cancelable: true,
9618
+ detail: { value: this.value, x: this.position.x, y: this.position.y },
9610
9619
  }),
9611
9620
  );
9612
9621
  }
@@ -9616,6 +9625,7 @@ class FigInputJoystick extends HTMLElement {
9616
9625
  new CustomEvent("change", {
9617
9626
  bubbles: true,
9618
9627
  cancelable: true,
9628
+ detail: { value: this.value, x: this.position.x, y: this.position.y },
9619
9629
  }),
9620
9630
  );
9621
9631
  }
@@ -10078,6 +10088,7 @@ class FigInputAngle extends HTMLElement {
10078
10088
  new CustomEvent("input", {
10079
10089
  bubbles: true,
10080
10090
  cancelable: true,
10091
+ detail: { value: this.value, angle: this.angle },
10081
10092
  }),
10082
10093
  );
10083
10094
  }
@@ -10087,6 +10098,7 @@ class FigInputAngle extends HTMLElement {
10087
10098
  new CustomEvent("change", {
10088
10099
  bubbles: true,
10089
10100
  cancelable: true,
10101
+ detail: { value: this.value, angle: this.angle },
10090
10102
  }),
10091
10103
  );
10092
10104
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rogieking/figui3",
3
- "version": "3.20.0",
3
+ "version": "3.20.2",
4
4
  "description": "A lightweight web components library for building Figma plugin and widget UIs with native look and feel",
5
5
  "author": "Rogie King",
6
6
  "license": "MIT",