index.js 1.9 KB

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