@rogieking/figui3 2.1.4 → 2.1.7
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/components.css +68 -31
- package/example.html +106 -0
- package/fig.js +1040 -56
- package/package.json +25 -3
- package/test.html +843 -0
package/components.css
CHANGED
|
@@ -228,8 +228,8 @@
|
|
|
228
228
|
|
|
229
229
|
/* Transparent Backgrounds - use light-dark() */
|
|
230
230
|
--figma-color-bordertranslucent: light-dark(
|
|
231
|
-
rgba(0, 0, 0, 0.
|
|
232
|
-
rgba(255, 255, 255, 0.
|
|
231
|
+
rgba(0, 0, 0, 0.1),
|
|
232
|
+
rgba(255, 255, 255, 0.1)
|
|
233
233
|
);
|
|
234
234
|
--figma-color-bg-transparent: light-dark(
|
|
235
235
|
rgba(0, 0, 0, 0.05),
|
|
@@ -399,6 +399,7 @@ input[type="password"],
|
|
|
399
399
|
&::-webkit-outer-spin-button,
|
|
400
400
|
&::-webkit-inner-spin-button {
|
|
401
401
|
display: none;
|
|
402
|
+
color-scheme: inherit;
|
|
402
403
|
-webkit-appearance: none;
|
|
403
404
|
margin: 0;
|
|
404
405
|
}
|
|
@@ -410,6 +411,7 @@ fig-input-number {
|
|
|
410
411
|
&::-webkit-outer-spin-button,
|
|
411
412
|
&::-webkit-inner-spin-button {
|
|
412
413
|
display: none;
|
|
414
|
+
color-scheme: inherit;
|
|
413
415
|
margin: 0;
|
|
414
416
|
opacity: 0;
|
|
415
417
|
}
|
|
@@ -460,6 +462,7 @@ input[type="text"][list] {
|
|
|
460
462
|
}
|
|
461
463
|
|
|
462
464
|
&::-webkit-calendar-picker-indicator {
|
|
465
|
+
color-scheme: inherit;
|
|
463
466
|
opacity: 0;
|
|
464
467
|
}
|
|
465
468
|
}
|
|
@@ -1045,18 +1048,23 @@ input[type="color"] {
|
|
|
1045
1048
|
&::-webkit-color-swatch-wrapper {
|
|
1046
1049
|
padding: 0;
|
|
1047
1050
|
border: 0;
|
|
1051
|
+
color-scheme: inherit;
|
|
1048
1052
|
appearance: none;
|
|
1049
1053
|
border-radius: 0.125rem;
|
|
1050
1054
|
background: var(--checkerboard);
|
|
1051
1055
|
overflow: hidden;
|
|
1052
1056
|
grid-area: 1/1;
|
|
1057
|
+
color-scheme: inherit;
|
|
1053
1058
|
outline: 0;
|
|
1059
|
+
|
|
1054
1060
|
}
|
|
1055
1061
|
|
|
1056
1062
|
&::-webkit-color-swatch {
|
|
1057
1063
|
padding: 0;
|
|
1058
1064
|
border: 0;
|
|
1065
|
+
color-scheme: inherit;
|
|
1059
1066
|
box-shadow: inset 0 0 0 1px var(--figma-color-bordertranslucent);
|
|
1067
|
+
color-scheme: inherit;
|
|
1060
1068
|
border-radius: 0.125rem;
|
|
1061
1069
|
mask-image: linear-gradient(
|
|
1062
1070
|
to right,
|
|
@@ -1069,7 +1077,9 @@ input[type="color"] {
|
|
|
1069
1077
|
|
|
1070
1078
|
input[type="color"] {
|
|
1071
1079
|
&::-moz-color-swatch {
|
|
1080
|
+
color-scheme: inherit;
|
|
1072
1081
|
border-radius: 0.125rem;
|
|
1082
|
+
color-scheme: inherit;
|
|
1073
1083
|
padding: 0;
|
|
1074
1084
|
border: 0;
|
|
1075
1085
|
appearance: none;
|
|
@@ -1089,6 +1099,7 @@ fig-chit {
|
|
|
1089
1099
|
--chit-background: #d9d9d9;
|
|
1090
1100
|
--chit-bg-size: cover;
|
|
1091
1101
|
--chit-bg-position: center;
|
|
1102
|
+
--alpha:1;
|
|
1092
1103
|
|
|
1093
1104
|
display: inline-grid;
|
|
1094
1105
|
width: var(--size);
|
|
@@ -1145,6 +1156,7 @@ fig-chit {
|
|
|
1145
1156
|
width: var(--size);
|
|
1146
1157
|
height: var(--size);
|
|
1147
1158
|
border-radius: var(--radius-medium);
|
|
1159
|
+
|
|
1148
1160
|
}
|
|
1149
1161
|
}
|
|
1150
1162
|
|
|
@@ -1168,6 +1180,15 @@ fig-chit {
|
|
|
1168
1180
|
background-repeat: repeat;
|
|
1169
1181
|
border-radius: 0.125rem;
|
|
1170
1182
|
box-shadow: inset 0 0 0 1px var(--figma-color-bordertranslucent);
|
|
1183
|
+
|
|
1184
|
+
}
|
|
1185
|
+
&[data-type="image"]::after {
|
|
1186
|
+
mask-image: linear-gradient(
|
|
1187
|
+
to right,
|
|
1188
|
+
black 0%,
|
|
1189
|
+
black 50%,
|
|
1190
|
+
rgba(0, 0, 0, var(--alpha)) 50%
|
|
1191
|
+
);
|
|
1171
1192
|
}
|
|
1172
1193
|
|
|
1173
1194
|
&::after,
|
|
@@ -1265,6 +1286,11 @@ fig-image {
|
|
|
1265
1286
|
align-items: center;
|
|
1266
1287
|
gap: 1px;
|
|
1267
1288
|
|
|
1289
|
+
& > label{
|
|
1290
|
+
align-self: stretch;
|
|
1291
|
+
color: inherit;
|
|
1292
|
+
}
|
|
1293
|
+
|
|
1268
1294
|
& > * {
|
|
1269
1295
|
&:first-child:not(:last-child),
|
|
1270
1296
|
&:first-child:not(:last-child) > * {
|
|
@@ -1285,6 +1311,21 @@ fig-image {
|
|
|
1285
1311
|
}
|
|
1286
1312
|
}
|
|
1287
1313
|
|
|
1314
|
+
/* Input Fill label */
|
|
1315
|
+
.fig-input-fill-label {
|
|
1316
|
+
display: inline-flex;
|
|
1317
|
+
align-items: center;
|
|
1318
|
+
padding: 0 var(--spacer-2) 0 var(--spacer-1);
|
|
1319
|
+
height: var(--control-height);
|
|
1320
|
+
font-size: var(--font-size-small);
|
|
1321
|
+
color: var(--figma-color-text-secondary);
|
|
1322
|
+
background: var(--figma-color-bg-secondary);
|
|
1323
|
+
flex: 1;
|
|
1324
|
+
min-width: 0;
|
|
1325
|
+
user-select: none;
|
|
1326
|
+
margin-left: -1px;
|
|
1327
|
+
}
|
|
1328
|
+
|
|
1288
1329
|
/* Switch */
|
|
1289
1330
|
input[type="checkbox"].switch {
|
|
1290
1331
|
display: inline-flex;
|
|
@@ -1678,6 +1719,7 @@ fig-slider {
|
|
|
1678
1719
|
appearance: none;
|
|
1679
1720
|
background: transparent;
|
|
1680
1721
|
-webkit-appearance: none;
|
|
1722
|
+
color-scheme: inherit;
|
|
1681
1723
|
transition: var(--handle-transition);
|
|
1682
1724
|
border-radius: 100%;
|
|
1683
1725
|
height: var(--slider-thumb-size);
|
|
@@ -1696,6 +1738,7 @@ fig-slider {
|
|
|
1696
1738
|
cursor: not-allowed;
|
|
1697
1739
|
|
|
1698
1740
|
&::-webkit-slider-runnable-track {
|
|
1741
|
+
color-scheme: inherit;
|
|
1699
1742
|
background: linear-gradient(
|
|
1700
1743
|
to right,
|
|
1701
1744
|
var(--figma-color-bg-secondary) 0%,
|
|
@@ -1710,6 +1753,7 @@ fig-slider {
|
|
|
1710
1753
|
}
|
|
1711
1754
|
|
|
1712
1755
|
&::-webkit-slider-runnable-track {
|
|
1756
|
+
color-scheme: inherit;
|
|
1713
1757
|
height: var(--slider-height);
|
|
1714
1758
|
background-color: transparent;
|
|
1715
1759
|
transition: var(--slider-transition);
|
|
@@ -1748,6 +1792,7 @@ fig-slider {
|
|
|
1748
1792
|
}
|
|
1749
1793
|
|
|
1750
1794
|
&::-moz-range-thumb {
|
|
1795
|
+
color-scheme: inherit;
|
|
1751
1796
|
appearance: none;
|
|
1752
1797
|
-moz-appearance: none;
|
|
1753
1798
|
background: transparent;
|
|
@@ -1768,6 +1813,7 @@ fig-slider {
|
|
|
1768
1813
|
cursor: not-allowed;
|
|
1769
1814
|
|
|
1770
1815
|
&::-moz-range-track {
|
|
1816
|
+
color-scheme: inherit;
|
|
1771
1817
|
background: linear-gradient(
|
|
1772
1818
|
to right,
|
|
1773
1819
|
var(--figma-color-bg-secondary) 0%,
|
|
@@ -2259,9 +2305,7 @@ fig-input-number {
|
|
|
2259
2305
|
user-select: all;
|
|
2260
2306
|
gap: 0;
|
|
2261
2307
|
min-width: 0;
|
|
2262
|
-
|
|
2263
|
-
flex-shrink: 1;
|
|
2264
|
-
flex-grow: 0;
|
|
2308
|
+
flex: 1;
|
|
2265
2309
|
color: var(--figma-color-text);
|
|
2266
2310
|
|
|
2267
2311
|
/* When inside a flex container (like fig-field), grow to fill */
|
|
@@ -2346,19 +2390,9 @@ fig-input-number {
|
|
|
2346
2390
|
}
|
|
2347
2391
|
}
|
|
2348
2392
|
|
|
2349
|
-
fig-input-color
|
|
2350
|
-
|
|
2351
|
-
& fig-input-text[type="text"],
|
|
2352
|
-
& fig-input-number {
|
|
2353
|
-
display: inline-flex;
|
|
2354
|
-
flex-direction: column;
|
|
2355
|
-
align-items: stretch;
|
|
2393
|
+
fig-input-color,
|
|
2394
|
+
fig-input-fill {
|
|
2356
2395
|
|
|
2357
|
-
& input[type="text"] {
|
|
2358
|
-
width: 100%;
|
|
2359
|
-
text-transform: uppercase;
|
|
2360
|
-
}
|
|
2361
|
-
}
|
|
2362
2396
|
& > .input-combo > fig-chit:not(:only-child),
|
|
2363
2397
|
& > .input-combo > fig-chit:not(:only-child) > input,
|
|
2364
2398
|
& > .input-combo > fig-fill-picker:not(:only-child),
|
|
@@ -2368,18 +2402,20 @@ fig-input-color {
|
|
|
2368
2402
|
border-bottom-right-radius: 0 !important;
|
|
2369
2403
|
}
|
|
2370
2404
|
|
|
2371
|
-
&
|
|
2372
|
-
|
|
2373
|
-
width:
|
|
2374
|
-
display: inline-flex;
|
|
2405
|
+
& > .input-combo{
|
|
2406
|
+
flex: 1;
|
|
2407
|
+
min-width: 0;
|
|
2375
2408
|
}
|
|
2376
|
-
|
|
2377
|
-
|
|
2409
|
+
|
|
2410
|
+
fig-input-number {
|
|
2411
|
+
flex: 0;
|
|
2412
|
+
flex-basis: 3.25rem;
|
|
2378
2413
|
}
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2414
|
+
|
|
2415
|
+
&[disabled]:not([disabled="false"]) {
|
|
2416
|
+
.input-combo {
|
|
2417
|
+
gap: 0;
|
|
2418
|
+
|
|
2383
2419
|
}
|
|
2384
2420
|
}
|
|
2385
2421
|
}
|
|
@@ -2391,7 +2427,6 @@ fig-slider {
|
|
|
2391
2427
|
flex-grow: 1;
|
|
2392
2428
|
}
|
|
2393
2429
|
|
|
2394
|
-
& fig-input-text[type="number"],
|
|
2395
2430
|
& fig-input-number {
|
|
2396
2431
|
width: 5rem;
|
|
2397
2432
|
}
|
|
@@ -2967,9 +3002,11 @@ fig-fill-picker {
|
|
|
2967
3002
|
gap: var(--spacer-1);
|
|
2968
3003
|
align-items: center;
|
|
2969
3004
|
|
|
2970
|
-
.fig-fill-picker-stop-position {
|
|
2971
|
-
|
|
2972
|
-
flex-
|
|
3005
|
+
& > .fig-fill-picker-stop-position {
|
|
3006
|
+
flex: 0;
|
|
3007
|
+
flex-basis: 3rem;
|
|
3008
|
+
min-width: 0;
|
|
3009
|
+
width: 3rem;
|
|
2973
3010
|
}
|
|
2974
3011
|
|
|
2975
3012
|
.fig-fill-picker-stop-color {
|
package/example.html
CHANGED
|
@@ -176,6 +176,7 @@
|
|
|
176
176
|
<a href="#image">Image</a>
|
|
177
177
|
<a href="#input-angle">Input Angle</a>
|
|
178
178
|
<a href="#input-color">Input Color</a>
|
|
179
|
+
<a href="#input-fill">Input Fill</a>
|
|
179
180
|
<a href="#input-joystick">Input Joystick</a>
|
|
180
181
|
<a href="#input-number">Input Number</a>
|
|
181
182
|
<a href="#input-text">Input Text</a>
|
|
@@ -605,6 +606,26 @@
|
|
|
605
606
|
<fig-chit background="#9747FF"
|
|
606
607
|
size="large"></fig-chit>
|
|
607
608
|
</fig-field>
|
|
609
|
+
<fig-field direction="horizontal">
|
|
610
|
+
<label>Large (Gradient)</label>
|
|
611
|
+
<fig-chit background="linear-gradient(135deg, #667eea 0%, #764ba2 100%)"
|
|
612
|
+
size="large"></fig-chit>
|
|
613
|
+
</fig-field>
|
|
614
|
+
<fig-field direction="horizontal">
|
|
615
|
+
<label>Large (Radial)</label>
|
|
616
|
+
<fig-chit background="radial-gradient(circle, #ff6b6b, #4ecdc4)"
|
|
617
|
+
size="large"></fig-chit>
|
|
618
|
+
</fig-field>
|
|
619
|
+
<fig-field direction="horizontal">
|
|
620
|
+
<label>Large (Angular)</label>
|
|
621
|
+
<fig-chit background="conic-gradient(from 0deg, #ff0000, #ff8800, #ffff00, #00ff00, #0088ff, #8800ff, #ff0000)"
|
|
622
|
+
size="large"></fig-chit>
|
|
623
|
+
</fig-field>
|
|
624
|
+
<fig-field direction="horizontal">
|
|
625
|
+
<label>Large (Image)</label>
|
|
626
|
+
<fig-chit background="url(https://avatars.githubusercontent.com/u/12345678?v=4)"
|
|
627
|
+
size="large"></fig-chit>
|
|
628
|
+
</fig-field>
|
|
608
629
|
|
|
609
630
|
<h3>States</h3>
|
|
610
631
|
<fig-field direction="horizontal">
|
|
@@ -947,6 +968,9 @@
|
|
|
947
968
|
document.getElementById('fill-picker-events').addEventListener('input', (e) => {
|
|
948
969
|
document.getElementById('fill-picker-output').textContent = 'Input: ' + JSON.stringify(e.detail);
|
|
949
970
|
});
|
|
971
|
+
document.getElementById('fill-picker-events').addEventListener('change', (e) => {
|
|
972
|
+
document.getElementById('fill-picker-output').textContent = 'Change: ' + JSON.stringify(e.detail);
|
|
973
|
+
});
|
|
950
974
|
</script>
|
|
951
975
|
</section>
|
|
952
976
|
<hr>
|
|
@@ -1230,6 +1254,88 @@
|
|
|
1230
1254
|
text="true"
|
|
1231
1255
|
alpha="true"></fig-input-color>
|
|
1232
1256
|
</div>
|
|
1257
|
+
|
|
1258
|
+
<h3>Event Listening</h3>
|
|
1259
|
+
<fig-input-color id="input-color-events"
|
|
1260
|
+
value="#FF6B6B"
|
|
1261
|
+
text="true"
|
|
1262
|
+
alpha="true"
|
|
1263
|
+
picker="figma"></fig-input-color>
|
|
1264
|
+
<p class="description"
|
|
1265
|
+
id="input-color-output">Change the color above to see events.</p>
|
|
1266
|
+
<script>
|
|
1267
|
+
document.getElementById('input-color-events').addEventListener('input', (e) => {
|
|
1268
|
+
const el = e.target;
|
|
1269
|
+
document.getElementById('input-color-output').textContent =
|
|
1270
|
+
`Input: ${el.value} | Hex: ${el.hexOpaque} | Alpha: ${el.alpha}%`;
|
|
1271
|
+
});
|
|
1272
|
+
document.getElementById('input-color-events').addEventListener('change', (e) => {
|
|
1273
|
+
const el = e.target;
|
|
1274
|
+
document.getElementById('input-color-output').textContent =
|
|
1275
|
+
`Change: ${el.value} | Hex: ${el.hexOpaque} | Alpha: ${el.alpha}%`;
|
|
1276
|
+
});
|
|
1277
|
+
</script>
|
|
1278
|
+
</section>
|
|
1279
|
+
<hr>
|
|
1280
|
+
|
|
1281
|
+
<!-- Input Fill -->
|
|
1282
|
+
<section id="input-fill">
|
|
1283
|
+
<h2>Input Fill</h2>
|
|
1284
|
+
<p class="description">A fill input that supports solid colors, gradients, images, and videos. The UI adapts
|
|
1285
|
+
based on the fill type.</p>
|
|
1286
|
+
|
|
1287
|
+
<h3>Solid Color (default)</h3>
|
|
1288
|
+
<fig-input-fill value='{"type":"solid","color":"#9747FF","alpha":1}'></fig-input-fill>
|
|
1289
|
+
|
|
1290
|
+
<h3>Solid Color with 50% Opacity</h3>
|
|
1291
|
+
<fig-input-fill value='{"type":"solid","color":"#FF6B6B","alpha":0.5}'></fig-input-fill>
|
|
1292
|
+
|
|
1293
|
+
<h3>Linear Gradient</h3>
|
|
1294
|
+
<fig-input-fill
|
|
1295
|
+
value='{"type":"gradient","gradient":{"type":"linear","angle":180,"stops":[{"position":0,"color":"#667eea","opacity":100},{"position":100,"color":"#764ba2","opacity":100}]}}'></fig-input-fill>
|
|
1296
|
+
|
|
1297
|
+
<h3>Radial Gradient</h3>
|
|
1298
|
+
<fig-input-fill
|
|
1299
|
+
value='{"type":"gradient","gradient":{"type":"radial","centerX":50,"centerY":50,"stops":[{"position":0,"color":"#ff6b6b","opacity":100},{"position":100,"color":"#4ecdc4","opacity":100}]}}'></fig-input-fill>
|
|
1300
|
+
|
|
1301
|
+
<h3>Angular Gradient</h3>
|
|
1302
|
+
<fig-input-fill
|
|
1303
|
+
value='{"type":"gradient","gradient":{"type":"angular","stops":[{"position":0,"color":"#ff0000","opacity":100},{"position":50,"color":"#00ff00","opacity":100},{"position":100,"color":"#0000ff","opacity":100}]}}'></fig-input-fill>
|
|
1304
|
+
|
|
1305
|
+
<h3>Image Fill</h3>
|
|
1306
|
+
<fig-input-fill
|
|
1307
|
+
value='{"type":"image","image":{"url":"https://avatars.githubusercontent.com/u/12345678?v=4","scaleMode":"fill","scale":50,"opacity":1}}'></fig-input-fill>
|
|
1308
|
+
|
|
1309
|
+
<h3>Image Fill (50% Opacity)</h3>
|
|
1310
|
+
<fig-input-fill
|
|
1311
|
+
value='{"type":"image","image":{"url":"https://avatars.githubusercontent.com/u/12345678?v=4","scaleMode":"fill","scale":50,"opacity":0.5}}'></fig-input-fill>
|
|
1312
|
+
|
|
1313
|
+
<h3>Video Fill</h3>
|
|
1314
|
+
<fig-input-fill
|
|
1315
|
+
value='{"type":"video","video":{"url":null,"scaleMode":"fill","opacity":1}}'></fig-input-fill>
|
|
1316
|
+
|
|
1317
|
+
<h3>Webcam Fill</h3>
|
|
1318
|
+
<fig-input-fill value='{"type":"webcam","webcam":{"opacity":1}}'></fig-input-fill>
|
|
1319
|
+
|
|
1320
|
+
<h3>Disabled</h3>
|
|
1321
|
+
<fig-input-fill disabled
|
|
1322
|
+
value='{"type":"solid","color":"#AA96DA","alpha":1}'></fig-input-fill>
|
|
1323
|
+
|
|
1324
|
+
<h3>Event Listening</h3>
|
|
1325
|
+
<fig-input-fill id="input-fill-events"
|
|
1326
|
+
value='{"type":"solid","color":"#4ECDC4","alpha":1}'></fig-input-fill>
|
|
1327
|
+
<p class="description"
|
|
1328
|
+
id="input-fill-output">Change the fill above to see events.</p>
|
|
1329
|
+
<script>
|
|
1330
|
+
document.getElementById('input-fill-events').addEventListener('input', (e) => {
|
|
1331
|
+
document.getElementById('input-fill-output').textContent =
|
|
1332
|
+
`Input: ${JSON.stringify(e.detail)}`;
|
|
1333
|
+
});
|
|
1334
|
+
document.getElementById('input-fill-events').addEventListener('change', (e) => {
|
|
1335
|
+
document.getElementById('input-fill-output').textContent =
|
|
1336
|
+
`Change: ${JSON.stringify(e.detail)}`;
|
|
1337
|
+
});
|
|
1338
|
+
</script>
|
|
1233
1339
|
</section>
|
|
1234
1340
|
<hr>
|
|
1235
1341
|
|