@plexui/vue 0.39.4 → 0.39.5

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.
@@ -1,5 +1,6 @@
1
1
  import clsx from "clsx";
2
2
  import { defineComponent, h, onBeforeUnmount, onErrorCaptured, onMounted, ref, watch, } from "vue";
3
+ import { prefersReducedMotion } from "../../lib/helpers.js";
3
4
  import getDisableAnimations from "./getDisableAnimations.js";
4
5
  import { flattenChildren, isPlaceholder, useChildList } from "./childList.js";
5
6
  import { useTransitionChild } from "./useTransitionChild.js";
@@ -107,6 +108,11 @@ export const TransitionGroup = defineComponent({
107
108
  transitionId: String,
108
109
  /** Determines the amount of time that the enter state is applied during mounting */
109
110
  enterDuration: { type: Number, default: 0 },
111
+ /**
112
+ * The enter time with reduced motion, in place of `enterDuration`: for an overlay
113
+ * whose styles fade it in over a time of its own then (a Dialog, a Menu).
114
+ */
115
+ reducedMotionEnterDuration: Number,
110
116
  /** Determines the amount of time that the exit state is applied before unmounting */
111
117
  exitDuration: { type: Number, default: 0 },
112
118
  /** Determines if children should have an enter transition applied during mounting of the TransitionGroup. */
@@ -117,8 +123,8 @@ export const TransitionGroup = defineComponent({
117
123
  disableAnimations: { type: Boolean, default: () => getDisableAnimations() },
118
124
  /**
119
125
  * For overlays: an exiting child is `inert`, out of the tab order and of hit
120
- * testing, and with reduced motion it settles and leaves without waiting for
121
- * `enterDuration` or `exitDuration` (nothing moves, so nothing is held).
126
+ * testing, and with reduced motion it leaves without waiting for `exitDuration`. It
127
+ * still waits out `enterDuration`: with reduced motion an overlay fades in over it.
122
128
  */
123
129
  overlay: Boolean,
124
130
  /** Determines how new children are added to the children array */
@@ -164,7 +170,9 @@ export const TransitionGroup = defineComponent({
164
170
  transitionId: props.transitionId,
165
171
  styleValue: style,
166
172
  shouldRender: child.shouldRender,
167
- enterDuration: props.enterDuration,
173
+ enterDuration: props.reducedMotionEnterDuration !== undefined && prefersReducedMotion()
174
+ ? props.reducedMotionEnterDuration
175
+ : props.enterDuration,
168
176
  exitDuration: props.exitDuration,
169
177
  overlay: props.overlay,
170
178
  removeChild: () => children.remove(child.key),
@@ -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,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,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G,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 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"]}
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,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAA;AAC3D,OAAO,oBAAoB,MAAM,2BAA2B,CAAA;AAC5D,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAE7E,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAA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,KAAK,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,oBAAoB,EAAE,KAAK,CAAC,YAAY,EAAE,EACxG,aAAa,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,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,EACX,KAAK,CAAC,0BAA0B,KAAK,SAAS,IAAI,oBAAoB,EAAE;oBACtE,CAAC,CAAC,KAAK,CAAC,0BAA0B;oBAClC,CAAC,CAAC,KAAK,CAAC,aAAa;gBACzB,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 { prefersReducedMotion } from \"../../lib/helpers.js\"\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 /**\n * The enter time with reduced motion, in place of `enterDuration`: for an overlay\n * whose styles fade it in over a time of its own then (a Dialog, a Menu).\n */\n reducedMotionEnterDuration: Number,\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`. It\n * still waits out `enterDuration`: with reduced motion an overlay fades in over it.\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:\n props.reducedMotionEnterDuration !== undefined && prefersReducedMotion()\n ? props.reducedMotionEnterDuration\n : 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"]}
@@ -6,6 +6,12 @@ export const overlayTiming = { enterDuration: 250, exitDuration: 150 };
6
6
  export const overlayTimingLarge = { enterDuration: 300, exitDuration: 200 };
7
7
  /** A submenu: it opens after a hover delay of its own, so it shows at once */
8
8
  export const overlayTimingQuick = { enterDuration: 100, exitDuration: 100 };
9
+ /**
10
+ * With reduced motion a Dialog and a Menu fade in place, as on iOS with Reduce Motion (measured on the iOS 27.2
11
+ * simulator: a sheet about 350 ms, a menu about 500 ms), and stay entering, holding touches, for the whole fade. These
12
+ * match --motion-reduced-enter-dialog and --motion-reduced-enter-menu.
13
+ */
14
+ export const reducedMotionEnter = { dialog: 350, menu: 500 };
9
15
  /**
10
16
  * An overlay stays a dismissable layer through its exit. A press on its trigger
11
17
  * turns it around, and the layer must not count that press as outside and
@@ -1 +1 @@
1
- {"version":3,"file":"shared.js","sourceRoot":"","sources":["../../../../src/components/Transition/shared.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,mDAAmD;AAuDnD,uDAAuD;AACvD,MAAM,CAAC,MAAM,aAAa,GAAG,EAAE,aAAa,EAAE,GAAG,EAAE,YAAY,EAAE,GAAG,EAAE,CAAA;AACtE,+DAA+D;AAC/D,MAAM,CAAC,MAAM,kBAAkB,GAAG,EAAE,aAAa,EAAE,GAAG,EAAE,YAAY,EAAE,GAAG,EAAE,CAAA;AAC3E,8EAA8E;AAC9E,MAAM,CAAC,MAAM,kBAAkB,GAAG,EAAE,aAAa,EAAE,GAAG,EAAE,YAAY,EAAE,GAAG,EAAE,CAAA;AAE3E;;;;;GAKG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,GAAG,EAAE;IAClC,IAAI,OAAO,GAAG,KAAK,CAAA;IACnB,OAAO;QACL,UAAU,EAAE;YACV,MAAM,EAAE,GAAG,EAAE;gBACX,OAAO,GAAG,IAAI,CAAA;YAChB,CAAC;YACD,aAAa,EAAE,GAAG,EAAE;gBAClB,OAAO,GAAG,KAAK,CAAA;YACjB,CAAC;YACD,cAAc,EAAE,GAAG,EAAE;gBACnB,OAAO,GAAG,KAAK,CAAA;YACjB,CAAC;SACF;QACD,iBAAiB,EAAE,CAAC,KAAY,EAAE,EAAE;YAClC,IAAI,OAAO;gBAAE,KAAK,CAAC,cAAc,EAAE,CAAA;QACrC,CAAC;KACF,CAAA;AACH,CAAC,CAAA","sourcesContent":["// Types and helpers shared by the Vue transition components. Mirrors\n// packages/ui/src/components/Transition/shared.ts.\n\nexport type TransitionDefinition = {\n opacity?: number\n /** The horizontal translation value in pixels */\n x?: number\n /** The horizontal vertical value in pixels */\n y?: number\n /** The opacity value ranging from 0 to 1. */\n scale?: number\n rotate?: number | string\n skewX?: number | string\n skewY?: number | string\n blur?: number\n duration?: number\n delay?: number\n timingFunction?: string\n}\n\nexport type InitialTransitionDefinition = Omit<\n TransitionDefinition,\n \"duration\" | \"delay\" | \"timingFunction\"\n>\n\nexport type LayoutTransitionDefinition = {\n duration?: number\n delay?: number\n timingFunction?: string\n}\n\nexport type CallbackType =\n | \"enter\"\n | \"enter-active\"\n | \"enter-complete\"\n | \"exit\"\n | \"exit-active\"\n | \"exit-complete\"\n\n/** The element a transition callback receives (HTML or SVG) */\nexport type TransitionElement = HTMLElement | SVGElement\n\nexport type TransitionGroupChildCallback = (element: TransitionElement) => void\n\n/** Lifecycle hooks, called with the transitioning element (same moments as React's `onEnter`...). */\nexport type TransitionGroupChildCallbacks = {\n onEnter?: TransitionGroupChildCallback\n onEnterActive?: TransitionGroupChildCallback\n onEnterComplete?: TransitionGroupChildCallback\n onExit?: TransitionGroupChildCallback\n onExitActive?: TransitionGroupChildCallback\n onExitComplete?: TransitionGroupChildCallback\n}\n\nexport type InsertMethod = \"append\" | \"prepend\"\n\n// Overlay timers, in step with the `--motion-*` tokens\nexport const overlayTiming = { enterDuration: 250, exitDuration: 150 }\n/** A panel that crosses the screen: a sheet or a side panel */\nexport const overlayTimingLarge = { enterDuration: 300, exitDuration: 200 }\n/** A submenu: it opens after a hover delay of its own, so it shows at once */\nexport const overlayTimingQuick = { enterDuration: 100, exitDuration: 100 }\n\n/**\n * An overlay stays a dismissable layer through its exit. A press on its trigger\n * turns it around, and the layer must not count that press as outside and\n * close it again: pass `transition` to the TransitionGroup and\n * `onInteractOutside` to the layer.\n */\nexport const createExitGuard = () => {\n let exiting = false\n return {\n transition: {\n onExit: () => {\n exiting = true\n },\n onEnterActive: () => {\n exiting = false\n },\n onExitComplete: () => {\n exiting = false\n },\n },\n onInteractOutside: (event: Event) => {\n if (exiting) event.preventDefault()\n },\n }\n}\n"]}
1
+ {"version":3,"file":"shared.js","sourceRoot":"","sources":["../../../../src/components/Transition/shared.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,mDAAmD;AAuDnD,uDAAuD;AACvD,MAAM,CAAC,MAAM,aAAa,GAAG,EAAE,aAAa,EAAE,GAAG,EAAE,YAAY,EAAE,GAAG,EAAE,CAAA;AACtE,+DAA+D;AAC/D,MAAM,CAAC,MAAM,kBAAkB,GAAG,EAAE,aAAa,EAAE,GAAG,EAAE,YAAY,EAAE,GAAG,EAAE,CAAA;AAC3E,8EAA8E;AAC9E,MAAM,CAAC,MAAM,kBAAkB,GAAG,EAAE,aAAa,EAAE,GAAG,EAAE,YAAY,EAAE,GAAG,EAAE,CAAA;AAC3E;;;;GAIG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,CAAA;AAE5D;;;;;GAKG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,GAAG,EAAE;IAClC,IAAI,OAAO,GAAG,KAAK,CAAA;IACnB,OAAO;QACL,UAAU,EAAE;YACV,MAAM,EAAE,GAAG,EAAE;gBACX,OAAO,GAAG,IAAI,CAAA;YAChB,CAAC;YACD,aAAa,EAAE,GAAG,EAAE;gBAClB,OAAO,GAAG,KAAK,CAAA;YACjB,CAAC;YACD,cAAc,EAAE,GAAG,EAAE;gBACnB,OAAO,GAAG,KAAK,CAAA;YACjB,CAAC;SACF;QACD,iBAAiB,EAAE,CAAC,KAAY,EAAE,EAAE;YAClC,IAAI,OAAO;gBAAE,KAAK,CAAC,cAAc,EAAE,CAAA;QACrC,CAAC;KACF,CAAA;AACH,CAAC,CAAA","sourcesContent":["// Types and helpers shared by the Vue transition components. Mirrors\n// packages/ui/src/components/Transition/shared.ts.\n\nexport type TransitionDefinition = {\n opacity?: number\n /** The horizontal translation value in pixels */\n x?: number\n /** The horizontal vertical value in pixels */\n y?: number\n /** The opacity value ranging from 0 to 1. */\n scale?: number\n rotate?: number | string\n skewX?: number | string\n skewY?: number | string\n blur?: number\n duration?: number\n delay?: number\n timingFunction?: string\n}\n\nexport type InitialTransitionDefinition = Omit<\n TransitionDefinition,\n \"duration\" | \"delay\" | \"timingFunction\"\n>\n\nexport type LayoutTransitionDefinition = {\n duration?: number\n delay?: number\n timingFunction?: string\n}\n\nexport type CallbackType =\n | \"enter\"\n | \"enter-active\"\n | \"enter-complete\"\n | \"exit\"\n | \"exit-active\"\n | \"exit-complete\"\n\n/** The element a transition callback receives (HTML or SVG) */\nexport type TransitionElement = HTMLElement | SVGElement\n\nexport type TransitionGroupChildCallback = (element: TransitionElement) => void\n\n/** Lifecycle hooks, called with the transitioning element (same moments as React's `onEnter`...). */\nexport type TransitionGroupChildCallbacks = {\n onEnter?: TransitionGroupChildCallback\n onEnterActive?: TransitionGroupChildCallback\n onEnterComplete?: TransitionGroupChildCallback\n onExit?: TransitionGroupChildCallback\n onExitActive?: TransitionGroupChildCallback\n onExitComplete?: TransitionGroupChildCallback\n}\n\nexport type InsertMethod = \"append\" | \"prepend\"\n\n// Overlay timers, in step with the `--motion-*` tokens\nexport const overlayTiming = { enterDuration: 250, exitDuration: 150 }\n/** A panel that crosses the screen: a sheet or a side panel */\nexport const overlayTimingLarge = { enterDuration: 300, exitDuration: 200 }\n/** A submenu: it opens after a hover delay of its own, so it shows at once */\nexport const overlayTimingQuick = { enterDuration: 100, exitDuration: 100 }\n/**\n * With reduced motion a Dialog and a Menu fade in place, as on iOS with Reduce Motion (measured on the iOS 27.2\n * simulator: a sheet about 350 ms, a menu about 500 ms), and stay entering, holding touches, for the whole fade. These\n * match --motion-reduced-enter-dialog and --motion-reduced-enter-menu.\n */\nexport const reducedMotionEnter = { dialog: 350, menu: 500 }\n\n/**\n * An overlay stays a dismissable layer through its exit. A press on its trigger\n * turns it around, and the layer must not count that press as outside and\n * close it again: pass `transition` to the TransitionGroup and\n * `onInteractOutside` to the layer.\n */\nexport const createExitGuard = () => {\n let exiting = false\n return {\n transition: {\n onExit: () => {\n exiting = true\n },\n onEnterActive: () => {\n exiting = false\n },\n onExitComplete: () => {\n exiting = false\n },\n },\n onInteractOutside: (event: Event) => {\n if (exiting) event.preventDefault()\n },\n }\n}\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.overlay && prefersReducedMotion() ? 0 : props.enterDuration);
72
+ }, 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,OAAO,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAA;AAElF,OAAO,EAAE,yBAAyB,EAAE,iBAAiB,EAA8B,MAAM,wBAAwB,CAAA;AAYjH,MAAM,SAAS,GAA8D;IAC3E,OAAO,EAAE,SAAS;IAClB,cAAc,EAAE,eAAe;IAC/B,gBAAgB,EAAE,iBAAiB;IACnC,MAAM,EAAE,QAAQ;IAChB,aAAa,EAAE,cAAc;IAC7B,eAAe,EAAE,gBAAgB;CAClC,CAAA;AAED;;;;;GAKG;AACH,MAAM,UAAU,kBAAkB,CAAC,KAA2B,EAAE,UAA0C;IACxG,MAAM,KAAK,GAAG,QAAQ,CAAC,yBAAyB,CAAC,CAAC,CAAC,KAAK,CAAC,sBAAsB,CAAC,CAAC,CAAA;IACjF,MAAM,QAAQ,GAAG,CAAC,MAA6B,EAAE,EAAE;QACjD,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,iBAAiB,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,CAAA;IACxD,CAAC,CAAA;IAED,IAAI,YAAY,GAAwB,IAAI,CAAA;IAC5C,MAAM,OAAO,GAAG,CAAC,IAAkB,EAAE,EAAE;QACrC,MAAM,OAAO,GAAG,UAAU,EAAE,CAAA;QAC5B,IAAI,CAAC,OAAO,IAAI,IAAI,KAAK,YAAY;YAAE,OAAM;QAC7C,YAAY,GAAG,IAAI,CAAA;QACnB,KAAK,CAAC,SAAS,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,OAAO,CAA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AAC,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"]}
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,OAAO,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAA;AAElF,OAAO,EAAE,yBAAyB,EAAE,iBAAiB,EAA8B,MAAM,wBAAwB,CAAA;AAYjH,MAAM,SAAS,GAA8D;IAC3E,OAAO,EAAE,SAAS;IAClB,cAAc,EAAE,eAAe;IAC/B,gBAAgB,EAAE,iBAAiB;IACnC,MAAM,EAAE,QAAQ;IAChB,aAAa,EAAE,cAAc;IAC7B,eAAe,EAAE,gBAAgB;CAClC,CAAA;AAED;;;;;GAKG;AACH,MAAM,UAAU,kBAAkB,CAAC,KAA2B,EAAE,UAA0C;IACxG,MAAM,KAAK,GAAG,QAAQ,CAAC,yBAAyB,CAAC,CAAC,CAAC,KAAK,CAAC,sBAAsB,CAAC,CAAC,CAAA;IACjF,MAAM,QAAQ,GAAG,CAAC,MAA6B,EAAE,EAAE;QACjD,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,iBAAiB,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,CAAA;IACxD,CAAC,CAAA;IAED,IAAI,YAAY,GAAwB,IAAI,CAAA;IAC5C,MAAM,OAAO,GAAG,CA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ACR,CAAC;QAED,6EAA6E;QAC7E,IAAI,KAAK,CAAC,sBAAsB,IAAI,CAAC,wBAAwB,EAAE,CAAC;YAC9D,wBAAwB,GAAG,IAAI,CAAA;YAC/B,OAAM;QACR,CAAC;QAED,IAAI,YAAgC,CAAA;QACpC,QAAQ,CAAC,EAAE,IAAI,EAAE,cAAc,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,aAAa,CAAC,CAAA;QACzB,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.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"]}
@@ -31,6 +31,11 @@ export declare const TransitionGroup: import("vue").DefineComponent<import("vue"
31
31
  type: NumberConstructor;
32
32
  default: number;
33
33
  };
34
+ /**
35
+ * The enter time with reduced motion, in place of `enterDuration`: for an overlay
36
+ * whose styles fade it in over a time of its own then (a Dialog, a Menu).
37
+ */
38
+ reducedMotionEnterDuration: NumberConstructor;
34
39
  /** Determines the amount of time that the exit state is applied before unmounting */
35
40
  exitDuration: {
36
41
  type: NumberConstructor;
@@ -50,8 +55,8 @@ export declare const TransitionGroup: import("vue").DefineComponent<import("vue"
50
55
  };
51
56
  /**
52
57
  * For overlays: an exiting child is `inert`, out of the tab order and of hit
53
- * testing, and with reduced motion it settles and leaves without waiting for
54
- * `enterDuration` or `exitDuration` (nothing moves, so nothing is held).
58
+ * testing, and with reduced motion it leaves without waiting for `exitDuration`. It
59
+ * still waits out `enterDuration`: with reduced motion an overlay fades in over it.
55
60
  */
56
61
  overlay: BooleanConstructor;
57
62
  /** Determines how new children are added to the children array */
@@ -86,6 +91,11 @@ export declare const TransitionGroup: import("vue").DefineComponent<import("vue"
86
91
  type: NumberConstructor;
87
92
  default: number;
88
93
  };
94
+ /**
95
+ * The enter time with reduced motion, in place of `enterDuration`: for an overlay
96
+ * whose styles fade it in over a time of its own then (a Dialog, a Menu).
97
+ */
98
+ reducedMotionEnterDuration: NumberConstructor;
89
99
  /** Determines the amount of time that the exit state is applied before unmounting */
90
100
  exitDuration: {
91
101
  type: NumberConstructor;
@@ -105,8 +115,8 @@ export declare const TransitionGroup: import("vue").DefineComponent<import("vue"
105
115
  };
106
116
  /**
107
117
  * For overlays: an exiting child is `inert`, out of the tab order and of hit
108
- * testing, and with reduced motion it settles and leaves without waiting for
109
- * `enterDuration` or `exitDuration` (nothing moves, so nothing is held).
118
+ * testing, and with reduced motion it leaves without waiting for `exitDuration`. It
119
+ * still waits out `enterDuration`: with reduced motion an overlay fades in over it.
110
120
  */
111
121
  overlay: BooleanConstructor;
112
122
  /** Determines how new children are added to the children array */
@@ -48,6 +48,15 @@ export declare const overlayTimingQuick: {
48
48
  enterDuration: number;
49
49
  exitDuration: number;
50
50
  };
51
+ /**
52
+ * With reduced motion a Dialog and a Menu fade in place, as on iOS with Reduce Motion (measured on the iOS 27.2
53
+ * simulator: a sheet about 350 ms, a menu about 500 ms), and stay entering, holding touches, for the whole fade. These
54
+ * match --motion-reduced-enter-dialog and --motion-reduced-enter-menu.
55
+ */
56
+ export declare const reducedMotionEnter: {
57
+ dialog: number;
58
+ menu: number;
59
+ };
51
60
  /**
52
61
  * An overlay stays a dismissable layer through its exit. A press on its trigger
53
62
  * turns it around, and the layer must not count that press as outside and
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plexui/vue",
3
- "version": "0.39.4",
3
+ "version": "0.39.5",
4
4
  "description": "Plex UI components for Vue 3, built on Reka UI and the shared @plexui/styles CSS",
5
5
  "type": "module",
6
6
  "license": "MIT",