@grahlnn/comps 0.1.2 → 0.1.3
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/index.js +11 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2523,6 +2523,7 @@ var MORPH = {
|
|
|
2523
2523
|
maxFadeMs: 150,
|
|
2524
2524
|
ease: "cubic-bezier(0.22, 1, 0.36, 1)",
|
|
2525
2525
|
geometryEpsilon: 0.5,
|
|
2526
|
+
contentWidthLockEpsilon: 2,
|
|
2526
2527
|
lineGroupingEpsilon: 1
|
|
2527
2528
|
};
|
|
2528
2529
|
var MORPH_SEGMENT_CACHE_LIMIT = 256;
|
|
@@ -3099,7 +3100,7 @@ function shouldMeasureUsingContentInlineSize(layoutContext, layoutHint) {
|
|
|
3099
3100
|
if (layoutHint === null || !isSingleLineSnapshot(layoutHint.snapshot)) {
|
|
3100
3101
|
return false;
|
|
3101
3102
|
}
|
|
3102
|
-
return nearlyEqual(layoutHint.layoutInlineSize, layoutHint.snapshot.width);
|
|
3103
|
+
return nearlyEqual(layoutHint.layoutInlineSize, layoutHint.snapshot.width, MORPH.contentWidthLockEpsilon);
|
|
3103
3104
|
}
|
|
3104
3105
|
function createMorphMeasurementRequest({
|
|
3105
3106
|
text,
|
|
@@ -3423,10 +3424,18 @@ function resetMorph(session, timeline, setState) {
|
|
|
3423
3424
|
setState(EMPTY_STATE);
|
|
3424
3425
|
}
|
|
3425
3426
|
function commitStaticMeasurement(session, measurement, setState) {
|
|
3427
|
+
if (!session.animating && session.target === null && session.committed !== null && sameMeasurement(session.committed, measurement)) {
|
|
3428
|
+
return;
|
|
3429
|
+
}
|
|
3426
3430
|
session.committed = measurement;
|
|
3427
3431
|
session.target = null;
|
|
3428
3432
|
session.animating = false;
|
|
3429
|
-
setState(
|
|
3433
|
+
setState((current) => {
|
|
3434
|
+
if (current.stage === "idle" && current.plan === null && current.measurement !== null && sameMeasurement(current.measurement, measurement)) {
|
|
3435
|
+
return current;
|
|
3436
|
+
}
|
|
3437
|
+
return createStaticState(measurement);
|
|
3438
|
+
});
|
|
3430
3439
|
}
|
|
3431
3440
|
function scheduleMorphTimeline({
|
|
3432
3441
|
session,
|