motion-v 0.5.0 → 0.5.1

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
@@ -8188,7 +8188,8 @@ const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
8188
8188
  layoutScroll: false,
8189
8189
  layoutRoot: false,
8190
8190
  dragListener: true,
8191
- dragElastic: 0.2
8191
+ dragElastic: 0.2,
8192
+ dragMomentum: true
8192
8193
  }),
8193
8194
  setup(__props) {
8194
8195
  const props = __props;
@@ -8248,12 +8249,23 @@ const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
8248
8249
  if (isSVG) {
8249
8250
  const { attributes, style: style2 } = convertSvgStyleToAttributes(state2.target);
8250
8251
  Object.assign(attrsProps, attributes);
8251
- Object.assign(styleProps, style2, props.style);
8252
+ Object.assign(styleProps, style2);
8252
8253
  }
8253
8254
  if (!state2.isMounted()) {
8254
- Object.assign(styleProps, state2.target, props.style);
8255
+ Object.assign(styleProps, state2.target);
8256
+ }
8257
+ if (props.drag && props.dragListener !== false) {
8258
+ Object.assign(styleProps, {
8259
+ userSelect: "none",
8260
+ WebkitUserSelect: "none",
8261
+ WebkitTouchCallout: "none",
8262
+ touchAction: props.drag === true ? "none" : `pan-${props.drag === "x" ? "y" : "x"}`
8263
+ });
8255
8264
  }
8256
- styleProps = createStyles(styleProps);
8265
+ styleProps = createStyles({
8266
+ ...styleProps,
8267
+ ...props.style
8268
+ });
8257
8269
  attrsProps.style = styleProps;
8258
8270
  return attrsProps;
8259
8271
  }
@@ -8586,13 +8598,12 @@ function useSpring(source, config = {}) {
8586
8598
  });
8587
8599
  };
8588
8600
  vue.watch(() => JSON.stringify(config), () => {
8589
- const cleanup = value.attach((v, set) => {
8601
+ value.attach((v, set) => {
8590
8602
  latestValue = v;
8591
8603
  latestSetter = set;
8592
8604
  frame.update(startAnimation);
8593
8605
  return value.get();
8594
8606
  }, stopAnimation);
8595
- vue.onBeforeUnmount(() => cleanup());
8596
8607
  }, { immediate: true });
8597
8608
  if (isMotionValue(source)) {
8598
8609
  source.on("change", (v) => {
@@ -73,7 +73,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
73
73
  layoutScroll: false,
74
74
  layoutRoot: false,
75
75
  dragListener: true,
76
- dragElastic: 0.2
76
+ dragElastic: 0.2,
77
+ dragMomentum: true
77
78
  }),
78
79
  setup(__props) {
79
80
  const props = __props;
@@ -133,12 +134,23 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
133
134
  if (isSVG) {
134
135
  const { attributes, style } = convertSvgStyleToAttributes(state.target);
135
136
  Object.assign(attrsProps, attributes);
136
- Object.assign(styleProps, style, props.style);
137
+ Object.assign(styleProps, style);
137
138
  }
138
139
  if (!state.isMounted()) {
139
- Object.assign(styleProps, state.target, props.style);
140
+ Object.assign(styleProps, state.target);
140
141
  }
141
- styleProps = createStyles(styleProps);
142
+ if (props.drag && props.dragListener !== false) {
143
+ Object.assign(styleProps, {
144
+ userSelect: "none",
145
+ WebkitUserSelect: "none",
146
+ WebkitTouchCallout: "none",
147
+ touchAction: props.drag === true ? "none" : `pan-${props.drag === "x" ? "y" : "x"}`
148
+ });
149
+ }
150
+ styleProps = createStyles({
151
+ ...styleProps,
152
+ ...props.style
153
+ });
142
154
  attrsProps.style = styleProps;
143
155
  return attrsProps;
144
156
  }
@@ -1,4 +1,4 @@
1
- import { watch, onBeforeUnmount } from "vue";
1
+ import { watch } from "vue";
2
2
  import { animateValue } from "../external/.pnpm/framer-motion@11.15.0/external/framer-motion/dist/es/animation/animators/MainThreadAnimation.mjs";
3
3
  import { motionValue } from "../external/.pnpm/framer-motion@11.15.0/external/framer-motion/dist/es/value/index.mjs";
4
4
  import { frame, frameData } from "../external/.pnpm/framer-motion@11.15.0/external/framer-motion/dist/es/frameloop/frame.mjs";
@@ -39,13 +39,12 @@ function useSpring(source, config = {}) {
39
39
  });
40
40
  };
41
41
  watch(() => JSON.stringify(config), () => {
42
- const cleanup = value.attach((v, set) => {
42
+ value.attach((v, set) => {
43
43
  latestValue = v;
44
44
  latestSetter = set;
45
45
  frame.update(startAnimation);
46
46
  return value.get();
47
47
  }, stopAnimation);
48
- onBeforeUnmount(() => cleanup());
49
48
  }, { immediate: true });
50
49
  if (isMotionValue(source)) {
51
50
  source.on("change", (v) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "motion-v",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "license": "MIT",