motion-dom 12.34.0 → 12.34.2

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.
@@ -1,6 +1,6 @@
1
- import { memo } from 'motion-utils';
1
+ import { memoSupports } from './memo.mjs';
2
2
 
3
- const supportsScrollTimeline = /* @__PURE__ */ memo(() => window.ScrollTimeline !== undefined);
3
+ const supportsScrollTimeline = /* @__PURE__ */ memoSupports(() => window.ScrollTimeline !== undefined, "scrollTimeline");
4
4
 
5
5
  export { supportsScrollTimeline };
6
6
  //# sourceMappingURL=scroll-timeline.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"scroll-timeline.mjs","sources":["../../../../src/utils/supports/scroll-timeline.ts"],"sourcesContent":["import { memo } from \"motion-utils\"\nimport { ProgressTimeline } from \"../..\"\n\ndeclare global {\n interface Window {\n ScrollTimeline: ScrollTimeline\n }\n}\n\ndeclare class ScrollTimeline implements ProgressTimeline {\n constructor(options: ScrollOptions)\n\n currentTime: null | { value: number }\n\n cancel?: VoidFunction\n}\n\nexport const supportsScrollTimeline = /* @__PURE__ */ memo(\n () => window.ScrollTimeline !== undefined\n)\n"],"names":[],"mappings":";;AAiBa,MAAA,sBAAsB,mBAAmB,IAAI,CACtD,MAAM,MAAM,CAAC,cAAc,KAAK,SAAS;;;;"}
1
+ {"version":3,"file":"scroll-timeline.mjs","sources":["../../../../src/utils/supports/scroll-timeline.ts"],"sourcesContent":["import { ProgressTimeline } from \"../..\"\nimport { memoSupports } from \"./memo\"\n\ndeclare global {\n interface Window {\n ScrollTimeline: ScrollTimeline\n }\n}\n\ndeclare class ScrollTimeline implements ProgressTimeline {\n constructor(options: ScrollOptions)\n\n currentTime: null | { value: number }\n\n cancel?: VoidFunction\n}\n\nexport const supportsScrollTimeline = /* @__PURE__ */ memoSupports(\n () => window.ScrollTimeline !== undefined,\n \"scrollTimeline\"\n)\n"],"names":[],"mappings":";;AAiBa,MAAA,sBAAsB,mBAAmB,YAAY,CAC9D,MAAM,MAAM,CAAC,cAAc,KAAK,SAAS,EACzC,gBAAgB;;;;"}
@@ -0,0 +1,13 @@
1
+ import { complex } from './index.mjs';
2
+
3
+ const mask = {
4
+ ...complex,
5
+ getAnimatableNone: (v) => {
6
+ const parsed = complex.parse(v);
7
+ const transformer = complex.createTransformer(v);
8
+ return transformer(parsed.map((v) => typeof v === "number" ? 0 : typeof v === "object" ? { ...v, alpha: 1 } : v));
9
+ },
10
+ };
11
+
12
+ export { mask };
13
+ //# sourceMappingURL=mask.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mask.mjs","sources":["../../../../../src/value/types/complex/mask.ts"],"sourcesContent":["import { complex } from \".\"\nimport { AnyResolvedKeyframe } from \"../../../animation/types\"\n\nexport const mask = {\n ...complex,\n getAnimatableNone: (v: AnyResolvedKeyframe) => {\n const parsed = complex.parse(v)\n const transformer = complex.createTransformer(v)\n return transformer(\n parsed.map((v) =>\n typeof v === \"number\" ? 0 : typeof v === \"object\" ? { ...v, alpha: 1 } : v\n )\n )\n },\n}\n"],"names":[],"mappings":";;AAGa,MAAA,IAAI,GAAG;AAChB,IAAA,GAAG,OAAO;AACV,IAAA,iBAAiB,EAAE,CAAC,CAAsB,KAAI;QAC1C,MAAM,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;QAC/B,MAAM,WAAW,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAA;AAChD,QAAA,OAAO,WAAW,CACd,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,KACT,OAAO,CAAC,KAAK,QAAQ,GAAG,CAAC,GAAG,OAAO,CAAC,KAAK,QAAQ,GAAG,EAAE,GAAG,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,CAAC,CAC7E,CACJ,CAAA;KACJ;;;;;"}
@@ -1,5 +1,6 @@
1
1
  import { color } from '../color/index.mjs';
