@rogieking/figui3 2.18.1 → 2.18.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 (3) hide show
  1. package/fig.js +6 -4
  2. package/index.html +28 -8
  3. package/package.json +1 -1
package/fig.js CHANGED
@@ -3682,7 +3682,7 @@ class FigInputFill extends HTMLElement {
3682
3682
  placeholder="##"
3683
3683
  min="0"
3684
3684
  max="100"
3685
- value="${this.#gradient.stops[0]?.opacity || 100}"
3685
+ value="${this.#gradient.stops[0]?.opacity ?? 100}"
3686
3686
  units="%"
3687
3687
  ${disabled ? "disabled" : ""}>
3688
3688
  </fig-input-number>
@@ -3887,7 +3887,7 @@ class FigInputFill extends HTMLElement {
3887
3887
  if (this.#opacityInput) {
3888
3888
  this.#opacityInput.setAttribute(
3889
3889
  "value",
3890
- this.#gradient.stops[0]?.opacity || 100
3890
+ this.#gradient.stops[0]?.opacity ?? 100
3891
3891
  );
3892
3892
  }
3893
3893
  break;
@@ -3970,7 +3970,7 @@ class FigInputFill extends HTMLElement {
3970
3970
  placeholder="##"
3971
3971
  min="0"
3972
3972
  max="100"
3973
- value="${this.#gradient.stops[0]?.opacity || 100}"
3973
+ value="${this.#gradient.stops[0]?.opacity ?? 100}"
3974
3974
  units="%"
3975
3975
  ${disabled ? "disabled" : ""}>
3976
3976
  </fig-input-number>
@@ -6469,6 +6469,7 @@ class FigFillPicker extends HTMLElement {
6469
6469
  this.#hueSlider.addEventListener("input", (e) => {
6470
6470
  this.#color.h = parseFloat(e.target.value);
6471
6471
  this.#drawColorArea();
6472
+ this.#updateHandlePosition();
6472
6473
  this.#updateColorInputs();
6473
6474
  this.#emitInput();
6474
6475
  });
@@ -6868,8 +6869,9 @@ class FigFillPicker extends HTMLElement {
6868
6869
  .addEventListener("input", (e) => {
6869
6870
  this.#gradient.stops[index].color =
6870
6871
  e.target.hexOpaque || e.target.value;
6872
+ const parsedAlpha = parseFloat(e.target.alpha);
6871
6873
  this.#gradient.stops[index].opacity =
6872
- parseFloat(e.target.alpha) || 100;
6874
+ isNaN(parsedAlpha) ? 100 : parsedAlpha;
6873
6875
  this.#updateGradientPreview();
6874
6876
  this.#emitInput();
6875
6877
  });
package/index.html CHANGED
@@ -1268,15 +1268,18 @@
1268
1268
 
1269
1269
  <h3>Horizontal Fields with Different Inputs</h3>
1270
1270
  <p class="description">Drag the right edge to test at different widths.</p>
1271
- <div class="resize-test" style="width: 240px;">
1271
+ <div class="resize-test"
1272
+ style="width: 240px;">
1272
1273
  <fig-field direction="horizontal">
1273
1274
  <label>Text Input</label>
1274
- <fig-input-text placeholder="Enter text" full></fig-input-text>
1275
+ <fig-input-text placeholder="Enter text"
1276
+ full></fig-input-text>
1275
1277
  </fig-field>
1276
1278
  <fig-field direction="horizontal">
1277
1279
  <label>Number Input</label>
1278
1280
  <fig-input-number value="100"
1279
- units="px" full></fig-input-number>
1281
+ units="px"
1282
+ full></fig-input-number>
1280
1283
  </fig-field>
1281
1284
  <fig-field direction="horizontal">
1282
1285
  <label>Dropdown</label>
@@ -1289,22 +1292,26 @@
1289
1292
  <fig-field direction="horizontal">
1290
1293
  <label>Slider</label>
1291
1294
  <fig-slider value="50"
1292
- text="true" full></fig-slider>
1295
+ text="true"
1296
+ full></fig-slider>
1293
1297
  </fig-field>
1294
1298
  <fig-field direction="horizontal">
1295
1299
  <label>Color</label>
1296
1300
  <fig-input-color value="#0D99FF"
1297
- text="true" full></fig-input-color>
1301
+ text="true"
1302
+ full></fig-input-color>
1298
1303
  </fig-field>
1299
1304
  <fig-field direction="horizontal">
1300
1305
  <label>Angle</label>
1301
1306
  <fig-input-angle value="45"
1302
- text="true" full></fig-input-angle>
1307
+ text="true"
1308
+ full></fig-input-angle>
1303
1309
  </fig-field>
1304
1310
  <fig-field direction="horizontal">
1305
1311
  <label>Joystick</label>
1306
1312
  <fig-input-joystick text="true"
1307
- value="50,50" full></fig-input-joystick>
1313
+ value="50,50"
1314
+ full></fig-input-joystick>
1308
1315
  </fig-field>
1309
1316
  <fig-field direction="horizontal">
1310
1317
  <label>Switch</label>
@@ -1401,6 +1408,18 @@
1401
1408
  document.getElementById('fill-picker-output').textContent = 'Change: ' + JSON.stringify(e.detail);
1402
1409
  });
1403
1410
  </script>
1411
+
1412
+ <h3>Experimental</h3>
1413
+ <p class="description">Use the <code>experimental</code> attribute to pass through experimental features to
1414
+ internal <code>fig-dropdown</code> elements.</p>
1415
+
1416
+ <h4>fig-fill-picker</h4>
1417
+ <fig-fill-picker experimental="modern"
1418
+ value='{"type":"gradient","gradient":{"type":"linear","angle":135,"stops":[{"position":0,"color":"#f093fb","opacity":100},{"position":100,"color":"#f5576c","opacity":100}]}}'></fig-fill-picker>
1419
+
1420
+ <h4>fig-input-fill</h4>
1421
+ <fig-input-fill experimental="modern"
1422
+ value='{"type":"gradient","gradient":{"type":"radial","centerX":50,"centerY":50,"stops":[{"position":0,"color":"#4facfe","opacity":100},{"position":100,"color":"#00f2fe","opacity":100}]}}'></fig-input-fill>
1404
1423
  </section>
1405
1424
  <hr>
1406
1425
 
@@ -2882,7 +2901,8 @@
2882
2901
 
2883
2902
  <h3>Single-Value Position Shorthand</h3>
2884
2903
  <p class="description">Single values are supported for directional shorthand (for example:
2885
- <code>top</code>, <code>right</code>).</p>
2904
+ <code>top</code>, <code>right</code>).
2905
+ </p>
2886
2906
 
2887
2907
  <h4>Top (left edges aligned)</h4>
2888
2908
  <hstack>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rogieking/figui3",
3
- "version": "2.18.1",
3
+ "version": "2.18.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",