motion-dom 12.34.5 → 12.35.0

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/cjs/index.js CHANGED
@@ -1945,6 +1945,7 @@ function memoSupports(callback, supportsFlag) {
1945
1945
  }
1946
1946
 
1947
1947
  const supportsScrollTimeline = /* @__PURE__ */ memoSupports(() => window.ScrollTimeline !== undefined, "scrollTimeline");
1948
+ const supportsViewTimeline = /* @__PURE__ */ memoSupports(() => window.ViewTimeline !== undefined, "viewTimeline");
1948
1949
 
1949
1950
  const supportsLinearEasing = /*@__PURE__*/ memoSupports(() => {
1950
1951
  try {
@@ -2188,13 +2189,17 @@ class NativeAnimation extends WithPromise {
2188
2189
  /**
2189
2190
  * Attaches a timeline to the animation, for instance the `ScrollTimeline`.
2190
2191
  */
2191
- attachTimeline({ timeline, observe }) {
2192
+ attachTimeline({ timeline, rangeStart, rangeEnd, observe, }) {
2192
2193
  if (this.allowFlatten) {
2193
2194
  this.animation.effect?.updateTiming({ easing: "linear" });
2194
2195
  }
2195
2196
  this.animation.onfinish = null;
2196
2197
  if (timeline && supportsScrollTimeline()) {
2197
2198
  this.animation.timeline = timeline;
2199
+ if (rangeStart)
2200
+ this.animation.rangeStart = rangeStart;
2201
+ if (rangeEnd)
2202
+ this.animation.rangeEnd = rangeEnd;
2198
2203
  return motionUtils.noop;
2199
2204
  }
2200
2205
  else {
@@ -6184,12 +6189,18 @@ function transformAxis(axis, axisTranslate, axisScale, boxScale, axisOrigin = 0.
6184
6189
  // Apply the axis delta to the final axis
6185
6190
  applyAxisDelta(axis, axisTranslate, axisScale, originPoint, boxScale);
6186
6191
  }
6192
+ function resolveAxisTranslate(value, axis) {
6193
+ if (typeof value === "string") {
6194
+ return (parseFloat(value) / 100) * (axis.max - axis.min);
6195
+ }
6196
+ return value;
6197
+ }
6187
6198
  /**
6188
6199
  * Apply a transform to a box from the latest resolved motion values.
6189
6200
  */
6190
6201
  function transformBox(box, transform) {
6191
- transformAxis(box.x, transform.x, transform.scaleX, transform.scale, transform.originX);
6192
- transformAxis(box.y, transform.y, transform.scaleY, transform.scale, transform.originY);
6202
+ transformAxis(box.x, resolveAxisTranslate(transform.x, box.x), transform.scaleX, transform.scale, transform.originX);
6203
+ transformAxis(box.y, resolveAxisTranslate(transform.y, box.y), transform.scaleY, transform.scale, transform.originY);
6193
6204
  }
6194
6205
 
6195
6206
  function measureViewportBox(instance, transformPoint) {
@@ -9723,6 +9734,7 @@ exports.supportsFlags = supportsFlags;
9723
9734
  exports.supportsLinearEasing = supportsLinearEasing;
9724
9735
  exports.supportsPartialKeyframes = supportsPartialKeyframes;
9725
9736
  exports.supportsScrollTimeline = supportsScrollTimeline;
9737
+ exports.supportsViewTimeline = supportsViewTimeline;
9726
9738
  exports.svgEffect = svgEffect;
9727
9739
  exports.sync = sync;
9728
9740
  exports.testValueType = testValueType;