@rogieking/figui3 8.2.0 → 8.2.1
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/dist/fig-lab.js +1 -1
- package/dist/fig.js +20 -20
- package/fig-lab.js +1 -1
- package/fig.js +4 -31
- package/package.json +1 -1
package/fig-lab.js
CHANGED
|
@@ -4267,7 +4267,7 @@ class PropskitSlider extends HTMLElement {
|
|
|
4267
4267
|
}
|
|
4268
4268
|
|
|
4269
4269
|
#pushExternalValueToSlider() {
|
|
4270
|
-
if (!this.#slider) return;
|
|
4270
|
+
if (!this.#slider || !this.hasAttribute("value")) return;
|
|
4271
4271
|
const next = this.getAttribute("value") ?? "";
|
|
4272
4272
|
if (String(this.#slider.value) !== next) {
|
|
4273
4273
|
this.#slider.value = next;
|
package/fig.js
CHANGED
|
@@ -5173,7 +5173,6 @@ figDefineElement("fig-options", FigOptions);
|
|
|
5173
5173
|
class FigSlider extends HTMLElement {
|
|
5174
5174
|
#isInteracting = false;
|
|
5175
5175
|
#pendingRegeneration = false;
|
|
5176
|
-
#showEmptyTextValue = false;
|
|
5177
5176
|
#isSyncingValueAttribute = false;
|
|
5178
5177
|
#value = "";
|
|
5179
5178
|
#a11yAttributes = [
|
|
@@ -5278,10 +5277,6 @@ class FigSlider extends HTMLElement {
|
|
|
5278
5277
|
: this.type === "delta"
|
|
5279
5278
|
? 0
|
|
5280
5279
|
: this.min;
|
|
5281
|
-
this.#showEmptyTextValue =
|
|
5282
|
-
this.type !== "range" &&
|
|
5283
|
-
(rawValue === null ||
|
|
5284
|
-
(typeof rawValue === "string" && rawValue.trim() === ""));
|
|
5285
5280
|
this.value = this.#normalizeSliderValue(rawValue);
|
|
5286
5281
|
}
|
|
5287
5282
|
|
|
@@ -5321,10 +5316,7 @@ class FigSlider extends HTMLElement {
|
|
|
5321
5316
|
this.figInputNumber.setAttribute("max", String(this.max));
|
|
5322
5317
|
this.figInputNumber.setAttribute("transform", String(this.transform));
|
|
5323
5318
|
this.figInputNumber.setAttribute("step", String(this.step));
|
|
5324
|
-
this.figInputNumber.setAttribute(
|
|
5325
|
-
"value",
|
|
5326
|
-
this.#showEmptyTextValue ? "" : String(this.value),
|
|
5327
|
-
);
|
|
5319
|
+
this.figInputNumber.setAttribute("value", String(this.value));
|
|
5328
5320
|
if (this.units) this.figInputNumber.setAttribute("units", this.units);
|
|
5329
5321
|
else this.figInputNumber.removeAttribute("units");
|
|
5330
5322
|
if (this.precision !== null) {
|
|
@@ -5411,7 +5403,7 @@ class FigSlider extends HTMLElement {
|
|
|
5411
5403
|
max="${this.max}"
|
|
5412
5404
|
transform="${this.transform}"
|
|
5413
5405
|
step="${this.step}"
|
|
5414
|
-
value="${this
|
|
5406
|
+
value="${this.value}"
|
|
5415
5407
|
${this.units ? `units="${figEscapeAttribute(this.units)}"` : ""}
|
|
5416
5408
|
${this.precision !== null ? `precision="${this.precision}"` : ""}>
|
|
5417
5409
|
</fig-input-number>`;
|
|
@@ -5487,8 +5479,6 @@ class FigSlider extends HTMLElement {
|
|
|
5487
5479
|
|
|
5488
5480
|
set value(value) {
|
|
5489
5481
|
const rawValue = value === null || value === undefined ? "" : String(value);
|
|
5490
|
-
this.#showEmptyTextValue =
|
|
5491
|
-
this.type !== "range" && rawValue.trim() === "";
|
|
5492
5482
|
const hasParsedBounds = this.min !== undefined || this.max !== undefined;
|
|
5493
5483
|
const normalized = hasParsedBounds
|
|
5494
5484
|
? String(this.#normalizeSliderValue(rawValue))
|
|
@@ -5504,10 +5494,7 @@ class FigSlider extends HTMLElement {
|
|
|
5504
5494
|
this.input.setAttribute("aria-valuenow", normalized);
|
|
5505
5495
|
}
|
|
5506
5496
|
if (this.figInputNumber) {
|
|
5507
|
-
this.figInputNumber.setAttribute(
|
|
5508
|
-
"value",
|
|
5509
|
-
this.#showEmptyTextValue ? "" : normalized,
|
|
5510
|
-
);
|
|
5497
|
+
this.figInputNumber.setAttribute("value", normalized);
|
|
5511
5498
|
}
|
|
5512
5499
|
if (this.input) this.#syncProperties();
|
|
5513
5500
|
}
|
|
@@ -5537,10 +5524,6 @@ class FigSlider extends HTMLElement {
|
|
|
5537
5524
|
#handleTextInput() {
|
|
5538
5525
|
if (this.figInputNumber) {
|
|
5539
5526
|
const rawTextValue = this.figInputNumber.value;
|
|
5540
|
-
this.#showEmptyTextValue =
|
|
5541
|
-
rawTextValue === null ||
|
|
5542
|
-
rawTextValue === undefined ||
|
|
5543
|
-
(typeof rawTextValue === "string" && rawTextValue.trim() === "");
|
|
5544
5527
|
const normalized = this.#normalizeSliderValue(rawTextValue);
|
|
5545
5528
|
this.value = normalized;
|
|
5546
5529
|
this.input.value = String(normalized);
|
|
@@ -5624,10 +5607,7 @@ class FigSlider extends HTMLElement {
|
|
|
5624
5607
|
// Update ARIA value
|
|
5625
5608
|
this.input.setAttribute("aria-valuenow", val);
|
|
5626
5609
|
if (this.figInputNumber) {
|
|
5627
|
-
this.figInputNumber.setAttribute(
|
|
5628
|
-
"value",
|
|
5629
|
-
this.#showEmptyTextValue ? "" : val,
|
|
5630
|
-
);
|
|
5610
|
+
this.figInputNumber.setAttribute("value", val);
|
|
5631
5611
|
}
|
|
5632
5612
|
}
|
|
5633
5613
|
#syncInputA11yAttributes() {
|
|
@@ -5665,7 +5645,6 @@ class FigSlider extends HTMLElement {
|
|
|
5665
5645
|
}
|
|
5666
5646
|
|
|
5667
5647
|
#handleInput() {
|
|
5668
|
-
this.#showEmptyTextValue = false;
|
|
5669
5648
|
this.#syncValue();
|
|
5670
5649
|
this.dispatchEvent(
|
|
5671
5650
|
new CustomEvent("input", { detail: this.value, bubbles: true }),
|
|
@@ -5674,7 +5653,6 @@ class FigSlider extends HTMLElement {
|
|
|
5674
5653
|
|
|
5675
5654
|
#handleChange() {
|
|
5676
5655
|
this.#isInteracting = false;
|
|
5677
|
-
this.#showEmptyTextValue = false;
|
|
5678
5656
|
this.#syncValue();
|
|
5679
5657
|
this.dispatchEvent(
|
|
5680
5658
|
new CustomEvent("change", { detail: this.value, bubbles: true }),
|
|
@@ -5690,7 +5668,6 @@ class FigSlider extends HTMLElement {
|
|
|
5690
5668
|
}
|
|
5691
5669
|
|
|
5692
5670
|
event.preventDefault();
|
|
5693
|
-
this.#showEmptyTextValue = false;
|
|
5694
5671
|
|
|
5695
5672
|
const direction =
|
|
5696
5673
|
event.key === "ArrowRight" || event.key === "ArrowUp" ? 1 : -1;
|
|
@@ -5712,10 +5689,6 @@ class FigSlider extends HTMLElement {
|
|
|
5712
5689
|
#handleTextChange() {
|
|
5713
5690
|
if (this.figInputNumber) {
|
|
5714
5691
|
const rawTextValue = this.figInputNumber.value;
|
|
5715
|
-
this.#showEmptyTextValue =
|
|
5716
|
-
rawTextValue === null ||
|
|
5717
|
-
rawTextValue === undefined ||
|
|
5718
|
-
(typeof rawTextValue === "string" && rawTextValue.trim() === "");
|
|
5719
5692
|
const normalized = this.#normalizeSliderValue(rawTextValue);
|
|
5720
5693
|
this.value = normalized;
|
|
5721
5694
|
this.input.value = String(normalized);
|
package/package.json
CHANGED