motion-v 2.0.0-beta.2 → 2.0.0-beta.4

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.
@@ -25,6 +25,7 @@ var AnimatePresence_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ *
25
25
  return (_ctx, _cache) => {
26
26
  return openBlock(), createBlock(resolveDynamicComponent(_ctx.mode === "wait" ? Transition : TransitionGroup), mergeProps(transitionProps.value, {
27
27
  appear: "",
28
+ css: false,
28
29
  onLeave: unref(exit),
29
30
  onEnter: unref(enter)
30
31
  }), {
@@ -44,7 +44,10 @@ function useMotionState(props, renderer) {
44
44
  if (bundle.features?.length) updateLazyFeatures(bundle.features);
45
45
  if (bundle.renderer) state.initVisualElement(bundle.renderer);
46
46
  state.updateFeatures();
47
- }, { immediate: true });
47
+ }, {
48
+ immediate: true,
49
+ flush: "pre"
50
+ });
48
51
  function getAttrs() {
49
52
  const isSVG = state.type === "svg";
50
53
  const attrsProps = { ...attrs };
@@ -22,10 +22,7 @@ function cleanVNodeProps(el, vnodeProps) {
22
22
  for (const key in vnodeProps) {
23
23
  const value = vnodeProps[key];
24
24
  if (typeof value !== "function" && key in Element.prototype) delete el[key];
25
- if (value != null && typeof value === "object") {
26
- el.removeAttribute(key);
27
- el.removeAttribute(key.replace(/[A-Z]/g, (m) => `-${m.toLowerCase()}`));
28
- }
25
+ if (value != null && typeof value === "object" && key !== "style") el.removeAttribute(key);
29
26
  }
30
27
  }
31
28
  function resolveTag(source) {
@@ -114,6 +111,7 @@ function createMotionDirective(featureBundle, defaultOptions) {
114
111
  created(el, binding, vnode) {
115
112
  const provides = resolveProvides(vnode, binding);
116
113
  const { options, parentState } = buildMotionOptions(mergeMotionProps(vnode, binding.value), provides, resolveTag(el));
114
+ console.log("options", options);
117
115
  const state = new MotionState(options, parentState);
118
116
  state.initVisualElement(renderer);
119
117
  mountedStates.set(el, state);
@@ -134,6 +132,7 @@ function createMotionDirective(featureBundle, defaultOptions) {
134
132
  updated(el, binding, vnode) {
135
133
  const state = mountedStates.get(el);
136
134
  if (!state) return;
135
+ cleanVNodeProps(el, vnode.props);
137
136
  const provides = resolveProvides(vnode, binding);
138
137
  const { options } = buildMotionOptions(mergeMotionProps(vnode, binding.value), provides, resolveTag(el));
139
138
  state.update(options);
@@ -3,6 +3,7 @@ import { MotionState } from '../../state/motion-state';
3
3
  import { Options } from '../../types';
4
4
  export declare class LayoutFeature extends Feature {
5
5
  static key: "layout";
6
+ private hasMountSettled;
6
7
  constructor(state: MotionState);
7
8
  private updatePrevLead;
8
9
  didUpdate(): void;
@@ -1,13 +1,14 @@
1
1
  import { Feature } from "../feature.mjs";
2
2
  import { isHidden } from "../../utils/is-hidden.mjs";
3
3
  import { defaultScaleCorrector } from "./config.mjs";
4
- import { addScaleCorrector, globalProjectionState } from "motion-dom";
4
+ import { addScaleCorrector, frame, globalProjectionState } from "motion-dom";
5
5
  import { isDef } from "@vueuse/core";
6
6
  var hasLayoutUpdate = false;
7
7
  var LayoutFeature = class extends Feature {
8
8
  static #_ = this.key = "layout";
9
9
  constructor(state) {
10
10
  super(state);
11
+ this.hasMountSettled = false;
11
12
  addScaleCorrector(defaultScaleCorrector);
12
13
  state.getSnapshot = this.getSnapshot.bind(this);
13
14
  state.didUpdate = this.didUpdate.bind(this);
@@ -31,16 +32,19 @@ var LayoutFeature = class extends Feature {
31
32
  const layoutGroup = this.state.options.layoutGroup;
32
33
  if (options.layout || options.layoutId) {
33
34
  const projection = this.state.visualElement.projection;
34
- if (projection) {
35
+ if (options.layoutId) {
35
36
  const isPresent = !isHidden(this.state.element);
36
37
  projection.isPresent = isPresent;
37
38
  isPresent ? projection.promote() : projection.relegate();
38
39
  this.updatePrevLead(projection);
39
- layoutGroup?.group?.add(projection);
40
40
  }
41
+ layoutGroup?.group?.add(projection);
41
42
  globalProjectionState.hasEverUpdated = true;
42
43
  }
43
44
  this.didUpdate();
45
+ frame.postRender(() => {
46
+ this.hasMountSettled = true;
47
+ });
44
48
  }
45
49
  unmount() {
46
50
  const layoutGroup = this.state.options.layoutGroup;
@@ -55,6 +59,7 @@ var LayoutFeature = class extends Feature {
55
59
  const projection = this.state.visualElement.projection;
56
60
  const { drag, layoutDependency, layout, layoutId } = newOptions;
57
61
  if (!projection || !layout && !layoutId && !drag) return;
62
+ if (!this.hasMountSettled) return;
58
63
  hasLayoutUpdate = true;
59
64
  const prevProps = this.state.options;
60
65
  if (drag || prevProps.layoutDependency !== layoutDependency || layoutDependency === void 0 || isDef(isPresent) && projection.isPresent !== isPresent) projection.willUpdate();
@@ -2,3 +2,4 @@ export * from './framer-motion';
2
2
  export * from './motion-values';
3
3
  export * from './state';
4
4
  export * from './common';
5
+ export * from './instance';
@@ -0,0 +1,5 @@
1
+ import { Options } from './state';
2
+ declare module '@vue/runtime-dom' {
3
+ interface HTMLAttributes extends Omit<Options, 'motionConfig' | 'layoutGroup'> {
4
+ }
5
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "motion-v",
3
3
  "type": "module",
4
- "version": "2.0.0-beta.2",
4
+ "version": "2.0.0-beta.4",
5
5
  "description": "",
6
6
  "author": "",
7
7
  "license": "MIT",