codexly-ui 0.13.4 → 0.13.6
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/fesm2022/codexly-ui.mjs
CHANGED
|
@@ -2788,6 +2788,15 @@ class ClxAnimateService {
|
|
|
2788
2788
|
void element.offsetHeight;
|
|
2789
2789
|
const animClass = `${PREFIX}${config.animation}`;
|
|
2790
2790
|
const isInfinite = config.repeat === 'infinite';
|
|
2791
|
+
// A fillMode: 'forwards' animation (an exit fade/slide, e.g. clx-toast's playExitAnimation)
|
|
2792
|
+
// is almost always followed by the caller destroying the element on the same tick its promise
|
|
2793
|
+
// resolves — stripping animClass in _cleanup right then would drop animation-fill-mode's hold
|
|
2794
|
+
// on the last keyframe, snapping the element back to its static CSS state (opaque, in place)
|
|
2795
|
+
// for one paintable frame before removal, which read as a flash/"ghost" re-appearance. Classes
|
|
2796
|
+
// are only stripped for a non-forwards run; a forwards run keeps them and instead resets
|
|
2797
|
+
// them at the START of runAnimation's own reflow-forced restart path above, so a persisted
|
|
2798
|
+
// element that's re-animated later (e.g. clx-animate-directive on hover) still resets cleanly.
|
|
2799
|
+
const keepClassesOnEnd = config.fillMode === 'forwards';
|
|
2791
2800
|
element.style.setProperty('--clx-anim-duration', `${config.duration}ms`);
|
|
2792
2801
|
element.style.setProperty('--clx-anim-delay', `${config.delay}ms`);
|
|
2793
2802
|
element.style.setProperty('--clx-anim-repeat', isInfinite ? 'infinite' : String(config.repeat ?? 1));
|
|
@@ -2809,7 +2818,12 @@ class ClxAnimateService {
|
|
|
2809
2818
|
return new Promise(resolve => {
|
|
2810
2819
|
const handleEnd = (ev) => {
|
|
2811
2820
|
ev.stopPropagation();
|
|
2812
|
-
|
|
2821
|
+
if (keepClassesOnEnd) {
|
|
2822
|
+
this._cleanups.delete(element);
|
|
2823
|
+
}
|
|
2824
|
+
else {
|
|
2825
|
+
this._cleanup(element, animClass);
|
|
2826
|
+
}
|
|
2813
2827
|
this._runningCount.update(c => Math.max(0, c - 1));
|
|
2814
2828
|
resolve();
|
|
2815
2829
|
};
|
|
@@ -4583,13 +4597,25 @@ class ClxNumberComponent {
|
|
|
4583
4597
|
this._onChange(v);
|
|
4584
4598
|
this._onTouched();
|
|
4585
4599
|
}
|
|
4600
|
+
/** Number of decimal places implied by step() (e.g. 0.1 -> 1, 0.01 -> 2, 1 -> 0) — used to round
|
|
4601
|
+
* after +/- so a fractional step doesn't accumulate binary floating-point noise (0.1 isn't
|
|
4602
|
+
* exactly representable, so 2.2 + 0.1 naively yields 2.3000000000000003, not 2.3). */
|
|
4603
|
+
_stepDecimals() {
|
|
4604
|
+
const str = this.step().toString();
|
|
4605
|
+
const dot = str.indexOf('.');
|
|
4606
|
+
return dot === -1 ? 0 : str.length - dot - 1;
|
|
4607
|
+
}
|
|
4608
|
+
_roundToStep(value) {
|
|
4609
|
+
const factor = 10 ** this._stepDecimals();
|
|
4610
|
+
return Math.round(value * factor) / factor;
|
|
4611
|
+
}
|
|
4586
4612
|
_decrement() {
|
|
4587
|
-
const next = this._value() - this.step();
|
|
4613
|
+
const next = this._roundToStep(this._value() - this.step());
|
|
4588
4614
|
const clamped = this.min() !== null ? Math.max(next, this.min()) : next;
|
|
4589
4615
|
this._applyValue(clamped);
|
|
4590
4616
|
}
|
|
4591
4617
|
_increment() {
|
|
4592
|
-
const next = this._value() + this.step();
|
|
4618
|
+
const next = this._roundToStep(this._value() + this.step());
|
|
4593
4619
|
const clamped = this.max() !== null ? Math.min(next, this.max()) : next;
|
|
4594
4620
|
this._applyValue(clamped);
|
|
4595
4621
|
}
|