@plexui/vue 0.39.3 → 0.39.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/es/components/Transition/TransitionGroup.js +2 -1
- package/dist/es/components/Transition/TransitionGroup.js.map +1 -1
- package/dist/es/components/Transition/useTransitionChild.js +1 -1
- package/dist/es/components/Transition/useTransitionChild.js.map +1 -1
- package/dist/types/components/Transition/TransitionGroup.d.ts +4 -2
- package/package.json +1 -1
|
@@ -117,7 +117,8 @@ export const TransitionGroup = defineComponent({
|
|
|
117
117
|
disableAnimations: { type: Boolean, default: () => getDisableAnimations() },
|
|
118
118
|
/**
|
|
119
119
|
* For overlays: an exiting child is `inert`, out of the tab order and of hit
|
|
120
|
-
* testing, and with reduced motion it leaves without waiting for
|
|
120
|
+
* testing, and with reduced motion it settles and leaves without waiting for
|
|
121
|
+
* `enterDuration` or `exitDuration` (nothing moves, so nothing is held).
|
|
121
122
|
*/
|
|
122
123
|
overlay: Boolean,
|
|
123
124
|
/** Determines how new children are added to the children array */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TransitionGroup.js","sourceRoot":"","sources":["../../../../src/components/Transition/TransitionGroup.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAA;AACvB,OAAO,EACL,eAAe,EACf,CAAC,EACD,eAAe,EACf,eAAe,EACf,SAAS,EACT,GAAG,EACH,KAAK,GAIN,MAAM,KAAK,CAAA;AACZ,OAAO,oBAAoB,MAAM,2BAA2B,CAAA;AAC5D,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAE7E,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAC5D,OAAO,CAAC,MAAM,iEAAiE,CAAA;AAO/E,MAAM,YAAY,GAAG,QAAkD,CAAA;AAEvE,MAAM,yBAAyB,GAAG,eAAe,CAAC;IAChD,IAAI,EAAE,2B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C,CAC3C,CACF,CAAA;YACH,CAAC;YAED,OAAO,cAAc,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAClC,CAAC,CACC,oBAAoB,EACpB;gBACE,GAAG,EAAE,KAAK,CAAC,GAAG;gBACd,sBAAsB,EAAE,KAAK,CAAC,sBAAsB;gBACpD,eAAe,EAAE,KAAK,CAAC,eAAe;gBACtC,EAAE,EAAE,KAAK,CAAC,EAAE;gBACZ,SAAS;gBACT,YAAY,EAAE,KAAK,CAAC,YAAY;gBAChC,UAAU,EAAE,KAAK;gBACjB,YAAY,EAAE,KAAK,CAAC,YAAY;gBAChC,aAAa,EAAE,KAAK,CAAC,aAAa;gBAClC,YAAY,EAAE,KAAK,CAAC,YAAY;gBAChC,OAAO,EAAE,KAAK,CAAC,OAAO;gBACtB,WAAW,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC;gBAC7C,SAAS;aACV,EACD,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CACjC,CACF,CAAA;QACH,CAAC,CAAA;IACH,CAAC;CACF,CAAC,CAAA","sourcesContent":["import clsx from \"clsx\"\nimport {\n defineComponent,\n h,\n onBeforeUnmount,\n onErrorCaptured,\n onMounted,\n ref,\n watch,\n type PropType,\n type StyleValue,\n type VNode,\n} from \"vue\"\nimport getDisableAnimations from \"./getDisableAnimations.js\"\nimport { flattenChildren, isPlaceholder, useChildList } from \"./childList.js\"\nimport type { InsertMethod, TransitionGroupChildCallback, TransitionGroupChildCallbacks } from \"./shared.js\"\nimport { useTransitionChild } from \"./useTransitionChild.js\"\nimport s from \"@plexui/styles/components/Transition/TransitionGroup.module.css\"\n\n// Port of packages/ui/src/components/Transition/TransitionGroup.tsx. Same\n// wrappers, data attributes and timings, so the shared CSS animates both.\n\ntype Tag = \"div\" | \"span\"\n\nconst callbackProp = Function as PropType<TransitionGroupChildCallback>\n\nconst TransitionGroupChildInner = defineComponent({\n name: \"TransitionGroupChildInner\",\n props: {\n as: { type: String as PropType<Tag>, required: true },\n className: String,\n transitionId: String,\n styleValue: [String, Object, Array] as PropType<StyleValue>,\n preventMountTransition: Boolean,\n shouldRender: { type: Boolean, required: true },\n enterDuration: { type: Number, required: true },\n exitDuration: { type: Number, required: true },\n overlay: Boolean,\n removeChild: { type: Function as PropType<() => void>, required: true },\n callbacks: Object as PropType<TransitionGroupChildCallbacks>,\n },\n setup(props, { slots }) {\n const element = ref<HTMLElement | null>(null)\n const state = useTransitionChild(props, () => element.value)\n\n // An exiting child stays mounted with live slots, where React renders its\n // last element: state cleared along with the close must not throw here\n onErrorCaptured(() => (props.shouldRender ? undefined : false))\n\n return () =>\n h(\n props.as,\n {\n \"ref\": element,\n \"class\": clsx(props.className, s.TransitionGroupChild),\n \"data-transition-id\": props.transitionId,\n \"style\": props.styleValue,\n \"data-entering\": state.enter ? \"\" : undefined,\n \"data-entering-active\": state.enterActive ? \"\" : undefined,\n \"data-exiting\": state.exit ? \"\" : undefined,\n \"data-exiting-active\": state.exitActive ? \"\" : undefined,\n \"data-interrupted\": state.interrupted ? \"\" : undefined,\n \"inert\": props.overlay && state.exit ? \"\" : undefined,\n },\n slots.default?.(),\n )\n },\n})\n\n/**\n * Delays mounting a child by `enterMountDelay` ms, except on the initial\n * (prevented) mount. Like usehooks-ts' useTimeout, a changed delay restarts\n * the pending timer; removing the delay while pending leaves it unmounted.\n */\nexport const useMountDelay = (getProps: () => { preventMountTransition?: boolean; enterMountDelay?: number }) => {\n const delay = () => {\n const { preventMountTransition, enterMountDelay } = getProps()\n return !preventMountTransition && enterMountDelay != null ? enterMountDelay : null\n }\n const mounted = ref(delay() == null)\n let timeout: number | undefined\n\n onMounted(() => {\n watch(\n delay,\n (mountDelay) => {\n clearTimeout(timeout)\n if (!mounted.value && mountDelay != null) {\n timeout = window.setTimeout(() => (mounted.value = true), mountDelay)\n }\n },\n { immediate: true },\n )\n })\n onBeforeUnmount(() => clearTimeout(timeout))\n return mounted\n}\n\nconst TransitionGroupChild = defineComponent({\n name: \"TransitionGroupChild\",\n inheritAttrs: false,\n props: {\n preventMountTransition: Boolean,\n enterMountDelay: Number,\n },\n setup(props, { attrs, slots }) {\n const mounted = useMountDelay(() => props)\n return () =>\n mounted.value\n ? h(TransitionGroupChildInner, { ...attrs, preventMountTransition: props.preventMountTransition } as never, slots)\n : null\n },\n})\n\n// With `disableAnimations`, React wraps the children through `Children.map`,\n// which keys each wrapper by its child's key and a `false` child's wrapper by\n// its position. A reordered child moves with its wrapper (keeping its DOM and\n// state), and a `false` child turning into an element (or back) gets a new\n// wrapper. Placeholders take a symbol per position, which no child key can\n// equal.\nconst placeholderKeys: symbol[] = []\nconst wrapperKey = (vnode: VNode, index: number): PropertyKey => {\n if (!isPlaceholder(vnode)) return vnode.key!\n return (placeholderKeys[index] ??= Symbol(`placeholder-${index}`))\n}\n\n/**\n * Wraps each keyed child in a `<span>` (or `<div>`) that carries\n * `data-entering` / `data-exiting` state while it mounts and unmounts.\n *\n * A `false` slot child (a comment vnode) mirrors React's `Children.map`\n * over `false`: with `disableAnimations` it still renders an empty wrapper.\n * Leave the slot out entirely to render nothing.\n */\nexport const TransitionGroup = defineComponent({\n name: \"TransitionGroup\",\n inheritAttrs: false,\n props: {\n /** Determines the tag used by wrapping elements */\n as: { type: String as PropType<Tag>, default: \"span\" },\n /** Identifier passed to wrapping elements as `[data-transition-id]` */\n transitionId: String,\n /** Determines the amount of time that the enter state is applied during mounting */\n enterDuration: { type: Number, default: 0 },\n /** Determines the amount of time that the exit state is applied before unmounting */\n exitDuration: { type: Number, default: 0 },\n /** Determines if children should have an enter transition applied during mounting of the TransitionGroup. */\n preventInitialTransition: { type: Boolean, default: true },\n /** Delay in MS to wait before mounting a child. Unset for no delay (default). */\n enterMountDelay: Number,\n /** Render children changes immediately, bypassing transition timings */\n disableAnimations: { type: Boolean, default: () => getDisableAnimations() },\n /**\n * For overlays: an exiting child is `inert`, out of the tab order and of hit\n * testing, and with reduced motion it leaves without waiting for `exitDuration`.\n */\n overlay: Boolean,\n /** Determines how new children are added to the children array */\n insertMethod: { type: String as PropType<InsertMethod>, default: \"append\" },\n /** Called when an enter animation is staged (e.g., component mounted to the DOM) */\n onEnter: callbackProp,\n /** Called when an enter animation starts */\n onEnterActive: callbackProp,\n /** Called when an enter animation completes */\n onEnterComplete: callbackProp,\n /** Called when an exit animation is staged */\n onExit: callbackProp,\n /** Called when an exit animation starts */\n onExitActive: callbackProp,\n /** Called when an exit animation completes (e.g., component unmounted from the DOM) */\n onExitComplete: callbackProp,\n },\n setup(props, { slots, attrs }) {\n const children = useChildList(\"TransitionGroup\")\n // Read at call time, so callers can swap handlers between renders\n const callbacks: TransitionGroupChildCallbacks = {\n onEnter: (el) => props.onEnter?.(el),\n onEnterActive: (el) => props.onEnterActive?.(el),\n onEnterComplete: (el) => props.onEnterComplete?.(el),\n onExit: (el) => props.onExit?.(el),\n onExitActive: (el) => props.onExitActive?.(el),\n onExitComplete: (el) => props.onExitComplete?.(el),\n }\n\n return () => {\n const slotChildren: VNode[] = flattenChildren(slots.default?.() ?? [])\n const className = attrs.class as string | undefined\n const style = attrs.style as StyleValue | undefined\n const renderChildren = children.next(\n children.keyedChildren(slotChildren),\n props.insertMethod,\n props.preventInitialTransition,\n )\n\n if (props.disableAnimations) {\n return slotChildren.map((vnode, index) =>\n h(\n props.as,\n { \"key\": wrapperKey(vnode, index), \"class\": className, style, \"data-transition-id\": props.transitionId },\n isPlaceholder(vnode) ? undefined : [vnode],\n ),\n )\n }\n\n return renderChildren.map((child) =>\n h(\n TransitionGroupChild,\n {\n key: child.key,\n preventMountTransition: child.preventMountTransition,\n enterMountDelay: props.enterMountDelay,\n as: props.as,\n className,\n transitionId: props.transitionId,\n styleValue: style,\n shouldRender: child.shouldRender,\n enterDuration: props.enterDuration,\n exitDuration: props.exitDuration,\n overlay: props.overlay,\n removeChild: () => children.remove(child.key),\n callbacks,\n },\n { default: () => [child.vnode] },\n ),\n )\n }\n },\n})\n\nexport type TransitionGroupProps = InstanceType<typeof TransitionGroup>[\"$props\"]\n"]}
|
|
1
|
+
{"version":3,"file":"TransitionGroup.js","sourceRoot":"","sources":["../../../../src/components/Transition/TransitionGroup.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAA;AACvB,OAAO,EACL,eAAe,EACf,CAAC,EACD,eAAe,EACf,eAAe,EACf,SAAS,EACT,GAAG,EACH,KAAK,GAIN,MAAM,KAAK,CAAA;AACZ,OAAO,oBAAoB,MAAM,2BAA2B,CAAA;AAC5D,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAE7E,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAC5D,OAAO,CAAC,MAAM,iEAAiE,CAAA;AAO/E,MAAM,YAAY,GAAG,QAAkD,CAAA;AAEvE,MAAM,yBAAyB,GAAG,eAAe,CAAC;IAChD,IAAI,EAAE,2BAA2B;IACjC,KAAK,EAAE;QACL,EAAE,EAAE,EAAE,IAAI,EAAE,MAAuB,EAAE,QAAQ,EAAE,IAAI,EAAE;QACrD,SAAS,EAAE,MAAM;QACjB,YAAY,EAAE,MAAM;QACpB,UAAU,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,CAAyB;QAC3D,sBAAsB,EAAE,OAAO;QAC/B,YAAY,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE;QAC/C,aAAa,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE;QAC/C,YAAY,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE;QAC9C,OAAO,EAAE,OAAO;QAChB,WAAW,EAAE,EAAE,IAAI,EAAE,QAAgC,EAAE,QAAQ,EAAE,IAAI,EAAE;QACvE,SAAS,EAAE,MAAiD;KAC7D;IACD,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AS;aACV,EACD,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CACjC,CACF,CAAA;QACH,CAAC,CAAA;IACH,CAAC;CACF,CAAC,CAAA","sourcesContent":["import clsx from \"clsx\"\nimport {\n defineComponent,\n h,\n onBeforeUnmount,\n onErrorCaptured,\n onMounted,\n ref,\n watch,\n type PropType,\n type StyleValue,\n type VNode,\n} from \"vue\"\nimport getDisableAnimations from \"./getDisableAnimations.js\"\nimport { flattenChildren, isPlaceholder, useChildList } from \"./childList.js\"\nimport type { InsertMethod, TransitionGroupChildCallback, TransitionGroupChildCallbacks } from \"./shared.js\"\nimport { useTransitionChild } from \"./useTransitionChild.js\"\nimport s from \"@plexui/styles/components/Transition/TransitionGroup.module.css\"\n\n// Port of packages/ui/src/components/Transition/TransitionGroup.tsx. Same\n// wrappers, data attributes and timings, so the shared CSS animates both.\n\ntype Tag = \"div\" | \"span\"\n\nconst callbackProp = Function as PropType<TransitionGroupChildCallback>\n\nconst TransitionGroupChildInner = defineComponent({\n name: \"TransitionGroupChildInner\",\n props: {\n as: { type: String as PropType<Tag>, required: true },\n className: String,\n transitionId: String,\n styleValue: [String, Object, Array] as PropType<StyleValue>,\n preventMountTransition: Boolean,\n shouldRender: { type: Boolean, required: true },\n enterDuration: { type: Number, required: true },\n exitDuration: { type: Number, required: true },\n overlay: Boolean,\n removeChild: { type: Function as PropType<() => void>, required: true },\n callbacks: Object as PropType<TransitionGroupChildCallbacks>,\n },\n setup(props, { slots }) {\n const element = ref<HTMLElement | null>(null)\n const state = useTransitionChild(props, () => element.value)\n\n // An exiting child stays mounted with live slots, where React renders its\n // last element: state cleared along with the close must not throw here\n onErrorCaptured(() => (props.shouldRender ? undefined : false))\n\n return () =>\n h(\n props.as,\n {\n \"ref\": element,\n \"class\": clsx(props.className, s.TransitionGroupChild),\n \"data-transition-id\": props.transitionId,\n \"style\": props.styleValue,\n \"data-entering\": state.enter ? \"\" : undefined,\n \"data-entering-active\": state.enterActive ? \"\" : undefined,\n \"data-exiting\": state.exit ? \"\" : undefined,\n \"data-exiting-active\": state.exitActive ? \"\" : undefined,\n \"data-interrupted\": state.interrupted ? \"\" : undefined,\n \"inert\": props.overlay && state.exit ? \"\" : undefined,\n },\n slots.default?.(),\n )\n },\n})\n\n/**\n * Delays mounting a child by `enterMountDelay` ms, except on the initial\n * (prevented) mount. Like usehooks-ts' useTimeout, a changed delay restarts\n * the pending timer; removing the delay while pending leaves it unmounted.\n */\nexport const useMountDelay = (getProps: () => { preventMountTransition?: boolean; enterMountDelay?: number }) => {\n const delay = () => {\n const { preventMountTransition, enterMountDelay } = getProps()\n return !preventMountTransition && enterMountDelay != null ? enterMountDelay : null\n }\n const mounted = ref(delay() == null)\n let timeout: number | undefined\n\n onMounted(() => {\n watch(\n delay,\n (mountDelay) => {\n clearTimeout(timeout)\n if (!mounted.value && mountDelay != null) {\n timeout = window.setTimeout(() => (mounted.value = true), mountDelay)\n }\n },\n { immediate: true },\n )\n })\n onBeforeUnmount(() => clearTimeout(timeout))\n return mounted\n}\n\nconst TransitionGroupChild = defineComponent({\n name: \"TransitionGroupChild\",\n inheritAttrs: false,\n props: {\n preventMountTransition: Boolean,\n enterMountDelay: Number,\n },\n setup(props, { attrs, slots }) {\n const mounted = useMountDelay(() => props)\n return () =>\n mounted.value\n ? h(TransitionGroupChildInner, { ...attrs, preventMountTransition: props.preventMountTransition } as never, slots)\n : null\n },\n})\n\n// With `disableAnimations`, React wraps the children through `Children.map`,\n// which keys each wrapper by its child's key and a `false` child's wrapper by\n// its position. A reordered child moves with its wrapper (keeping its DOM and\n// state), and a `false` child turning into an element (or back) gets a new\n// wrapper. Placeholders take a symbol per position, which no child key can\n// equal.\nconst placeholderKeys: symbol[] = []\nconst wrapperKey = (vnode: VNode, index: number): PropertyKey => {\n if (!isPlaceholder(vnode)) return vnode.key!\n return (placeholderKeys[index] ??= Symbol(`placeholder-${index}`))\n}\n\n/**\n * Wraps each keyed child in a `<span>` (or `<div>`) that carries\n * `data-entering` / `data-exiting` state while it mounts and unmounts.\n *\n * A `false` slot child (a comment vnode) mirrors React's `Children.map`\n * over `false`: with `disableAnimations` it still renders an empty wrapper.\n * Leave the slot out entirely to render nothing.\n */\nexport const TransitionGroup = defineComponent({\n name: \"TransitionGroup\",\n inheritAttrs: false,\n props: {\n /** Determines the tag used by wrapping elements */\n as: { type: String as PropType<Tag>, default: \"span\" },\n /** Identifier passed to wrapping elements as `[data-transition-id]` */\n transitionId: String,\n /** Determines the amount of time that the enter state is applied during mounting */\n enterDuration: { type: Number, default: 0 },\n /** Determines the amount of time that the exit state is applied before unmounting */\n exitDuration: { type: Number, default: 0 },\n /** Determines if children should have an enter transition applied during mounting of the TransitionGroup. */\n preventInitialTransition: { type: Boolean, default: true },\n /** Delay in MS to wait before mounting a child. Unset for no delay (default). */\n enterMountDelay: Number,\n /** Render children changes immediately, bypassing transition timings */\n disableAnimations: { type: Boolean, default: () => getDisableAnimations() },\n /**\n * For overlays: an exiting child is `inert`, out of the tab order and of hit\n * testing, and with reduced motion it settles and leaves without waiting for\n * `enterDuration` or `exitDuration` (nothing moves, so nothing is held).\n */\n overlay: Boolean,\n /** Determines how new children are added to the children array */\n insertMethod: { type: String as PropType<InsertMethod>, default: \"append\" },\n /** Called when an enter animation is staged (e.g., component mounted to the DOM) */\n onEnter: callbackProp,\n /** Called when an enter animation starts */\n onEnterActive: callbackProp,\n /** Called when an enter animation completes */\n onEnterComplete: callbackProp,\n /** Called when an exit animation is staged */\n onExit: callbackProp,\n /** Called when an exit animation starts */\n onExitActive: callbackProp,\n /** Called when an exit animation completes (e.g., component unmounted from the DOM) */\n onExitComplete: callbackProp,\n },\n setup(props, { slots, attrs }) {\n const children = useChildList(\"TransitionGroup\")\n // Read at call time, so callers can swap handlers between renders\n const callbacks: TransitionGroupChildCallbacks = {\n onEnter: (el) => props.onEnter?.(el),\n onEnterActive: (el) => props.onEnterActive?.(el),\n onEnterComplete: (el) => props.onEnterComplete?.(el),\n onExit: (el) => props.onExit?.(el),\n onExitActive: (el) => props.onExitActive?.(el),\n onExitComplete: (el) => props.onExitComplete?.(el),\n }\n\n return () => {\n const slotChildren: VNode[] = flattenChildren(slots.default?.() ?? [])\n const className = attrs.class as string | undefined\n const style = attrs.style as StyleValue | undefined\n const renderChildren = children.next(\n children.keyedChildren(slotChildren),\n props.insertMethod,\n props.preventInitialTransition,\n )\n\n if (props.disableAnimations) {\n return slotChildren.map((vnode, index) =>\n h(\n props.as,\n { \"key\": wrapperKey(vnode, index), \"class\": className, style, \"data-transition-id\": props.transitionId },\n isPlaceholder(vnode) ? undefined : [vnode],\n ),\n )\n }\n\n return renderChildren.map((child) =>\n h(\n TransitionGroupChild,\n {\n key: child.key,\n preventMountTransition: child.preventMountTransition,\n enterMountDelay: props.enterMountDelay,\n as: props.as,\n className,\n transitionId: props.transitionId,\n styleValue: style,\n shouldRender: child.shouldRender,\n enterDuration: props.enterDuration,\n exitDuration: props.exitDuration,\n overlay: props.overlay,\n removeChild: () => children.remove(child.key),\n callbacks,\n },\n { default: () => [child.vnode] },\n ),\n )\n }\n },\n})\n\nexport type TransitionGroupProps = InstanceType<typeof TransitionGroup>[\"$props\"]\n"]}
|
|
@@ -69,7 +69,7 @@ export function useTransitionChild(props, getElement) {
|
|
|
69
69
|
enterTimeout = window.setTimeout(() => {
|
|
70
70
|
dispatch({ type: "done" });
|
|
71
71
|
trigger("enter-complete");
|
|
72
|
-
}, props.enterDuration);
|
|
72
|
+
}, props.overlay && prefersReducedMotion() ? 0 : props.enterDuration);
|
|
73
73
|
});
|
|
74
74
|
cancel = () => {
|
|
75
75
|
cancelFrame();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTransitionChild.js","sourceRoot":"","sources":["../../../../src/components/Transition/useTransitionChild.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,KAAK,CAAA;AACjE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,EAAE,CAAC,CAAA;QAClC,OAAO,CAAC,OAAO,CAAC,CAAA;QAChB,MAAM,WAAW,GAAG,qBAAqB,CAAC,GAAG,EAAE;YAC7C,QAAQ,CAAC,EAAE,IAAI,EAAE,cAAc,EAAE,CAAC,CAAA;YAClC,OAAO,CAAC,cAAc,CAAC,CAAA;YACvB,YAAY,GAAG,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE;gBACpC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAA;gBAC1B,OAAO,CAAC,gBAAgB,CAAC,CAAA;YAC3B,CAAC,EAAE,KAAK,CAAC,OAAO,IAAI,oBAAoB,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,aAAa,CAAC,CAAA;QACvE,CAAC,CAAC,CAAA;QACF,MAAM,GAAG,GAAG,EAAE;YACZ,WAAW,EAAE,CAAA;YACb,IAAI,YAAY,KAAK,SAAS;gBAAE,YAAY,CAAC,YAAY,CAAC,CAAA;QAC5D,CAAC,CAAA;IACH,CAAC,CAAA;IAED,SAAS,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,CAAA;IACxC,KAAK,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,YAAY,EAAE,GAAG,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAA;IACvD,eAAe,CAAC,GAAG,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,CAAA;IAEjC,OAAO,KAAK,CAAA;AACd,CAAC","sourcesContent":["import { onBeforeUnmount, onMounted, reactive, watch } from \"vue\"\nimport { prefersReducedMotion, waitForAnimationFrame } from \"../../lib/helpers.js\"\nimport type { CallbackType, TransitionElement, TransitionGroupChildCallbacks } from \"./shared.js\"\nimport { getInitialTransitionState, transitionReducer, type TransitionStateAction } from \"./transitionReducer.js\"\n\nexport type TransitionChildProps = {\n shouldRender: boolean\n preventMountTransition?: boolean\n enterDuration: number\n exitDuration: number\n overlay?: boolean\n removeChild: () => void\n callbacks?: TransitionGroupChildCallbacks\n}\n\nconst CALLBACKS: Record<CallbackType, keyof TransitionGroupChildCallbacks> = {\n \"enter\": \"onEnter\",\n \"enter-active\": \"onEnterActive\",\n \"enter-complete\": \"onEnterComplete\",\n \"exit\": \"onExit\",\n \"exit-active\": \"onExitActive\",\n \"exit-complete\": \"onExitComplete\",\n}\n\n/**\n * The per-child enter/exit state machine of React's TransitionGroupChild\n * (same reducer, frames and timers), shared by TransitionGroup and\n * SlotTransitionGroup. Returns the reactive state that drives the\n * `data-entering*` / `data-exiting*` / `data-interrupted` attributes.\n */\nexport function useTransitionChild(props: TransitionChildProps, getElement: () => TransitionElement | null) {\n const state = reactive(getInitialTransitionState(!!props.preventMountTransition))\n const dispatch = (action: TransitionStateAction) => {\n Object.assign(state, transitionReducer(state, action))\n }\n\n let lastCallback: CallbackType | null = null\n const trigger = (type: CallbackType) => {\n const element = getElement()\n if (!element || type === lastCallback) return\n lastCallback = type\n props.callbacks?.[CALLBACKS[type]]?.(element)\n }\n\n // Allow a child to prevent mount transition, but still experience\n // future enter transition events, when applicable.\n let preventedMountTransition = false\n let cancel: (() => void) | undefined\n\n const run = (shouldRender: boolean) => {\n cancel?.()\n cancel = undefined\n\n // Exit transition\n if (!shouldRender) {\n let exitTimeout: number | undefined\n dispatch({ type: \"exit-before\" })\n trigger(\"exit\")\n const cancelFrame = waitForAnimationFrame(() => {\n dispatch({ type: \"exit-active\" })\n trigger(\"exit-active\")\n exitTimeout = window.setTimeout(\n () => {\n trigger(\"exit-complete\")\n props.removeChild()\n },\n props.overlay && prefersReducedMotion() ? 0 : props.exitDuration,\n )\n })\n cancel = () => {\n cancelFrame()\n if (exitTimeout !== undefined) clearTimeout(exitTimeout)\n }\n return\n }\n\n // Enter transition: check if we need to prevent this specific entering cycle\n if (props.preventMountTransition && !preventedMountTransition) {\n preventedMountTransition = true\n return\n }\n\n let enterTimeout: number | undefined\n dispatch({ type: \"enter-before\" })\n trigger(\"enter\")\n const cancelFrame = waitForAnimationFrame(() => {\n dispatch({ type: \"enter-active\" })\n trigger(\"enter-active\")\n enterTimeout = window.setTimeout(() => {\n dispatch({ type: \"done\" })\n trigger(\"enter-complete\")\n }, props.overlay && prefersReducedMotion() ? 0 : props.enterDuration)\n })\n cancel = () => {\n cancelFrame()\n if (enterTimeout !== undefined) clearTimeout(enterTimeout)\n }\n }\n\n onMounted(() => run(props.shouldRender))\n watch(() => props.shouldRender, run, { flush: \"post\" })\n onBeforeUnmount(() => cancel?.())\n\n return state\n}\n"]}
|
|
@@ -50,7 +50,8 @@ export declare const TransitionGroup: import("vue").DefineComponent<import("vue"
|
|
|
50
50
|
};
|
|
51
51
|
/**
|
|
52
52
|
* For overlays: an exiting child is `inert`, out of the tab order and of hit
|
|
53
|
-
* testing, and with reduced motion it leaves without waiting for
|
|
53
|
+
* testing, and with reduced motion it settles and leaves without waiting for
|
|
54
|
+
* `enterDuration` or `exitDuration` (nothing moves, so nothing is held).
|
|
54
55
|
*/
|
|
55
56
|
overlay: BooleanConstructor;
|
|
56
57
|
/** Determines how new children are added to the children array */
|
|
@@ -104,7 +105,8 @@ export declare const TransitionGroup: import("vue").DefineComponent<import("vue"
|
|
|
104
105
|
};
|
|
105
106
|
/**
|
|
106
107
|
* For overlays: an exiting child is `inert`, out of the tab order and of hit
|
|
107
|
-
* testing, and with reduced motion it leaves without waiting for
|
|
108
|
+
* testing, and with reduced motion it settles and leaves without waiting for
|
|
109
|
+
* `enterDuration` or `exitDuration` (nothing moves, so nothing is held).
|
|
108
110
|
*/
|
|
109
111
|
overlay: BooleanConstructor;
|
|
110
112
|
/** Determines how new children are added to the children array */
|