@rogieking/figui3 2.1.8 → 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 (3) hide show
  1. package/components.css +1 -8
  2. package/fig.js +21 -4
  3. package/package.json +1 -1
package/components.css CHANGED
@@ -2308,14 +2308,6 @@ fig-input-number {
2308
2308
  flex: 1;
2309
2309
  color: var(--figma-color-text);
2310
2310
 
2311
- /* When inside a flex container (like fig-field), grow to fill */
2312
- fig-field &,
2313
- [style*="flex"] &,
2314
- [style*="display: flex"] & {
2315
- width: auto;
2316
- flex: 1 1 auto;
2317
- }
2318
-
2319
2311
  &[multiline] {
2320
2312
  display: flex;
2321
2313
  width: 100%; /* Multiline defaults to full width */
@@ -2451,6 +2443,7 @@ fig-field,
2451
2443
 
2452
2444
  & > [full] {
2453
2445
  flex: 1;
2446
+ flex: 1 1 auto;
2454
2447
  }
2455
2448
 
2456
2449
  & > label {
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.8",
3
+ "version": "2.10.0",
4
4
  "module": "index.ts",
5
5
  "type": "module",
6
6
  "devDependencies": {