// Utilities
import { defineComponent, h, Transition, TransitionGroup } from 'vue';
import { makeProps } from "../../util/index.mjs"; // Types

export function createCssTransition(name, origin = 'top center 0', mode) {
  return defineComponent({
    name,
    props: makeProps({
      group: Boolean,
      hideOnLeave: Boolean,
      leaveAbsolute: Boolean,
      mode: {
        type: String,
        default: mode
      },
      origin: {
        type: String,
        default: origin
      }
    }),

    setup(props, {
      slots
    }) {
      return () => {
        const tag = props.group ? TransitionGroup : Transition;
        return h(tag, {
          name,
          mode: props.mode,

          onBeforeEnter(el) {
            el.style.transformOrigin = props.origin;
          },

          onLeave(el) {
            if (props.leaveAbsolute) el.style.position = 'absolute';
            if (props.hideOnLeave) el.style.display = 'none';
          }

        }, slots.default);
      };
    }

  });
}
export function createJavascriptTransition(name, functions, mode = 'in-out') {
  return defineComponent({
    name,
    props: makeProps({
      mode: {
        type: String,
        default: mode
      }
    }),

    setup(props, {
      slots
    }) {
      return () => {
        return h(Transition, {
          name,
          // mode: props.mode, // TODO: vuejs/vue-next#3104
          ...functions
        }, slots.default);
      };
    }

  });
}
//# sourceMappingURL=createTransition.mjs.map