2
2
  import { filter } from '../complex/filter.mjs';
3
+ import { mask } from '../complex/mask.mjs';
3
4
  import { numberValueTypes } from './number.mjs';
4
5
 
5
6
  /**
@@ -21,6 +22,8 @@ const defaultValueTypes = {
21
22
  borderLeftColor: color,
22
23
  filter,
23
24
  WebkitFilter: filter,
25
+ mask,
26
+ WebkitMask: mask,
24
27
  };
25
28
  /**
26
29
  * Gets the default ValueType for the provided value key
@@ -1 +1 @@
1
- {"version":3,"file":"defaults.mjs","sources":["../../../../../src/value/types/maps/defaults.ts"],"sourcesContent":["import { color } from \"../color\"\nimport { filter } from \"../complex/filter\"\nimport { numberValueTypes } from \"./number\"\nimport { ValueTypeMap } from \"./types\"\n\n/**\n * A map of default value types for common values\n */\nexport const defaultValueTypes: ValueTypeMap = {\n ...numberValueTypes,\n\n // Color props\n color,\n backgroundColor: color,\n outlineColor: color,\n fill: color,\n stroke: color,\n\n // Border props\n borderColor: color,\n borderTopColor: color,\n borderRightColor: color,\n borderBottomColor: color,\n borderLeftColor: color,\n filter,\n WebkitFilter: filter,\n}\n\n/**\n * Gets the default ValueType for the provided value key\n */\nexport const getDefaultValueType = (key: string) => defaultValueTypes[key]\n"],"names":[],"mappings":";;;;AAKA;;AAEG;AACU,MAAA,iBAAiB,GAAiB;AAC3C,IAAA,GAAG,gBAAgB;;IAGnB,KAAK;AACL,IAAA,eAAe,EAAE,KAAK;AACtB,IAAA,YAAY,EAAE,KAAK;AACnB,IAAA,IAAI,EAAE,KAAK;AACX,IAAA,MAAM,EAAE,KAAK;;AAGb,IAAA,WAAW,EAAE,KAAK;AAClB,IAAA,cAAc,EAAE,KAAK;AACrB,IAAA,gBAAgB,EAAE,KAAK;AACvB,IAAA,iBAAiB,EAAE,KAAK;AACxB,IAAA,eAAe,EAAE,KAAK;IACtB,MAAM;AACN,IAAA,YAAY,EAAE,MAAM;EACvB;AAED;;AAEG;AACI,MAAM,mBAAmB,GAAG,CAAC,GAAW,KAAK,iBAAiB,CAAC,GAAG;;;;"}
1
+ {"version":3,"file":"defaults.mjs","sources":["../../../../../src/value/types/maps/defaults.ts"],"sourcesContent":["import { color } from \"../color\"\nimport { filter } from \"../complex/filter\"\nimport { mask } from \"../complex/mask\"\nimport { numberValueTypes } from \"./number\"\nimport { ValueTypeMap } from \"./types\"\n\n/**\n * A map of default value types for common values\n */\nexport const defaultValueTypes: ValueTypeMap = {\n ...numberValueTypes,\n\n // Color props\n color,\n backgroundColor: color,\n outlineColor: color,\n fill: color,\n stroke: color,\n\n // Border props\n borderColor: color,\n borderTopColor: color,\n borderRightColor: color,\n borderBottomColor: color,\n borderLeftColor: color,\n filter,\n WebkitFilter: filter,\n mask,\n WebkitMask: mask,\n}\n\n/**\n * Gets the default ValueType for the provided value key\n */\nexport const getDefaultValueType = (key: string) => defaultValueTypes[key]\n"],"names":[],"mappings":";;;;;AAMA;;AAEG;AACU,MAAA,iBAAiB,GAAiB;AAC3C,IAAA,GAAG,gBAAgB;;IAGnB,KAAK;AACL,IAAA,eAAe,EAAE,KAAK;AACtB,IAAA,YAAY,EAAE,KAAK;AACnB,IAAA,IAAI,EAAE,KAAK;AACX,IAAA,MAAM,EAAE,KAAK;;AAGb,IAAA,WAAW,EAAE,KAAK;AAClB,IAAA,cAAc,EAAE,KAAK;AACrB,IAAA,gBAAgB,EAAE,KAAK;AACvB,IAAA,iBAAiB,EAAE,KAAK;AACxB,IAAA,eAAe,EAAE,KAAK;IACtB,MAAM;AACN,IAAA,YAAY,EAAE,MAAM;IACpB,IAAI;AACJ,IAAA,UAAU,EAAE,IAAI;EACnB;AAED;;AAEG;AACI,MAAM,mBAAmB,GAAG,CAAC,GAAW,KAAK,iBAAiB,CAAC,GAAG;;;;"}
@@ -1,10 +1,12 @@
1
1
  import { complex } from '../complex/index.mjs';
2
2
  import { filter } from '../complex/filter.mjs';
3
+ import { mask } from '../complex/mask.mjs';
3
4
  import { getDefaultValueType } from '../maps/defaults.mjs';
4
5
 
6
+ const customTypes = /*@__PURE__*/ new Set([filter, mask]);
5
7
  function getAnimatableNone(key, value) {
6
8
  let defaultValueType = getDefaultValueType(key);
7
- if (defaultValueType !== filter)
9
+ if (!customTypes.has(defaultValueType))
8
10
  defaultValueType = complex;
9
11
  // If value is not recognised as animatable, ie "none", create an animatable version origin based on the target
10
12
  return defaultValueType.getAnimatableNone
@@ -1 +1 @@
1
- {"version":3,"file":"animatable-none.mjs","sources":["../../../../../src/value/types/utils/animatable-none.ts"],"sourcesContent":["import { complex } from \"../complex\"\nimport { filter } from \"../complex/filter\"\nimport { getDefaultValueType } from \"../maps/defaults\"\n\nexport function getAnimatableNone(key: string, value: string) {\n let defaultValueType = getDefaultValueType(key)\n if (defaultValueType !== filter) defaultValueType = complex\n // If value is not recognised as animatable, ie \"none\", create an animatable version origin based on the target\n return defaultValueType.getAnimatableNone\n ? defaultValueType.getAnimatableNone(value)\n : undefined\n}\n"],"names":[],"mappings":";;;;AAIgB,SAAA,iBAAiB,CAAC,GAAW,EAAE,KAAa,EAAA;AACxD,IAAA,IAAI,gBAAgB,GAAG,mBAAmB,CAAC,GAAG,CAAC,CAAA;IAC/C,IAAI,gBAAgB,KAAK,MAAM;QAAE,gBAAgB,GAAG,OAAO,CAAA;;IAE3D,OAAO,gBAAgB,CAAC,iBAAiB;AACrC,UAAE,gBAAgB,CAAC,iBAAiB,CAAC,KAAK,CAAC;UACzC,SAAS,CAAA;AACnB;;;;"}
1
+ {"version":3,"file":"animatable-none.mjs","sources":["../../../../../src/value/types/utils/animatable-none.ts"],"sourcesContent":["import { complex } from \"../complex\"\nimport { filter } from \"../complex/filter\"\nimport { mask } from \"../complex/mask\"\nimport { getDefaultValueType } from \"../maps/defaults\"\n\nconst customTypes = /*@__PURE__*/ new Set([filter, mask])\n\nexport function getAnimatableNone(key: string, value: string) {\n let defaultValueType = getDefaultValueType(key)\n if (!customTypes.has(defaultValueType as any)) defaultValueType = complex\n // If value is not recognised as animatable, ie \"none\", create an animatable version origin based on the target\n return defaultValueType.getAnimatableNone\n ? defaultValueType.getAnimatableNone(value)\n : undefined\n}\n"],"names":[],"mappings":";;;;;AAKA,MAAM,WAAW,iBAAiB,IAAI,GAAG,CAAC,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,CAAA;AAEzC,SAAA,iBAAiB,CAAC,GAAW,EAAE,KAAa,EAAA;AACxD,IAAA,IAAI,gBAAgB,GAAG,mBAAmB,CAAC,GAAG,CAAC,CAAA;AAC/C,IAAA,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,gBAAuB,CAAC;QAAE,gBAAgB,GAAG,OAAO,CAAA;;IAEzE,OAAO,gBAAgB,CAAC,iBAAiB;AACrC,UAAE,gBAAgB,CAAC,iBAAiB,CAAC,KAAK,CAAC;UACzC,SAAS,CAAA;AACnB;;;;"}
@@ -1927,8 +1927,6 @@
1927
1927
  : (element.style[name] = value);
1928
1928
  }
1929
1929
 
1930
- const supportsScrollTimeline = /* @__PURE__ */ motionUtils.memo(() => window.ScrollTimeline !== undefined);
1931
-
1932
1930
  /**
1933
1931
  * Add the ability for test suites to manually set support flags
1934
1932
  * to better test more environments.
@@ -1940,6 +1938,8 @@
1940
1938
  return () => supportsFlags[supportsFlag] ?? memoized();
1941
1939
  }
1942
1940
 
1941
+ const supportsScrollTimeline = /* @__PURE__ */ memoSupports(() => window.ScrollTimeline !== undefined, "scrollTimeline");
1942
+
1943
1943
  const supportsLinearEasing = /*@__PURE__*/ memoSupports(() => {
1944
1944
  try {
1945
1945
  document
@@ -3535,6 +3535,15 @@
3535
3535
  },
3536
3536
  };
3537
3537
 
3538
+ const mask = {
3539
+ ...complex,
3540
+ getAnimatableNone: (v) => {
3541
+ const parsed = complex.parse(v);
3542
+ const transformer = complex.createTransformer(v);
3543
+ return transformer(parsed.map((v) => typeof v === "number" ? 0 : typeof v === "object" ? { ...v, alpha: 1 } : v));
3544
+ },
3545
+ };
3546
+
3538
3547
  const int = {
3539
3548
  ...number,
3540
3549
  transform: Math.round,
@@ -3650,15 +3659,18 @@
3650
3659
  borderLeftColor: color,
3651
3660
  filter,
3652
3661
  WebkitFilter: filter,
3662
+ mask,
3663
+ WebkitMask: mask,
3653
3664
  };
3654
3665
  /**
3655
3666
  * Gets the default ValueType for the provided value key
3656
3667
  */
3657
3668
  const getDefaultValueType = (key) => defaultValueTypes[key];
3658
3669
 
3670
+ const customTypes = /*@__PURE__*/ new Set([filter, mask]);
3659
3671
  function getAnimatableNone(key, value) {
3660
3672
  let defaultValueType = getDefaultValueType(key);
3661
- if (defaultValueType !== filter)
3673
+ if (!customTypes.has(defaultValueType))
3662
3674
  defaultValueType = complex;
3663
3675
  // If value is not recognised as animatable, ie "none", create an animatable version origin based on the target
3664
3676
  return defaultValueType.getAnimatableNone
@@ -8644,6 +8656,7 @@
8644
8656
  globalProjectionState.hasAnimatedSinceResize = true;
8645
8657
  activeAnimations.layout++;
8646
8658
  this.motionValue || (this.motionValue = motionValue(0));
8659
+ this.motionValue.jump(0, false);
8647
8660
  this.currentAnimation = animateSingleValue(this.motionValue, [0, 1000], {
8648
8661
  ...options,
8649
8662
  velocity: 0,