motion-v 0.7.1 → 0.8.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.
Files changed (130) hide show
  1. package/dist/cjs/index.js +12 -2
  2. package/dist/es/animation/hooks/animation-controls.mjs +11 -0
  3. package/dist/{src → es}/features/gestures/drag/types.d.ts +1 -1
  4. package/dist/es/state/animate-updates.mjs +2 -2
  5. package/package.json +4 -4
  6. package/dist/src/animation/use-animate.d.ts +0 -8
  7. /package/dist/{src → es}/animation/hooks/animation-controls.d.ts +0 -0
  8. /package/dist/{src → es}/animation/hooks/use-animate.d.ts +0 -0
  9. /package/dist/{src → es}/animation/hooks/use-animation-controls.d.ts +0 -0
  10. /package/dist/{src → es}/animation/index.d.ts +0 -0
  11. /package/dist/{src → es}/animation/types.d.ts +0 -0
  12. /package/dist/{src → es}/animation/utils.d.ts +0 -0
  13. /package/dist/{src → es}/components/LayoutGroup.d.ts +0 -0
  14. /package/dist/{src → es}/components/animate-presence/AnimatePresence.d.ts +0 -0
  15. /package/dist/{src → es}/components/animate-presence/index.d.ts +0 -0
  16. /package/dist/{src → es}/components/animate-presence/types.d.ts +0 -0
  17. /package/dist/{src → es}/components/animate-presence/use-pop-layout.d.ts +0 -0
  18. /package/dist/{src → es}/components/animate-presence/use-presence.d.ts +0 -0
  19. /package/dist/{src → es}/components/animate-presence/utils.d.ts +0 -0
  20. /package/dist/{src → es}/components/context.d.ts +0 -0
  21. /package/dist/{src → es}/components/group.d.ts +0 -0
  22. /package/dist/{src → es}/components/hooks/use-motion-elm.d.ts +0 -0
  23. /package/dist/{src → es}/components/index.d.ts +0 -0
  24. /package/dist/{src → es}/components/motion/Motion.d.ts +0 -0
  25. /package/dist/{src → es}/components/motion/NameSpace.d.ts +0 -0
  26. /package/dist/{src → es}/components/motion/Primitive.d.ts +0 -0
  27. /package/dist/{src → es}/components/motion/Slot.d.ts +0 -0
  28. /package/dist/{src → es}/components/motion/index.d.ts +0 -0
  29. /package/dist/{src → es}/components/motion/renderSlotFragments.d.ts +0 -0
  30. /package/dist/{src → es}/components/motion/utils.d.ts +0 -0
  31. /package/dist/{src → es}/components/motion-config/MotionConfig.d.ts +0 -0
  32. /package/dist/{src → es}/components/motion-config/context.d.ts +0 -0
  33. /package/dist/{src → es}/components/motion-config/index.d.ts +0 -0
  34. /package/dist/{src → es}/components/motion-config/types.d.ts +0 -0
  35. /package/dist/{src → es}/components/presence.d.ts +0 -0
  36. /package/dist/{src → es}/components/use-force-update.d.ts +0 -0
  37. /package/dist/{src → es}/components/use-layout-group.d.ts +0 -0
  38. /package/dist/{src → es}/components/use-slot-change-index.d.ts +0 -0
  39. /package/dist/{src → es}/constants/index.d.ts +0 -0
  40. /package/dist/{src → es}/events/add-dom-event.d.ts +0 -0
  41. /package/dist/{src → es}/events/add-pointer-event.d.ts +0 -0
  42. /package/dist/{src → es}/events/event-info.d.ts +0 -0
  43. /package/dist/{src → es}/events/index.d.ts +0 -0
  44. /package/dist/{src → es}/events/types.d.ts +0 -0
  45. /package/dist/{src → es}/events/utils/index.d.ts +0 -0
  46. /package/dist/{src → es}/events/utils/is-primary-pointer.d.ts +0 -0
  47. /package/dist/{src → es}/features/animation/animation.d.ts +0 -0
  48. /package/dist/{src → es}/features/feature-manager.d.ts +0 -0
  49. /package/dist/{src → es}/features/feature.d.ts +0 -0
  50. /package/dist/{src → es}/features/gestures/base.d.ts +0 -0
  51. /package/dist/{src → es}/features/gestures/drag/VisualElementDragControls.d.ts +0 -0
  52. /package/dist/{src → es}/features/gestures/drag/index.d.ts +0 -0
  53. /package/dist/{src → es}/features/gestures/drag/lock.d.ts +0 -0
  54. /package/dist/{src → es}/features/gestures/drag/use-drag-controls.d.ts +0 -0
  55. /package/dist/{src → es}/features/gestures/drag/utils/constraints.d.ts +0 -0
  56. /package/dist/{src → es}/features/gestures/drag/utils/is.d.ts +0 -0
  57. /package/dist/{src → es}/features/gestures/focus/index.d.ts +0 -0
  58. /package/dist/{src → es}/features/gestures/focus/types.d.ts +0 -0
  59. /package/dist/{src → es}/features/gestures/hover/index.d.ts +0 -0
  60. /package/dist/{src → es}/features/gestures/hover/types.d.ts +0 -0
  61. /package/dist/{src → es}/features/gestures/in-view/index.d.ts +0 -0
  62. /package/dist/{src → es}/features/gestures/in-view/types.d.ts +0 -0
  63. /package/dist/{src → es}/features/gestures/index.d.ts +0 -0
  64. /package/dist/{src → es}/features/gestures/pan/PanSession.d.ts +0 -0
  65. /package/dist/{src → es}/features/gestures/pan/index.d.ts +0 -0
  66. /package/dist/{src → es}/features/gestures/pan/types.d.ts +0 -0
  67. /package/dist/{src → es}/features/gestures/press/index.d.ts +0 -0
  68. /package/dist/{src → es}/features/gestures/press/types.d.ts +0 -0
  69. /package/dist/{src → es}/features/gestures/types.d.ts +0 -0
  70. /package/dist/{src → es}/features/index.d.ts +0 -0
  71. /package/dist/{src → es}/features/layout/config.d.ts +0 -0
  72. /package/dist/{src → es}/features/layout/layout.d.ts +0 -0
  73. /package/dist/{src → es}/features/layout/projection.d.ts +0 -0
  74. /package/dist/{src → es}/features/layout/types.d.ts +0 -0
  75. /package/dist/{src → es}/features/layout/utils.d.ts +0 -0
  76. /package/dist/{src → es}/features/svg.d.ts +0 -0
  77. /package/dist/{src → es}/index.d.ts +0 -0
  78. /package/dist/{src → es}/projection/conversion.d.ts +0 -0
  79. /package/dist/{src → es}/projection/geometry/delta-apply.d.ts +0 -0
  80. /package/dist/{src → es}/projection/geometry/delta-calc.d.ts +0 -0
  81. /package/dist/{src → es}/projection/geometry/models.d.ts +0 -0
  82. /package/dist/{src → es}/projection/node/types.d.ts +0 -0
  83. /package/dist/{src → es}/projection/utils/each-axis.d.ts +0 -0
  84. /package/dist/{src → es}/projection/utils/measure.d.ts +0 -0
  85. /package/dist/{src → es}/render/utils/setters.d.ts +0 -0
  86. /package/dist/{src → es}/shared/index.d.ts +0 -0
  87. /package/dist/{src → es}/shared/test.d.ts +0 -0
  88. /package/dist/{src → es}/state/animate-updates.d.ts +0 -0
  89. /package/dist/{src → es}/state/animate-variants-children.d.ts +0 -0
  90. /package/dist/{src → es}/state/animation/index.d.ts +0 -0
  91. /package/dist/{src → es}/state/animation/types.d.ts +0 -0
  92. /package/dist/{src → es}/state/create-visual-element.d.ts +0 -0
  93. /package/dist/{src → es}/state/event.d.ts +0 -0
  94. /package/dist/{src → es}/state/index.d.ts +0 -0
  95. /package/dist/{src → es}/state/motion-state.d.ts +0 -0
  96. /package/dist/{src → es}/state/style.d.ts +0 -0
  97. /package/dist/{src → es}/state/transform.d.ts +0 -0
  98. /package/dist/{src → es}/state/utils/is-present.d.ts +0 -0
  99. /package/dist/{src → es}/state/utils.d.ts +0 -0
  100. /package/dist/{src → es}/types/framer-motion.d.ts +0 -0
  101. /package/dist/{src → es}/types/index.d.ts +0 -0
  102. /package/dist/{src → es}/types/motion-values.d.ts +0 -0
  103. /package/dist/{src → es}/types/state.d.ts +0 -0
  104. /package/dist/{src → es}/types/transform.d.ts +0 -0
  105. /package/dist/{src → es}/utils/clamp.d.ts +0 -0
  106. /package/dist/{src → es}/utils/createContext.d.ts +0 -0
  107. /package/dist/{src → es}/utils/get-context-window.d.ts +0 -0
  108. /package/dist/{src → es}/utils/index.d.ts +0 -0
  109. /package/dist/{src → es}/utils/mix/number.d.ts +0 -0
  110. /package/dist/{src → es}/utils/motion-value.d.ts +0 -0
  111. /package/dist/{src → es}/utils/noop.d.ts +0 -0
  112. /package/dist/{src → es}/utils/progress.d.ts +0 -0
  113. /package/dist/{src → es}/utils/time-conversion.d.ts +0 -0
  114. /package/dist/{src → es}/utils/use-animation-frame.d.ts +0 -0
  115. /package/dist/{src → es}/utils/use-dom-ref.d.ts +0 -0
  116. /package/dist/{src → es}/utils/use-in-view.d.ts +0 -0
  117. /package/dist/{src → es}/value/index.d.ts +0 -0
  118. /package/dist/{src → es}/value/types/numbers/units.d.ts +0 -0
  119. /package/dist/{src → es}/value/use-combine-values.d.ts +0 -0
  120. /package/dist/{src → es}/value/use-computed.d.ts +0 -0
  121. /package/dist/{src → es}/value/use-motion-template.d.ts +0 -0
  122. /package/dist/{src → es}/value/use-motion-value-event.d.ts +0 -0
  123. /package/dist/{src → es}/value/use-scroll.d.ts +0 -0
  124. /package/dist/{src → es}/value/use-spring.d.ts +0 -0
  125. /package/dist/{src → es}/value/use-time.d.ts +0 -0
  126. /package/dist/{src → es}/value/use-transform.d.ts +0 -0
  127. /package/dist/{src → es}/value/use-velocity.d.ts +0 -0
  128. /package/dist/{src → es}/value/use-will-change/add-will-change.d.ts +0 -0
  129. /package/dist/{src → es}/value/use-will-change/is.d.ts +0 -0
  130. /package/dist/{src → es}/value/use-will-change/types.d.ts +0 -0
