This commit is contained in:
2025-09-19 14:25:20 +08:00
parent 269893a435
commit fbf3f77229
24949 changed files with 2839404 additions and 0 deletions

View File

@@ -0,0 +1,37 @@
export declare const useTransitionFallthroughEmits: readonly ["after-appear", "after-enter", "after-leave", "appear", "appear-cancelled", "before-enter", "before-leave", "enter", "enter-cancelled", "leave", "leave-cancelled"];
/**
* NOTE:
* This is only a delegator for delegating transition callbacks.
* Use this at your need.
*/
/**
* Simple usage
*
* In your setups:
*
* setup() {
* const fallthroughMethods = useTransitionFallthrough()
* return fallthrough
* }
*
* In your template:
*
* <template>
* <transition name="whatever" v-bind="fallthrough">
* <slot />
* </transition>
* </template>
*
*/
export declare const useTransitionFallthrough: () => {
onAfterAppear: () => void;
onAfterEnter: () => void;
onAfterLeave: () => void;
onAppearCancelled: () => void;
onBeforeEnter: () => void;
onBeforeLeave: () => void;
onEnter: () => void;
onEnterCancelled: () => void;
onLeave: () => void;
onLeaveCancelled: () => void;
};

View File

@@ -0,0 +1,64 @@
import { getCurrentInstance } from 'vue';
const AFTER_APPEAR = "after-appear";
const AFTER_ENTER = "after-enter";
const AFTER_LEAVE = "after-leave";
const APPEAR = "appear";
const APPEAR_CANCELLED = "appear-cancelled";
const BEFORE_ENTER = "before-enter";
const BEFORE_LEAVE = "before-leave";
const ENTER = "enter";
const ENTER_CANCELLED = "enter-cancelled";
const LEAVE = "leave";
const LEAVE_CANCELLED = "leave-cancelled";
const useTransitionFallthroughEmits = [
AFTER_APPEAR,
AFTER_ENTER,
AFTER_LEAVE,
APPEAR,
APPEAR_CANCELLED,
BEFORE_ENTER,
BEFORE_LEAVE,
ENTER,
ENTER_CANCELLED,
LEAVE,
LEAVE_CANCELLED
];
const useTransitionFallthrough = () => {
const { emit } = getCurrentInstance();
return {
onAfterAppear: () => {
emit(AFTER_APPEAR);
},
onAfterEnter: () => {
emit(AFTER_ENTER);
},
onAfterLeave: () => {
emit(AFTER_LEAVE);
},
onAppearCancelled: () => {
emit(APPEAR_CANCELLED);
},
onBeforeEnter: () => {
emit(BEFORE_ENTER);
},
onBeforeLeave: () => {
emit(BEFORE_LEAVE);
},
onEnter: () => {
emit(ENTER);
},
onEnterCancelled: () => {
emit(ENTER_CANCELLED);
},
onLeave: () => {
emit(LEAVE);
},
onLeaveCancelled: () => {
emit(LEAVE_CANCELLED);
}
};
};
export { useTransitionFallthrough, useTransitionFallthroughEmits };
//# sourceMappingURL=index.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.mjs","sources":["../../../../../packages/hooks/use-transition-fallthrough/index.ts"],"sourcesContent":["/* istanbul ignore file */\nimport { getCurrentInstance } from 'vue'\n\nconst AFTER_APPEAR = 'after-appear'\nconst AFTER_ENTER = 'after-enter'\nconst AFTER_LEAVE = 'after-leave'\nconst APPEAR = 'appear'\nconst APPEAR_CANCELLED = 'appear-cancelled'\nconst BEFORE_ENTER = 'before-enter'\nconst BEFORE_LEAVE = 'before-leave'\nconst ENTER = 'enter'\nconst ENTER_CANCELLED = 'enter-cancelled'\nconst LEAVE = 'leave'\nconst LEAVE_CANCELLED = 'leave-cancelled'\n\nexport const useTransitionFallthroughEmits = [\n AFTER_APPEAR,\n AFTER_ENTER,\n AFTER_LEAVE,\n APPEAR,\n APPEAR_CANCELLED,\n BEFORE_ENTER,\n BEFORE_LEAVE,\n ENTER,\n ENTER_CANCELLED,\n LEAVE,\n LEAVE_CANCELLED,\n] as const\n\n// Sometimes we want to delegate the transition emitted event\n// we have to right the function locally, which is not a good\n// approach to this, so we created this hook for the event\n// fallthrough\n\n/**\n * NOTE:\n * This is only a delegator for delegating transition callbacks.\n * Use this at your need.\n */\n\n/**\n * Simple usage\n *\n * In your setups:\n *\n * setup() {\n * const fallthroughMethods = useTransitionFallthrough()\n * return fallthrough\n * }\n *\n * In your template:\n *\n * <template>\n * <transition name=\"whatever\" v-bind=\"fallthrough\">\n * <slot />\n * </transition>\n * </template>\n *\n */\n\nexport const useTransitionFallthrough = () => {\n const { emit } = getCurrentInstance()!\n\n return {\n onAfterAppear: () => {\n emit(AFTER_APPEAR)\n },\n onAfterEnter: () => {\n emit(AFTER_ENTER)\n },\n onAfterLeave: () => {\n emit(AFTER_LEAVE)\n },\n onAppearCancelled: () => {\n emit(APPEAR_CANCELLED)\n },\n onBeforeEnter: () => {\n emit(BEFORE_ENTER)\n },\n onBeforeLeave: () => {\n emit(BEFORE_LEAVE)\n },\n onEnter: () => {\n emit(ENTER)\n },\n onEnterCancelled: () => {\n emit(ENTER_CANCELLED)\n },\n onLeave: () => {\n emit(LEAVE)\n },\n onLeaveCancelled: () => {\n emit(LEAVE_CANCELLED)\n },\n }\n}\n"],"names":[],"mappings":";;AACA,MAAM,YAAY,GAAG,cAAc,CAAC;AACpC,MAAM,WAAW,GAAG,aAAa,CAAC;AAClC,MAAM,WAAW,GAAG,aAAa,CAAC;AAClC,MAAM,MAAM,GAAG,QAAQ,CAAC;AACxB,MAAM,gBAAgB,GAAG,kBAAkB,CAAC;AAC5C,MAAM,YAAY,GAAG,cAAc,CAAC;AACpC,MAAM,YAAY,GAAG,cAAc,CAAC;AACpC,MAAM,KAAK,GAAG,OAAO,CAAC;AACtB,MAAM,eAAe,GAAG,iBAAiB,CAAC;AAC1C,MAAM,KAAK,GAAG,OAAO,CAAC;AACtB,MAAM,eAAe,GAAG,iBAAiB,CAAC;AAC9B,MAAC,6BAA6B,GAAG;AAC7C,EAAE,YAAY;AACd,EAAE,WAAW;AACb,EAAE,WAAW;AACb,EAAE,MAAM;AACR,EAAE,gBAAgB;AAClB,EAAE,YAAY;AACd,EAAE,YAAY;AACd,EAAE,KAAK;AACP,EAAE,eAAe;AACjB,EAAE,KAAK;AACP,EAAE,eAAe;AACjB,EAAE;AACU,MAAC,wBAAwB,GAAG,MAAM;AAC9C,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,kBAAkB,EAAE,CAAC;AACxC,EAAE,OAAO;AACT,IAAI,aAAa,EAAE,MAAM;AACzB,MAAM,IAAI,CAAC,YAAY,CAAC,CAAC;AACzB,K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