index.js 2.0 KB

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