@rogieking/figui3 2.18.1 → 2.18.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.
- package/fig.js +24 -8
- package/index.html +28 -8
- 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
|
|
3685
|
+
value="${this.#gradient.stops[0]?.opacity ?? 100}"
|
|
3686
3686
|
units="%"
|
|
3687
3687
|
${disabled ? "disabled" : ""}>
|
|
3688
3688
|
</fig-input-number>
|
|
@@ -3883,14 +3883,22 @@ class FigInputFill extends HTMLElement {
|
|
|
3883
3883
|
);
|
|
3884
3884
|
}
|
|
3885
3885
|
break;
|
|
3886
|
-
case "gradient":
|
|
3886
|
+
case "gradient": {
|
|
3887
3887
|
if (this.#opacityInput) {
|
|
3888
3888
|
this.#opacityInput.setAttribute(
|
|
3889
3889
|
"value",
|
|
3890
|
-
this.#gradient.stops[0]?.opacity
|
|
3890
|
+
this.#gradient.stops[0]?.opacity ?? 100
|
|
3891
3891
|
);
|
|
3892
3892
|
}
|
|
3893
|
+
const label = this.querySelector(".fig-input-fill-label");
|
|
3894
|
+
if (label) {
|
|
3895
|
+
const newLabel =
|
|
3896
|
+
this.#gradient.type.charAt(0).toUpperCase() +
|
|
3897
|
+
this.#gradient.type.slice(1);
|
|
3898
|
+
label.textContent = newLabel;
|
|
3899
|
+
}
|
|
3893
3900
|
break;
|
|
3901
|
+
}
|
|
3894
3902
|
case "image":
|
|
3895
3903
|
if (this.#opacityInput) {
|
|
3896
3904
|
this.#opacityInput.setAttribute(
|
|
@@ -3970,7 +3978,7 @@ class FigInputFill extends HTMLElement {
|
|
|
3970
3978
|
placeholder="##"
|
|
3971
3979
|
min="0"
|
|
3972
3980
|
max="100"
|
|
3973
|
-
value="${this.#gradient.stops[0]?.opacity
|
|
3981
|
+
value="${this.#gradient.stops[0]?.opacity ?? 100}"
|
|
3974
3982
|
units="%"
|
|
3975
3983
|
${disabled ? "disabled" : ""}>
|
|
3976
3984
|
</fig-input-number>
|
|
@@ -6469,6 +6477,7 @@ class FigFillPicker extends HTMLElement {
|
|
|
6469
6477
|
this.#hueSlider.addEventListener("input", (e) => {
|
|
6470
6478
|
this.#color.h = parseFloat(e.target.value);
|
|
6471
6479
|
this.#drawColorArea();
|
|
6480
|
+
this.#updateHandlePosition();
|
|
6472
6481
|
this.#updateColorInputs();
|
|
6473
6482
|
this.#emitInput();
|
|
6474
6483
|
});
|
|
@@ -6868,8 +6877,9 @@ class FigFillPicker extends HTMLElement {
|
|
|
6868
6877
|
.addEventListener("input", (e) => {
|
|
6869
6878
|
this.#gradient.stops[index].color =
|
|
6870
6879
|
e.target.hexOpaque || e.target.value;
|
|
6880
|
+
const parsedAlpha = parseFloat(e.target.alpha);
|
|
6871
6881
|
this.#gradient.stops[index].opacity =
|
|
6872
|
-
|
|
6882
|
+
isNaN(parsedAlpha) ? 100 : parsedAlpha;
|
|
6873
6883
|
this.#updateGradientPreview();
|
|
6874
6884
|
this.#emitInput();
|
|
6875
6885
|
});
|
|
@@ -6913,10 +6923,12 @@ class FigFillPicker extends HTMLElement {
|
|
|
6913
6923
|
// ============ IMAGE TAB ============
|
|
6914
6924
|
#initImageTab() {
|
|
6915
6925
|
const container = this.#dialog.querySelector('[data-tab="image"]');
|
|
6926
|
+
const experimental = this.getAttribute("experimental");
|
|
6927
|
+
const expAttr = experimental ? `experimental="${experimental}"` : "";
|
|
6916
6928
|
|
|
6917
6929
|
container.innerHTML = `
|
|
6918
6930
|
<div class="fig-fill-picker-media-header">
|
|
6919
|
-
<fig-dropdown class="fig-fill-picker-scale-mode" value="${
|
|
6931
|
+
<fig-dropdown class="fig-fill-picker-scale-mode" ${expAttr} value="${
|
|
6920
6932
|
this.#image.scaleMode
|
|
6921
6933
|
}">
|
|
6922
6934
|
<option value="fill" selected>Fill</option>
|
|
@@ -7065,10 +7077,12 @@ class FigFillPicker extends HTMLElement {
|
|
|
7065
7077
|
// ============ VIDEO TAB ============
|
|
7066
7078
|
#initVideoTab() {
|
|
7067
7079
|
const container = this.#dialog.querySelector('[data-tab="video"]');
|
|
7080
|
+
const experimental = this.getAttribute("experimental");
|
|
7081
|
+
const expAttr = experimental ? `experimental="${experimental}"` : "";
|
|
7068
7082
|
|
|
7069
7083
|
container.innerHTML = `
|
|
7070
7084
|
<div class="fig-fill-picker-media-header">
|
|
7071
|
-
<fig-dropdown class="fig-fill-picker-scale-mode" value="${
|
|
7085
|
+
<fig-dropdown class="fig-fill-picker-scale-mode" ${expAttr} value="${
|
|
7072
7086
|
this.#video.scaleMode
|
|
7073
7087
|
}">
|
|
7074
7088
|
<option value="fill" selected>Fill</option>
|
|
@@ -7154,6 +7168,8 @@ class FigFillPicker extends HTMLElement {
|
|
|
7154
7168
|
// ============ WEBCAM TAB ============
|
|
7155
7169
|
#initWebcamTab() {
|
|
7156
7170
|
const container = this.#dialog.querySelector('[data-tab="webcam"]');
|
|
7171
|
+
const experimental = this.getAttribute("experimental");
|
|
7172
|
+
const expAttr = experimental ? `experimental="${experimental}"` : "";
|
|
7157
7173
|
|
|
7158
7174
|
container.innerHTML = `
|
|
7159
7175
|
<div class="fig-fill-picker-webcam-preview">
|
|
@@ -7164,7 +7180,7 @@ class FigFillPicker extends HTMLElement {
|
|
|
7164
7180
|
</div>
|
|
7165
7181
|
</div>
|
|
7166
7182
|
<div class="fig-fill-picker-webcam-controls">
|
|
7167
|
-
<fig-dropdown class="fig-fill-picker-camera-select" style="display: none;">
|
|
7183
|
+
<fig-dropdown class="fig-fill-picker-camera-select" ${expAttr} style="display: none;">
|
|
7168
7184
|
</fig-dropdown>
|
|
7169
7185
|
<fig-button class="fig-fill-picker-webcam-capture" variant="primary">
|
|
7170
7186
|
Capture
|
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"
|
|
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"
|
|
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"
|
|
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"
|
|
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"
|
|
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"
|
|
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"
|
|
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>)
|
|
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