index.mjs 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. import { getCurrentInstance } from "vue";
  2. //#region ../../packages/hooks/use-transition-fallthrough/index.ts
  3. /* istanbul ignore file */
  4. const AFTER_APPEAR = "after-appear";
  5. const AFTER_ENTER = "after-enter";
  6. const AFTER_LEAVE = "after-leave";
  7. const APPEAR = "appear";
  8. const APPEAR_CANCELLED = "appear-cancelled";
  9. const BEFORE_ENTER = "before-enter";
  10. const BEFORE_LEAVE = "before-leave";
  11. const ENTER = "enter";
  12. const ENTER_CANCELLED = "enter-cancelled";
  13. const LEAVE = "leave";
  14. const LEAVE_CANCELLED = "leave-cancelled";
  15. const useTransitionFallthroughEmits = [
  16. AFTER_APPEAR,
  17. AFTER_ENTER,
  18. AFTER_LEAVE,
  19. APPEAR,
  20. APPEAR_CANCELLED,
  21. BEFORE_ENTER,
  22. BEFORE_LEAVE,
  23. ENTER,
  24. ENTER_CANCELLED,
  25. LEAVE,
  26. LEAVE_CANCELLED
  27. ];
  28. /**
  29. * NOTE:
  30. * This is only a delegator for delegating transition callbacks.
  31. * Use this at your need.
  32. */
  33. /**
  34. * Simple usage
  35. *
  36. * In your setups:
  37. *
  38. * setup() {
  39. * const fallthroughMethods = useTransitionFallthrough()
  40. * return fallthrough
  41. * }
  42. *
  43. * In your template:
  44. *
  45. * <template>
  46. * <transition name="whatever" v-bind="fallthrough">
  47. * <slot />
  48. * </transition>
  49. * </template>
  50. *
  51. */
  52. const useTransitionFallthrough = () => {
  53. const { emit } = getCurrentInstance();
  54. return {
  55. onAfterAppear: () => {
  56. emit(AFTER_APPEAR);
  57. },
  58. onAfterEnter: () => {
  59. emit(AFTER_ENTER);
  60. },
  61. onAfterLeave: () => {
  62. emit(AFTER_LEAVE);
  63. },
  64. onAppearCancelled: () => {
  65. emit(APPEAR_CANCELLED);
  66. },
  67. onBeforeEnter: () => {
  68. emit(BEFORE_ENTER);
  69. },
  70. onBeforeLeave: () => {
  71. emit(BEFORE_LEAVE);
  72. },
  73. onEnter: () => {
  74. emit(ENTER);
  75. },
  76. onEnterCancelled: () => {
  77. emit(ENTER_CANCELLED);
  78. },
  79. onLeave: () => {
  80. emit(LEAVE);
  81. },
  82. onLeaveCancelled: () => {
  83. emit(LEAVE_CANCELLED);
  84. }
  85. };
  86. };
  87. //#endregion
  88. export { useTransitionFallthrough, useTransitionFallthroughEmits };
  89. //# sourceMappingURL=index.mjs.map