package/dist/cjs/index.js CHANGED
@@ -8104,9 +8104,9 @@ function resolveStateAnimation(controlActiveState, animationOptions) {
8104
8104
  }
8105
8105
  function createAnimationFactories(prevTarget, animationOptions, controlDelay) {
8106
8106
  const factories = [];
8107
- new Set(Object.keys(this.target)).forEach((key) => {
8107
+ Object.keys(this.target).forEach((key) => {
8108
8108
  var _a;
8109
- if (!hasChanged(this.visualElement.getValue(key), this.target[key]))
8109
+ if (!hasChanged(prevTarget[key], this.target[key]))
8110
8110
  return;
8111
8111
  (_a = this.baseTarget)[key] ?? (_a[key] = style.get(this.element, key));
8112
8112
  const keyValue = this.target[key] === "none" ? transformResetValue[key] : this.target[key];
@@ -9109,6 +9109,14 @@ function useAnimate() {
9109
9109
  function stopAnimation(visualElement) {
9110
9110
  visualElement.values.forEach((value) => value.stop());
9111
9111
  }
9112
+ function setStateTarget(state2, definition) {
9113
+ const resolvedVariant = resolveVariant(definition, state2.options.variants, state2.options.custom);
9114
+ Object.entries(resolvedVariant).forEach(([key, value]) => {
9115
+ if (key === "transition")
9116
+ return;
9117
+ state2.target[key] = value;
9118
+ });
9119
+ }
9112
9120
  function animationControls() {
9113
9121
  let hasMounted = false;
9114
9122
  const subscribers = /* @__PURE__ */ new Set();
@@ -9161,6 +9169,7 @@ function setValues(state2, definition) {
9161
9169
  if (typeof definition === "string") {
9162
9170
  return setVariants(state2, [definition]);
9163
9171
  } else {
9172
+ setStateTarget(state2, definition);
9164
9173
  setTarget(state2.visualElement, definition);
9165
9174
  }
9166
9175
  }
@@ -9170,6 +9179,7 @@ function setVariants(state2, variantLabels) {
9170
9179
  reversedLabels.forEach((key) => {
9171
9180
  const variant = visualElement.getVariant(key);
9172
9181
  variant && setTarget(visualElement, variant);
9182
+ setStateTarget(state2, variant);
9173
9183
  if (visualElement.variantChildren) {
9174
9184
  visualElement.variantChildren.forEach((child) => {
9175
9185
  setVariants(mountedStates.get(child.current), variantLabels);
@@ -1,9 +1,18 @@
1
1
  import { mountedStates } from "../../state/motion-state.mjs";
2
2
  import { invariant } from "hey-listen";
3
3
  import { setTarget } from "../../external/.pnpm/framer-motion@11.16.6/external/framer-motion/dist/es/render/utils/setters.mjs";
4
+ import { resolveVariant } from "../../state/utils.mjs";
4
5
  function stopAnimation(visualElement) {
5
6
  visualElement.values.forEach((value) => value.stop());
6
7
  }
8
+ function setStateTarget(state, definition) {
9
+ const resolvedVariant = resolveVariant(definition, state.options.variants, state.options.custom);
10
+ Object.entries(resolvedVariant).forEach(([key, value]) => {
11
+ if (key === "transition")
12
+ return;
13
+ state.target[key] = value;
14
+ });
15
+ }
7
16
  function animationControls() {
8
17
  let hasMounted = false;
9
18
  const subscribers = /* @__PURE__ */ new Set();
@@ -56,6 +65,7 @@ function setValues(state, definition) {
56
65
  if (typeof definition === "string") {
57
66
  return setVariants(state, [definition]);
58
67
  } else {
68
+ setStateTarget(state, definition);
59
69
  setTarget(state.visualElement, definition);
60
70
  }
61
71
  }
@@ -65,6 +75,7 @@ function setVariants(state, variantLabels) {
65
75
  reversedLabels.forEach((key) => {
66
76
  const variant = visualElement.getVariant(key);
67
77
  variant && setTarget(visualElement, variant);
78
+ setStateTarget(state, variant);
68
79
  if (visualElement.variantChildren) {
69
80
  visualElement.variantChildren.forEach((child) => {
70
81
  setVariants(mountedStates.get(child.current), variantLabels);
@@ -82,7 +82,7 @@ export interface DragHandlers {
82
82
  */
83
83
  onDragTransitionEnd?: () => void;
84
84
  /**
85
- * If `dragConstraints` is set to a React ref, this callback will call with the measured drag constraints.
85
+ * If `dragConstraints` is set to a HTMLElement, this callback will call with the measured drag constraints.
86
86
  *
87
87
  * @public
88
88
  */
@@ -60,9 +60,9 @@ function resolveStateAnimation(controlActiveState, animationOptions) {
60
60
  }
61
61
  function createAnimationFactories(prevTarget, animationOptions, controlDelay) {
62
62
  const factories = [];
63
- new Set(Object.keys(this.target)).forEach((key) => {
63
+ Object.keys(this.target).forEach((key) => {
64
64
  var _a;
65
- if (!hasChanged(this.visualElement.getValue(key), this.target[key]))
65
+ if (!hasChanged(prevTarget[key], this.target[key]))
66
66
  return;
67
67
  (_a = this.baseTarget)[key] ?? (_a[key] = style.get(this.element, key));
68
68
  const keyValue = this.target[key] === "none" ? transformResetValue[key] : this.target[key];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "motion-v",
3
- "version": "0.7.1",
3
+ "version": "0.8.0",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "license": "MIT",
@@ -17,7 +17,7 @@
17
17
  "sideEffects": false,
18
18
  "exports": {
19
19
  ".": {
20
- "types": "./dist/src/index.d.ts",
20
+ "types": "./dist/es/index.d.ts",
21
21
  "import": "./dist/es/index.mjs",
22
22
  "require": "./dist/cjs/index.js"
23
23
  },
@@ -34,12 +34,12 @@
34
34
  },
35
35
  "main": "./dist/cjs/index.js",
36
36
  "module": "./dist/es/index.mjs",
37
- "types": "./dist/src/index.d.ts",
37
+ "types": "./dist/es/index.d.ts",
38
38
  "typesVersions": {
39
39
  "*": {
40
40
  "*": [
41
41
  "./dist/*/index.d.ts",
42
- "./dist/src/index.d.ts"
42
+ "./dist/es/index.d.ts"
43
43
  ],
44
44
  "nuxt": [
45
45
  "./dist/nuxt/index.d.mts",
@@ -1,8 +0,0 @@
1
- import { AnimationPlaybackControls } from 'framer-motion';
2
- import { Ref, UnwrapRef } from 'vue';
3
- import { createScopedAnimate } from 'framer-motion/dom';
4
- type Scope = Ref<UnwrapRef<Element>> & {
5
- animations: AnimationPlaybackControls[];
6
- };
7
- export declare function useAnimate<T extends Element = any>(): [Scope, ReturnType<typeof createScopedAnimate>];
8
- export {};
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes