motion-dom 12.43.0 → 13.0.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
@@ -7691,10 +7691,9 @@ function buildSVGPath(attrs, length, spacing = 1, offset = 0, useDashCase = true
7691
7691
  attrs[keys.array] = `${length} ${spacing}`;
7692
7692
  }
7693
7693
 
7694
- /**
7695
- * CSS Motion Path properties that should remain as CSS styles on SVG elements.
7696
- */
7697
- const cssMotionPathProperties = [
7694
+ const cssStyleProperties = [
7695
+ "transform",
7696
+ "opacity",
7698
7697
  "offsetDistance",
7699
7698
  "offsetPath",
7700
7699
  "offsetRotate",
@@ -7720,13 +7719,11 @@ function buildSVGAttrs(state, { attrX, attrY, attrScale, pathLength, pathSpacing
7720
7719
  state.attrs = state.style;
7721
7720
  state.style = {};
7722
7721
  const { attrs, style } = state;
7723
- /**
7724
- * However, we apply transforms as CSS transforms.
7725
- * So if we detect a transform, transformOrigin we take it from attrs and copy it into style.
7726
- */
7727
- if (attrs.transform) {
7728
- style.transform = attrs.transform;
7729
- delete attrs.transform;
7722
+ for (const key of cssStyleProperties) {
7723
+ if (attrs[key] !== undefined) {
7724
+ style[key] = attrs[key];
7725
+ delete attrs[key];
7726
+ }
7730
7727
  }
7731
7728
  if (style.transform || attrs.transformOrigin) {
7732
7729
  style.transformOrigin = attrs.transformOrigin ?? "50% 50%";
@@ -7740,12 +7737,6 @@ function buildSVGAttrs(state, { attrX, attrY, attrScale, pathLength, pathSpacing
7740
7737
  style.transformBox = styleProp?.transformBox ?? "fill-box";
7741
7738
  delete attrs.transformBox;
7742
7739
  }
7743
- for (const key of cssMotionPathProperties) {
7744
- if (attrs[key] !== undefined) {
7745
- style[key] = attrs[key];
7746
- delete attrs[key];
7747
- }
7748
- }
7749
7740
  // Render attrX/attrY/attrScale as attributes
7750
7741
  if (attrX !== undefined)
7751
7742
  attrs.x = attrX;
@@ -7826,6 +7817,12 @@ class SVGVisualElement extends DOMVisualElement {
7826
7817
  const defaultType = getDefaultValueType(key);
7827
7818
  return defaultType ? defaultType.default || 0 : 0;
7828
7819
  }
7820
+ if (cssStyleProperties.includes(key)) {
7821
+ const computedStyle = getComputedStyle(instance);
7822
+ const value = computedStyle[key];
7823
+ if (typeof value === "string" && value)
7824
+ return value.trim();
7825
+ }
7829
7826
  key = !camelCaseAttributes.has(key) ? camelToDash(key) : key;
7830
7827
  return instance.getAttribute(key);
7831
7828
  }