@rogieking/figui3 2.1.9 → 2.10.0

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 +21 -4
  2. package/package.json +1 -1
package/fig.js CHANGED
@@ -2591,6 +2591,9 @@ class FigInputColor extends HTMLElement {
2591
2591
  }
2592
2592
 
2593
2593
  attributeChangedCallback(name, oldValue, newValue) {
2594
+ // Skip if value hasn't actually changed
2595
+ if (oldValue === newValue) return;
2596
+
2594
2597
  switch (name) {
2595
2598
  case "value":
2596
2599
  this.#setValues(newValue);
@@ -2614,7 +2617,9 @@ class FigInputColor extends HTMLElement {
2614
2617
  if (this.#alphaInput) {
2615
2618
  this.#alphaInput.setAttribute("value", this.alpha);
2616
2619
  }
2617
- this.#emitInputEvent();
2620
+ // NOTE: Do NOT emit input events here!
2621
+ // Input events should only fire from user interactions, not programmatic changes.
2622
+ // Emitting here causes infinite loops with React and other frameworks.
2618
2623
  break;
2619
2624
  case "mode":
2620
2625
  // Mode attribute is passed through to fig-fill-picker when used
@@ -6402,9 +6407,21 @@ class FigFillPicker extends HTMLElement {
6402
6407
  this.#parseValue();
6403
6408
  this.#updateChit();
6404
6409
  if (this.#dialog) {
6405
- // Update dialog UI if open
6406
- this.#initSolidTab();
6407
- this.#initGradientTab();
6410
+ // Update dialog UI if open - but don't rebuild if user is dragging
6411
+ if (!this.#isDraggingColor) {
6412
+ // Just update the handle position and color inputs without rebuilding
6413
+ this.#updateHandlePosition();
6414
+ this.#updateColorInputs();
6415
+ // Update hue slider
6416
+ if (this.#hueSlider) {
6417
+ this.#hueSlider.setAttribute("value", this.#color.h);
6418
+ }
6419
+ // Update opacity slider
6420
+ if (this.#opacitySlider) {
6421
+ this.#opacitySlider.setAttribute("value", this.#color.a * 100);
6422
+ this.#opacitySlider.setAttribute("color", this.#hsvToHex(this.#color));
6423
+ }
6424
+ }
6408
6425
  }
6409
6426
  break;
6410
6427
  case "disabled":
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rogieking/figui3",
3
- "version": "2.1.9",
3
+ "version": "2.10.0",
4
4
  "module": "index.ts",
5
5
  "type": "module",
6
6
  "devDependencies": {