@rogieking/figui3 1.3.7 → 1.3.9
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/example.html +25 -0
- package/fig.css +17 -14
- package/fig.js +11 -1
- package/package.json +1 -1
package/example.html
CHANGED
|
@@ -23,6 +23,31 @@
|
|
|
23
23
|
<h2>UI3 Components</h2>
|
|
24
24
|
</fig-header>
|
|
25
25
|
<fig-content>
|
|
26
|
+
<fig-field>
|
|
27
|
+
<fig-slider type="delta"
|
|
28
|
+
value=".25"
|
|
29
|
+
default="2"
|
|
30
|
+
step="0.1"
|
|
31
|
+
max="5"
|
|
32
|
+
min="-5">
|
|
33
|
+
</fig-slider>
|
|
34
|
+
</fig-field>
|
|
35
|
+
|
|
36
|
+
<br /><br />
|
|
37
|
+
<fig-input-angle value="45"
|
|
38
|
+
text="true"></fig-input-angle>
|
|
39
|
+
<br /><br />
|
|
40
|
+
<fig-slider min="0.01"
|
|
41
|
+
max="0.25"
|
|
42
|
+
name="u_thickness"
|
|
43
|
+
variant="minimal"
|
|
44
|
+
step="0.01"
|
|
45
|
+
value="1"
|
|
46
|
+
text="true"
|
|
47
|
+
type="range"
|
|
48
|
+
units="%"
|
|
49
|
+
transform="100">
|
|
50
|
+
</fig-slider>
|
|
26
51
|
<fig-input-text type="number"
|
|
27
52
|
min="1"
|
|
28
53
|
style="width: 100px;"
|
package/fig.css
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
:root {
|
|
2
2
|
--figma-color-bg: #ffffff;
|
|
3
3
|
--figma-color-bg-brand: #0d99ff;
|
|
4
|
+
|
|
4
5
|
--figma-color-bg-brand-hover: #007be5;
|
|
5
6
|
--figma-color-bg-brand-pressed: #007be5;
|
|
6
7
|
--figma-color-bg-brand-secondary: #0768cf;
|
|
@@ -160,6 +161,7 @@
|
|
|
160
161
|
--figma-color-text-onwarning-tertiary: #0000004d;
|
|
161
162
|
--figma-color-text-secondary: #00000080;
|
|
162
163
|
--figma-color-text-secondary-hover: #000000e5;
|
|
164
|
+
--figma-color-text-selection: rgba(13, 153, 255, 0.4);
|
|
163
165
|
--figma-color-text-selected: #007be5;
|
|
164
166
|
--figma-color-text-selected-secondary: #007be5;
|
|
165
167
|
--figma-color-text-selected-tertiary: #007be5;
|
|
@@ -478,6 +480,14 @@ html {
|
|
|
478
480
|
box-sizing: border-box;
|
|
479
481
|
}
|
|
480
482
|
|
|
483
|
+
::selection {
|
|
484
|
+
background-color: var(--figma-color-text-selection);
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
::-moz-selection {
|
|
488
|
+
background-color: var(--figma-color-text-selection);
|
|
489
|
+
}
|
|
490
|
+
|
|
481
491
|
body {
|
|
482
492
|
font-size: var(--body-medium-fontSize);
|
|
483
493
|
letter-spacing: var(--body-letter-spacing);
|
|
@@ -1504,6 +1514,12 @@ fig-slider {
|
|
|
1504
1514
|
}
|
|
1505
1515
|
|
|
1506
1516
|
&[type="delta"] {
|
|
1517
|
+
datalist option {
|
|
1518
|
+
position: absolute;
|
|
1519
|
+
margin: 0;
|
|
1520
|
+
left: calc(var(--start-percent) - var(--slider-tick-size) / 2);
|
|
1521
|
+
top: calc(50% - var(--slider-tick-size) / 2);
|
|
1522
|
+
}
|
|
1507
1523
|
.fig-slider-input-container {
|
|
1508
1524
|
&::before {
|
|
1509
1525
|
--left-start: calc(var(--start-percent) - var(--slider-height) / 2);
|
|
@@ -1525,19 +1541,6 @@ fig-slider {
|
|
|
1525
1541
|
--abs-delta: max(var(--delta), -1 * var(--delta));
|
|
1526
1542
|
opacity: calc(var(--abs-delta) * 100);
|
|
1527
1543
|
}
|
|
1528
|
-
|
|
1529
|
-
&::after {
|
|
1530
|
-
content: "";
|
|
1531
|
-
width: var(--slider-tick-size);
|
|
1532
|
-
height: var(--slider-tick-size);
|
|
1533
|
-
aspect-ratio: 1;
|
|
1534
|
-
border-radius: 100%;
|
|
1535
|
-
font-size: 0;
|
|
1536
|
-
position: absolute;
|
|
1537
|
-
left: calc(var(--start-percent) - var(--slider-tick-size) / 2);
|
|
1538
|
-
top: calc(50% - var(--slider-tick-size) / 2);
|
|
1539
|
-
background: var(--figma-color-icon-onbrand);
|
|
1540
|
-
}
|
|
1541
1544
|
}
|
|
1542
1545
|
}
|
|
1543
1546
|
|
|
@@ -2261,7 +2264,7 @@ fig-segmented-control {
|
|
|
2261
2264
|
justify-content: center;
|
|
2262
2265
|
position: relative;
|
|
2263
2266
|
appearance: none;
|
|
2264
|
-
color: var(--figma-color-text-
|
|
2267
|
+
color: var(--figma-color-text-se);
|
|
2265
2268
|
padding: 0 var(--spacer-2);
|
|
2266
2269
|
|
|
2267
2270
|
&[selected]:not([selected="false"]),
|
package/fig.js
CHANGED
|
@@ -757,6 +757,14 @@ class FigSlider extends HTMLElement {
|
|
|
757
757
|
}
|
|
758
758
|
this.inputContainer.append(this.datalist);
|
|
759
759
|
this.input.setAttribute("list", this.datalist.getAttribute("id"));
|
|
760
|
+
} else if (this.type === "delta") {
|
|
761
|
+
this.datalist = document.createElement("datalist");
|
|
762
|
+
this.datalist.setAttribute("id", figUniqueId());
|
|
763
|
+
let option = document.createElement("option");
|
|
764
|
+
option.setAttribute("value", this.default);
|
|
765
|
+
this.datalist.append(option);
|
|
766
|
+
this.inputContainer.append(this.datalist);
|
|
767
|
+
this.input.setAttribute("list", this.datalist.getAttribute("id"));
|
|
760
768
|
}
|
|
761
769
|
if (this.datalist) {
|
|
762
770
|
let defaultOption = this.datalist.querySelector(
|
|
@@ -2023,8 +2031,9 @@ class FigInputAngle extends HTMLElement {
|
|
|
2023
2031
|
this.handle = null;
|
|
2024
2032
|
this.angleInput = null;
|
|
2025
2033
|
this.plane = null;
|
|
2034
|
+
}
|
|
2026
2035
|
|
|
2027
|
-
|
|
2036
|
+
connectedCallback() {
|
|
2028
2037
|
requestAnimationFrame(() => {
|
|
2029
2038
|
this.precision = this.getAttribute("precision") || 1;
|
|
2030
2039
|
this.precision = parseInt(this.precision);
|
|
@@ -2263,3 +2272,4 @@ class FigInputAngle extends HTMLElement {
|
|
|
2263
2272
|
}
|
|
2264
2273
|
}
|
|
2265
2274
|
}
|
|
2275
|
+
customElements.define("fig-input-angle", FigInputAngle);
|