{"version":3,"sources":["../src/config/index.ts","../src/utils/index.ts"],"sourcesContent":["import { addClass, removeClass } from '@primeuix/utils';\nimport type { MotionClassNamesWithPhase, MotionHooksWithPhase, MotionInstance, MotionOptions, MotionPhase, MotionType } from '../../types';\nimport { getMotionHooks, getMotionMetadata, mergeOptions, removeMotionPhase, removeMotionState, resolveClassNames, resolveDuration, setAutoDimensionVariables, setMotionPhase, setMotionState, shouldSkipMotion } from '../utils';\n\nexport const DEFAULT_MOTION_OPTIONS: MotionOptions = {\n    name: 'p',\n    safe: true,\n    disabled: false,\n    enter: true,\n    leave: true,\n    autoHeight: true,\n    autoWidth: false\n};\n\n/**\n * Creates a MotionInstance for the given element with the specified options.\n * @param element - The target element for motion effects.\n * @param options - Configuration options for the motion instance.\n * @returns A MotionInstance that can be used to control the motion.\n */\nexport function createMotion(element: Element, options?: MotionOptions): MotionInstance {\n    if (!element) throw new Error('Element is required.');\n\n    const opts: MotionOptions = {};\n    let skipMotion = false;\n    let classNames: MotionClassNamesWithPhase = {} as MotionClassNamesWithPhase;\n    let cancelCurrent: (() => void) | null = null;\n    let hooks: MotionHooksWithPhase = {};\n\n    const init = (newOpts?: MotionOptions) => {\n        Object.assign(opts, mergeOptions(newOpts, DEFAULT_MOTION_OPTIONS));\n        if (!opts.enter && !opts.leave) throw new Error('Enter or leave must be true.');\n\n        hooks = getMotionHooks(opts);\n        skipMotion = shouldSkipMotion(opts);\n        classNames = resolveClassNames(opts);\n        cancelCurrent = null;\n    };\n\n    const run = async (phase: MotionPhase): Promise<void> => {\n        cancelCurrent?.();\n\n        const { onBefore, onStart, onAfter, onCancelled } = hooks[phase] || {};\n        const event = { element };\n\n        setMotionPhase(element as HTMLElement, phase);\n\n        if (skipMotion) {\n            onBefore?.(event);\n            onStart?.(event);\n            onAfter?.(event);\n\n            removeMotionPhase(element as HTMLElement);\n\n            return;\n        }\n\n        const { from: fromClass, active: activeClass, to: toClass } = classNames[phase] || {};\n\n        setAutoDimensionVariables(element as HTMLElement, opts.autoHeight, opts.autoWidth);\n\n        onBefore?.(event);\n        addClass(element, fromClass);\n        addClass(element, activeClass);\n        setMotionState(element as HTMLElement, phase, 'from');\n\n        //await nextFrame();\n        void (element as HTMLElement).offsetHeight; // force reflow\n\n        removeClass(element, fromClass);\n        addClass(element, toClass);\n        setMotionState(element as HTMLElement, phase, 'to');\n        onStart?.(event);\n\n        return new Promise((resolve) => {\n            const duration = resolveDuration(opts.duration, phase);\n\n            const cleanup = () => {\n                removeClass(element, [toClass, activeClass]);\n                cancelCurrent = null;\n                removeMotionState(element as HTMLElement);\n                removeMotionPhase(element as HTMLElement);\n            };\n\n            const onDone = () => {\n                cleanup();\n                onAfter?.(event);\n                resolve();\n            };\n\n            cancelCurrent = () => {\n                cleanup();\n                onCancelled?.(event);\n                resolve();\n            };\n\n            whenEnd(element, opts.type, duration, onDone);\n        });\n    };\n\n    init(options);\n\n    const instance: MotionInstance = {\n        enter: () => {\n            if (!opts.enter) return Promise.resolve();\n\n            return run('enter');\n        },\n        leave: () => {\n            if (!opts.leave) return Promise.resolve();\n\n            return run('leave');\n        },\n        cancel: () => {\n            cancelCurrent?.();\n            cancelCurrent = null;\n        },\n        update: (newElement?: Element, newOptions?: MotionOptions) => {\n            if (!newElement) throw new Error('Element is required.');\n\n            element = newElement as HTMLElement;\n            instance.cancel();\n            init(newOptions);\n        }\n    };\n\n    if (opts.appear) instance.enter();\n\n    return instance;\n}\n\nlet endId = 0;\n\n/**\n * Ported from Vue.js Transition Component;\n * @see https://github.com/vuejs/core/blob/main/packages/runtime-dom/src/components/Transition.ts#L348\n *\n * When the transition is triggered, it waits for the end of the motion (transition or animation)\n * @param element - The element to wait for the motion end.\n * @param expectedType - The expected type of motion (transition or animation).\n * @param explicitTimeout - An optional explicit timeout in milliseconds.\n * @param resolve - A function to call when the motion ends.\n * @returns A timeout ID if an explicit timeout is provided, otherwise undefined.\n */\nfunction whenEnd(element: Element & { _motionEndId?: number }, expectedType: MotionType | undefined, explicitTimeout: number | null, resolve: () => void) {\n    const id = (element._motionEndId = ++endId);\n\n    const resolveIfNotStale = () => {\n        if (id === element._motionEndId) {\n            resolve();\n        }\n    };\n\n    if (explicitTimeout != null) {\n        return setTimeout(resolveIfNotStale, explicitTimeout);\n    }\n\n    const { type, timeout, count } = getMotionMetadata(element, expectedType);\n\n    if (!type) {\n        resolve();\n\n        return;\n    }\n\n    const endEvent = type + 'end';\n    let ended = 0;\n\n    const end = () => {\n        element.removeEventListener(endEvent, onEnd, true);\n        resolveIfNotStale();\n    };\n\n    const onEnd = (event: Event) => {\n        if (event.target === element && ++ended >= count) {\n            end();\n        }\n    };\n\n    element.addEventListener(endEvent, onEnd, { capture: true, once: true });\n    setTimeout(() => {\n        if (ended < count) {\n            end();\n        }\n    }, timeout + 1);\n}\n","import { getHiddenElementDimensions, isPrefersReducedMotion, setCSSProperty, toMs } from '@primeuix/utils';\nimport type { MotionClassNamesWithPhase, MotionHooksWithPhase, MotionMetadata, MotionOptions, MotionPhase, MotionState, MotionType } from '../../types';\n\nexport const ANIMATION = 'animation';\nexport const TRANSITION = 'transition';\n\n/**\n * Determines whether motion effects should be skipped based on the provided options.\n * @param options - The motion options to evaluate.\n * @returns A boolean indicating whether motion should be skipped.\n */\nexport function shouldSkipMotion(options: MotionOptions | undefined): boolean {\n    if (!options) {\n        return false;\n    }\n\n    return options.disabled || !!(options.safe && isPrefersReducedMotion());\n}\n\n/**\n * Merges the provided motion options with the default options.\n * @param inOptions - The motion options to merge.\n * @param defaultOptions - The default motion options.\n * @returns The merged motion options.\n */\nexport function mergeOptions(inOptions: MotionOptions | undefined, defaultOptions: MotionOptions): MotionOptions {\n    if (!inOptions) {\n        return defaultOptions;\n    }\n\n    return {\n        ...inOptions,\n        ...(Object.entries(defaultOptions).reduce((acc: Record<string, unknown>, [key, value]) => {\n            acc[key] = (inOptions as Record<string, unknown>)[key] ?? value;\n\n            return acc;\n        }, {}) as MotionOptions)\n    };\n}\n\n/**\n * Resolves class names for motion phases based on the provided options.\n * @param options - The motion options containing class names and base name.\n * @returns The resolved class names organized by motion phase.\n */\nexport function resolveClassNames(options: MotionOptions | undefined): MotionClassNamesWithPhase {\n    const { name, enterClass, leaveClass } = options || {};\n\n    return {\n        enter: {\n            from: enterClass?.from || `${name}-enter-from`,\n            to: enterClass?.to || `${name}-enter-to`,\n            active: enterClass?.active || `${name}-enter-active`\n        },\n        leave: {\n            from: leaveClass?.from || `${name}-leave-from`,\n            to: leaveClass?.to || `${name}-leave-to`,\n            active: leaveClass?.active || `${name}-leave-active`\n        }\n    };\n}\n\n/**\n * Retrieves the motion hooks organized by phase based on the provided options.\n * @param options - The motion options containing hooks.\n * @returns The motion hooks organized by phase.\n */\nexport function getMotionHooks(options: MotionOptions | undefined): MotionHooksWithPhase {\n    return {\n        enter: {\n            onBefore: options?.onBeforeEnter,\n            onStart: options?.onEnter,\n            onAfter: options?.onAfterEnter,\n            onCancelled: options?.onEnterCancelled\n        },\n        leave: {\n            onBefore: options?.onBeforeLeave,\n            onStart: options?.onLeave,\n            onAfter: options?.onAfterLeave,\n            onCancelled: options?.onLeaveCancelled\n        }\n    };\n}\n\n/**\n * Retrieves motion metadata including type, timeout, and count for the given element.\n * @param element - The target element to retrieve motion metadata from.\n * @param expectedType - The expected type of motion ('transition' or 'animation').\n * @returns The motion metadata including type, timeout, and count.\n */\nexport function getMotionMetadata(element: Element, expectedType?: MotionMetadata['type']): MotionMetadata {\n    const styles = window.getComputedStyle(element);\n\n    const getDelaysAndDurations = (type: MotionType): [number[], number[]] => {\n        const delays = styles[`${type}Delay`];\n        const durations = styles[`${type}Duration`];\n\n        return [delays.split(', ').map(toMs), durations.split(', ').map(toMs)];\n    };\n\n    const [transitionDelays, transitionDurations] = getDelaysAndDurations(TRANSITION);\n    const [animationDelays, animationDurations] = getDelaysAndDurations(ANIMATION);\n\n    const transitionTimeout = Math.max(...transitionDurations.map((d, i) => d + transitionDelays[i]));\n    const animationTimeout = Math.max(...animationDurations.map((d, i) => d + animationDelays[i]));\n\n    let type: MotionMetadata['type'] = undefined;\n    let timeout = 0;\n    let count = 0;\n\n    if (expectedType === TRANSITION) {\n        if (transitionTimeout > 0) {\n            type = TRANSITION;\n            timeout = transitionTimeout;\n            count = transitionDurations.length;\n        }\n    } else if (expectedType === ANIMATION) {\n        if (animationTimeout > 0) {\n            type = ANIMATION;\n            timeout = animationTimeout;\n            count = animationDurations.length;\n        }\n    } else {\n        timeout = Math.max(transitionTimeout, animationTimeout);\n        type = timeout > 0 ? (transitionTimeout > animationTimeout ? TRANSITION : ANIMATION) : undefined;\n        count = type ? (type === TRANSITION ? transitionDurations.length : animationDurations.length) : 0;\n    }\n\n    return {\n        type,\n        timeout,\n        count\n    };\n}\n\n/**\n * Resolves the duration for a given animation phase.\n * @param duration - The duration can be a number or an object with `enter` and `leave` properties.\n * @param phase - The phase of the transition/animation, either 'enter' or 'leave'.\n * @returns The resolved duration in milliseconds or null if not specified.\n */\nexport function resolveDuration(duration: MotionOptions['duration'], phase: MotionPhase): number | null {\n    if (typeof duration === 'number') {\n        return duration;\n    } else if (typeof duration === 'object' && duration[phase] != null) {\n        return duration[phase];\n    }\n\n    return null;\n}\n\n/**\n * Sets CSS custom properties for auto height and/or width on the given element.\n * @param element - The target HTML element.\n * @param autoHeight - Whether to set the auto height CSS variable.\n * @param autoWidth - Whether to set the auto width CSS variable.\n * @returns\n */\nexport function setAutoDimensionVariables(element: HTMLElement, autoHeight: boolean = true, autoWidth: boolean = false): void {\n    if (!autoHeight && !autoWidth) return;\n\n    const dimensions = getHiddenElementDimensions(element);\n\n    if (autoHeight) {\n        setCSSProperty(element, '--height', dimensions.height + 'px');\n    }\n\n    if (autoWidth) {\n        setCSSProperty(element, '--width', dimensions.width + 'px');\n    }\n}\n\n/**\n * Sets the current motion phase on the given element.\n * @param element - The target HTML element.\n * @param phase - The current motion phase.\n */\nexport function setMotionPhase(element: HTMLElement, phase: MotionPhase): void {\n    element.setAttribute('data-phase', phase);\n}\n\n/**\n * Sets the current motion state on the given element.\n * @param element - The target HTML element.\n * @param phase - The current motion phase.\n * @param state - The current motion state.\n */\nexport function setMotionState(element: HTMLElement, phase: MotionPhase, state: MotionState): void {\n    element.removeAttribute('data-enter');\n    element.removeAttribute('data-leave');\n\n    element.setAttribute(`data-${phase}`, state);\n}\n\n/**\n * Removes the motion phase attribute from the given element.\n * @param element - The target HTML element.\n */\nexport function removeMotionPhase(element: HTMLElement): void {\n    element.removeAttribute('data-phase');\n}\n\n/**\n * Removes the motion state attributes from the given element.\n * @param element - The target HTML element.\n */\nexport function removeMotionState(element: HTMLElement): void {\n    element.removeAttribute('data-enter');\n    element.removeAttribute('data-leave');\n}\n"],"mappings":"siBAAA,OAAS,YAAAA,EAAU,eAAAC,MAAmB,kBCAtC,OAAS,8BAAAC,EAA4B,0BAAAC,EAAwB,kBAAAC,EAAgB,QAAAC,MAAY,kBAGlF,IAAMC,EAAY,YACZC,EAAa,aAOnB,SAASC,EAAiBC,EAA6C,CAC1E,OAAKA,EAIEA,EAAQ,UAAY,CAAC,EAAEA,EAAQ,MAAQC,EAAuB,GAH1D,EAIf,CAQO,SAASC,EAAaC,EAAsCC,EAA8C,CAC7G,OAAKD,EAIEE,IAAA,GACAF,GACC,OAAO,QAAQC,CAAc,EAAE,OAAO,CAACE,EAA8B,CAACC,EAAKC,CAAK,IAAM,CAhClG,IAAAC,EAiCY,OAAAH,EAAIC,CAAG,GAAKE,EAAAN,EAAsCI,CAAG,IAAzC,KAAAE,EAA8CD,EAEnDF,CACX,EAAG,CAAC,CAAC,GATEF,CAWf,CAOO,SAASM,EAAkBV,EAA+D,CAC7F,GAAM,CAAE,KAAAW,EAAM,WAAAC,EAAY,WAAAC,CAAW,EAAIb,GAAW,CAAC,EAErD,MAAO,CACH,MAAO,CACH,MAAMY,GAAA,YAAAA,EAAY,OAAQ,GAAGD,CAAI,cACjC,IAAIC,GAAA,YAAAA,EAAY,KAAM,GAAGD,CAAI,YAC7B,QAAQC,GAAA,YAAAA,EAAY,SAAU,GAA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,CAAY,EAExE,GAAI,CAACI,EAAM,CACPf,EAAQ,EAER,MACJ,CAEA,IAAMmB,EAAWJ,EAAO,MACpBK,EAAQ,EAENC,EAAM,IAAM,CACdnD,EAAQ,oBAAoBiD,EAAUG,EAAO,EAAI,EACjDR,EAAkB,CACtB,EAEMQ,EAAShC,GAAiB,CACxBA,EAAM,SAAWpB,GAAW,EAAEkD,GAASH,GACvCI,EAAI,CAEZ,EAEAnD,EAAQ,iBAAiBiD,EAAUG,EAAO,CAAE,QAAS,GAAM,KAAM,EAAK,CAAC,EACvE,WAAW,IAAM,CACTF,EAAQH,GACRI,EAAI,CAEZ,EAAGL,EAAU,CAAC,CAClB","names":["addClass","removeClass","getHiddenElementDimensions","isPrefersReducedMotion","setCSSProperty","toMs","ANIMATION","TRANSITION","shouldSkipMotion","options","isPrefersReducedMotion","mergeOptions","inOptions","defaultOptions","__spreadValues","acc","key","value","_a","resolveClassNames","name","enterClass","leaveClass","getMotionHooks","getMotionMetadata","element","expectedType","styles","getDelaysAndDurations","type","delays","durations","toMs","transitionDelays","transitionDurations","animationDelays","animationDurations","transitionTimeout","d","i","animationTimeout","timeout","count","resolveDuration","duration","phase","setAutoDimensionVariables","autoHeight","autoWidth","dimensions","getHiddenElementDimensions","setCSSProperty","setMotionPhase","setMotionState","state","removeMotionPhase","removeMotionState","DEFAULT_MOTION_OPTIONS","createMotion","element","options","opts","skipMotion","classNames","cancelCurrent","hooks","init","newOpts","mergeOptions","getMotionHooks","shouldSkipMotion","resolveClassNames","run","phase","__async","onBefore","onStart","onAfter","onCancelled","event","setMotionPhase","removeMotionPhase","fromClass","activeClass","toClass","setAutoDimensionVariables","addClass","setMotionState","removeClass","resolve","duration","resolveDuration","cleanup","removeMotionState","onDone","whenEnd","instance","newElement","newOptions","endId","expectedType","explicitTimeout","id","resolveIfNotStale","type","timeout","count","getMotionMetadata","endEvent","ended","end","onEnd"]}