@rogieking/figui3 8.9.33 → 8.9.35
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/.cursor/skills/fig-lab/SKILL.md +2 -2
- package/.cursor/skills/fig-lab/reference.md +3 -3
- package/README.md +4 -1
- package/components.css +1 -0
- package/dist/components.css +1 -1
- package/dist/fig-lab.css +1 -1
- package/dist/fig-lab.js +2 -2
- package/dist/fig.css +1 -1
- package/fig-lab.css +1 -1
- package/fig-lab.js +55 -11
- package/package.json +1 -1
package/fig-lab.css
CHANGED
|
@@ -1709,6 +1709,7 @@ propskit-wheel {
|
|
|
1709
1709
|
fig-input-number {
|
|
1710
1710
|
background-color: transparent;
|
|
1711
1711
|
box-shadow: none !important;
|
|
1712
|
+
font-variant-numeric: var(--font-variant-numeric);
|
|
1712
1713
|
position: absolute;
|
|
1713
1714
|
right: var(--propskit-wheel-number-right);
|
|
1714
1715
|
top: 50%;
|
|
@@ -1732,7 +1733,6 @@ propskit-wheel {
|
|
|
1732
1733
|
|
|
1733
1734
|
input {
|
|
1734
1735
|
field-sizing: content;
|
|
1735
|
-
font-variant-numeric: tabular-nums;
|
|
1736
1736
|
width: auto;
|
|
1737
1737
|
flex: 0 0 auto;
|
|
1738
1738
|
text-align: right;
|
package/fig-lab.js
CHANGED
|
@@ -5552,6 +5552,7 @@ figLabDefineElement("propskit-slider", PropskitSlider);
|
|
|
5552
5552
|
* @attr {number} min - Inclusive lower bound. Omitted = unbounded below.
|
|
5553
5553
|
* @attr {number} max - Inclusive upper bound. Omitted = unbounded above.
|
|
5554
5554
|
* @attr {number} step - Increment. Defaults to 1.
|
|
5555
|
+
* @attr {boolean|string} spin - Keeps ticks synchronized to value. Defaults to true.
|
|
5555
5556
|
* @attr {boolean|string} elastic - Enables resisted handle movement. Defaults to true.
|
|
5556
5557
|
* @attr {boolean|string} disabled - Disables interaction and focus.
|
|
5557
5558
|
* @fires input - Numeric composed event during interaction.
|
|
@@ -5598,6 +5599,7 @@ class FigInputWheel extends HTMLElement {
|
|
|
5598
5599
|
"step",
|
|
5599
5600
|
"min",
|
|
5600
5601
|
"max",
|
|
5602
|
+
"spin",
|
|
5601
5603
|
"elastic",
|
|
5602
5604
|
];
|
|
5603
5605
|
}
|
|
@@ -5637,6 +5639,7 @@ class FigInputWheel extends HTMLElement {
|
|
|
5637
5639
|
this.#syncWheelAria();
|
|
5638
5640
|
this.#queueWheelLayout();
|
|
5639
5641
|
}
|
|
5642
|
+
if (name === "spin") this.#queueWheelLayout();
|
|
5640
5643
|
if (name === "min" || name === "max") {
|
|
5641
5644
|
this.#commitValue(this.#numericValue());
|
|
5642
5645
|
}
|
|
@@ -5865,7 +5868,10 @@ class FigInputWheel extends HTMLElement {
|
|
|
5865
5868
|
const height = this.#wheelHeight;
|
|
5866
5869
|
if (width < 1 || height < 1) return;
|
|
5867
5870
|
|
|
5868
|
-
const value =
|
|
5871
|
+
const value =
|
|
5872
|
+
this.getAttribute("spin") === "false"
|
|
5873
|
+
? (this.#boundMin() ?? 0)
|
|
5874
|
+
: (this.#visualValue ?? this.#numericValue());
|
|
5869
5875
|
const tickStep = 360 / FigInputWheel.#TICK_COUNT;
|
|
5870
5876
|
const step = this.#step();
|
|
5871
5877
|
const base = this.#boundMin() ?? 0;
|
|
@@ -6186,7 +6192,13 @@ class FigInputWheel extends HTMLElement {
|
|
|
6186
6192
|
this.#commitValue(this.#numericValue(), { emit: "change" });
|
|
6187
6193
|
}
|
|
6188
6194
|
|
|
6189
|
-
#animateKeyboardMovement(
|
|
6195
|
+
#animateKeyboardMovement(
|
|
6196
|
+
from,
|
|
6197
|
+
to,
|
|
6198
|
+
direction,
|
|
6199
|
+
multiplier,
|
|
6200
|
+
animateHandle = true,
|
|
6201
|
+
) {
|
|
6190
6202
|
if (
|
|
6191
6203
|
from === to ||
|
|
6192
6204
|
globalThis.matchMedia?.("(prefers-reduced-motion: reduce)").matches
|
|
@@ -6209,13 +6221,14 @@ class FigInputWheel extends HTMLElement {
|
|
|
6209
6221
|
) || 0;
|
|
6210
6222
|
const duration = multiplier > 1 ? 120 : 90;
|
|
6211
6223
|
const startedAt = performance.now();
|
|
6212
|
-
const
|
|
6224
|
+
const shouldAnimateHandle =
|
|
6225
|
+
animateHandle && this.getAttribute("elastic") !== "false";
|
|
6213
6226
|
this.setAttribute("data-fig-input-wheel-keyboard-moving", "");
|
|
6214
6227
|
|
|
6215
6228
|
const frame = (now) => {
|
|
6216
6229
|
const progress = Math.min(1, (now - startedAt) / duration);
|
|
6217
6230
|
this.#visualValue = visualFrom + (to - visualFrom) * progress;
|
|
6218
|
-
if (
|
|
6231
|
+
if (shouldAnimateHandle) {
|
|
6219
6232
|
const eased = Math.sin((progress * Math.PI) / 2);
|
|
6220
6233
|
const offset = handleFrom + (direction * 4 - handleFrom) * eased;
|
|
6221
6234
|
this.style.setProperty(
|
|
@@ -6272,6 +6285,25 @@ class FigInputWheel extends HTMLElement {
|
|
|
6272
6285
|
this.#commitValue(Number.isFinite(parsed) ? parsed : 0);
|
|
6273
6286
|
}
|
|
6274
6287
|
|
|
6288
|
+
spinTo(nextValue) {
|
|
6289
|
+
const previousValue = this.#numericValue();
|
|
6290
|
+
this.value = nextValue;
|
|
6291
|
+
const value = this.#numericValue();
|
|
6292
|
+
if (this.getAttribute("spin") === "false") {
|
|
6293
|
+
this.#stopKeyboardAnimation();
|
|
6294
|
+
return value;
|
|
6295
|
+
}
|
|
6296
|
+
const direction = Math.sign(value - previousValue);
|
|
6297
|
+
this.#animateKeyboardMovement(
|
|
6298
|
+
previousValue,
|
|
6299
|
+
value,
|
|
6300
|
+
direction,
|
|
6301
|
+
Math.abs(value - previousValue) > this.#step() ? 10 : 1,
|
|
6302
|
+
false,
|
|
6303
|
+
);
|
|
6304
|
+
return value;
|
|
6305
|
+
}
|
|
6306
|
+
|
|
6275
6307
|
get min() {
|
|
6276
6308
|
return this.#boundMin();
|
|
6277
6309
|
}
|
|
@@ -6304,6 +6336,7 @@ figLabDefineElement("fig-input-wheel", FigInputWheel);
|
|
|
6304
6336
|
* @attr {string} label - Field label. Defaults to "Value".
|
|
6305
6337
|
* @attr {string} default - Reset target.
|
|
6306
6338
|
* @attr {number} precision - Number field display decimals.
|
|
6339
|
+
* @attr {boolean|string} spin - Keeps wheel ticks synchronized to value. Defaults to true.
|
|
6307
6340
|
* @attr {boolean|string} text - Shows the number field. Defaults to true.
|
|
6308
6341
|
* @attr {string} size - Set to "small" for compact sizing.
|
|
6309
6342
|
* @attr {string} variant - Set to "minimal" for compact chrome.
|
|
@@ -6317,6 +6350,7 @@ class PropskitWheel extends HTMLElement {
|
|
|
6317
6350
|
"disabled",
|
|
6318
6351
|
"variant",
|
|
6319
6352
|
"elastic",
|
|
6353
|
+
"spin",
|
|
6320
6354
|
"text",
|
|
6321
6355
|
"default",
|
|
6322
6356
|
"class",
|
|
@@ -6337,6 +6371,7 @@ class PropskitWheel extends HTMLElement {
|
|
|
6337
6371
|
"min",
|
|
6338
6372
|
"max",
|
|
6339
6373
|
"elastic",
|
|
6374
|
+
"spin",
|
|
6340
6375
|
"text",
|
|
6341
6376
|
];
|
|
6342
6377
|
}
|
|
@@ -6421,9 +6456,16 @@ class PropskitWheel extends HTMLElement {
|
|
|
6421
6456
|
if (name === "label") this.#syncLabel();
|
|
6422
6457
|
if (name === "text") this.#syncText();
|
|
6423
6458
|
if (
|
|
6424
|
-
[
|
|
6425
|
-
|
|
6426
|
-
|
|
6459
|
+
[
|
|
6460
|
+
"units",
|
|
6461
|
+
"value",
|
|
6462
|
+
"disabled",
|
|
6463
|
+
"step",
|
|
6464
|
+
"min",
|
|
6465
|
+
"max",
|
|
6466
|
+
"elastic",
|
|
6467
|
+
"spin",
|
|
6468
|
+
].includes(name)
|
|
6427
6469
|
) {
|
|
6428
6470
|
this.#syncPrimitive();
|
|
6429
6471
|
}
|
|
@@ -6500,7 +6542,7 @@ class PropskitWheel extends HTMLElement {
|
|
|
6500
6542
|
#syncPrimitive() {
|
|
6501
6543
|
if (!this.#wheel) return;
|
|
6502
6544
|
this.#wheel.removeAttribute("units");
|
|
6503
|
-
for (const name of ["min", "max", "elastic"]) {
|
|
6545
|
+
for (const name of ["min", "max", "elastic", "spin"]) {
|
|
6504
6546
|
this.#mirrorAttribute(name);
|
|
6505
6547
|
}
|
|
6506
6548
|
if (this.hasAttribute("step")) this.#mirrorAttribute("step");
|
|
@@ -6660,14 +6702,16 @@ class PropskitWheel extends HTMLElement {
|
|
|
6660
6702
|
this.removeEventListener("click", this.#boundClick, true);
|
|
6661
6703
|
}
|
|
6662
6704
|
|
|
6663
|
-
#setSynchronizedValue(value) {
|
|
6705
|
+
#setSynchronizedValue(value, { spin = false } = {}) {
|
|
6664
6706
|
const parsed = Number(value);
|
|
6665
6707
|
if (!this.#wheel) {
|
|
6666
6708
|
const normalized = Number.isFinite(parsed) ? parsed : 0;
|
|
6667
6709
|
this.setAttribute("value", String(normalized));
|
|
6668
6710
|
return normalized;
|
|
6669
6711
|
}
|
|
6670
|
-
|
|
6712
|
+
const nextValue = Number.isFinite(parsed) ? parsed : 0;
|
|
6713
|
+
if (spin) this.#wheel.spinTo(nextValue);
|
|
6714
|
+
else this.#wheel.value = nextValue;
|
|
6671
6715
|
const normalized = this.#wheel.value;
|
|
6672
6716
|
if (this.getAttribute("value") !== normalized) {
|
|
6673
6717
|
this.setAttribute("value", normalized);
|
|
@@ -6703,7 +6747,7 @@ class PropskitWheel extends HTMLElement {
|
|
|
6703
6747
|
event instanceof CustomEvent && event.detail !== undefined
|
|
6704
6748
|
? event.detail
|
|
6705
6749
|
: this.#input?.value;
|
|
6706
|
-
const value = this.#setSynchronizedValue(raw);
|
|
6750
|
+
const value = this.#setSynchronizedValue(raw, { spin: type === "input" });
|
|
6707
6751
|
this.#emit(type, value);
|
|
6708
6752
|
}
|
|
6709
6753
|
|
package/package.json
CHANGED