{"version":3,"sources":["Ticker.tsx"],"sourcesContent":["import {\n    Children,\n    useLayoutEffect,\n    useEffect,\n    useState,\n    useRef,\n    useMemo,\n    createRef,\n    useCallback,\n    cloneElement,\n    startTransition,\n} from \"react\"\nimport { addPropertyControls, ControlType, RenderTarget } from \"framer\"\nimport {\n    useAnimationFrame,\n    useReducedMotion,\n    LayoutGroup,\n    useInView,\n    useMotionValue,\n    useTransform,\n    motion,\n    wrap,\n    frame,\n} from \"framer-motion\"\nimport { resize } from \"@motionone/dom\"\n\nconst MAX_DUPLICATED_ITEMS = 100\n\nconst directionTransformers = {\n    left: (offset: number) => `translateX(-${offset}px)`,\n    right: (offset: number) => `translateX(${offset}px)`,\n    top: (offset: number) => `translateY(-${offset}px)`,\n    bottom: (offset: number) => `translateY(${offset}px)`,\n}\n\n/**\n *\n * @framerIntrinsicWidth 400\n * @framerIntrinsicHeight 200\n *\n * @framerDisableUnlink\n *\n * @framerSupportedLayoutWidth fixed\n * @framerSupportedLayoutHeight fixed\n */\nexport default function Ticker(props) {\n    /* Props */\n    let {\n        slots = [],\n        gap,\n        padding,\n        paddingPerSide,\n        paddingTop,\n        paddingRight,\n        paddingBottom,\n        paddingLeft,\n        speed,\n        hoverFactor,\n        direction,\n        alignment,\n        sizingOptions,\n        fadeOptions,\n        style,\n    } = props\n\n    const { fadeContent, overflow, fadeWidth, fadeInset, fadeAlpha } =\n        fadeOptions\n    const { widthType, heightType } = sizingOptions\n    const paddingValue = paddingPerSide\n        ? `${paddingTop}px ${paddingRight}px ${paddingBottom}px ${paddingLeft}px`\n        : `${padding}px`\n\n    /* Checks */\n    const currentTarget = RenderTarget.current()\n    const isCanvas =\n        currentTarget === RenderTarget.canvas ||\n        currentTarget === RenderTarget.export\n    // Remove empty slots (such as hidden layers)\n    const filteredSlots = slots.filter(Boolean)\n    const numChildren = Children.count(filteredSlots)\n    const hasChildren = numChildren > 0\n    if (direction === true) {\n        direction = \"left\"\n    }\n    const isHorizontal = direction === \"left\" || direction === \"right\"\n\n    const offset = useMotionValue(0)\n    const transformer = directionTransformers[direction]\n    const transform = useTransform(offset, transformer)\n\n    /* Refs and State */\n    const parentRef = useRef(null)\n    const childrenRef = useMemo(() => {\n        return [\n            {\n                current: null,\n            },\n            {\n                current: null,\n            },\n        ]\n    }, [])\n    const [size, setSize] = useState({\n        parent: null,\n        children: null,\n    })\n\n    /* Arrays */\n    let clonedChildren = null\n    let dupedChildren = []\n\n    /* Duplicate value */\n    let duplicateBy = 0\n    let opacity = 0\n\n    if (isCanvas) {\n        duplicateBy = numChildren ? Math.floor(10 / numChildren) : 0\n        opacity = 1\n    }\n\n    if (!isCanvas && hasChildren && size.parent) {\n        duplicateBy = Math.round((size.parent / size.children) * 2) + 1\n        duplicateBy = Math.min(duplicateBy, MAX_DUPLICATED_ITEMS)\n        opacity = 1\n    }\n\n    /* Measure parent and child */\n    const measure = useCallback(() => {\n        if (hasChildren && parentRef.current) {\n            const parentLength = isHorizontal\n                ? parentRef.current.offsetWidth\n                : parentRef.current.offsetHeight\n\n            const start = childrenRef[0].current\n                ? isHorizontal\n                    ? childrenRef[0].current.offsetLeft\n                    : childrenRef[0].current.offsetTop\n                : 0\n            const end = childrenRef[1].current\n                ? isHorizontal\n                    ? childrenRef[1].current.offsetLeft +\n                      childrenRef[1].current.offsetWidth\n                    : childrenRef[1].current.offsetTop +\n                      childrenRef[1].current.offsetHeight\n                : 0\n\n            const childrenLength = end - start + gap\n\n            setSize({\n                parent: parentLength,\n                children: childrenLength,\n            })\n        }\n    }, [])\n\n    const childrenStyles = isCanvas ? { contentVisibility: \"auto\" } : {}\n\n    /* Add refs to first and last child */\n    if (hasChildren) {\n        // TODO: These conditional hooks will be unsafe if hasChildren ever changes outside the canvas.\n        if (!isCanvas) {\n            /**\n             * Track whether this is the initial resize event. By default this will fire on mount,\n             * which we do in the useEffect. We should only fire it on subsequent resizes.\n             */\n            let initialResize = useRef(true)\n            useLayoutEffect(() => {\n                frame.read(measure, false, true)\n                return resize(parentRef.current, ({ contentSize }) => {\n                    if (\n                        !initialResize.current &&\n                        (contentSize.width || contentSize.height)\n                    ) {\n                        frame.read(measure, false, true)\n                    }\n\n                    initialResize.current = false\n                })\n            }, [])\n        }\n\n        clonedChildren = Children.map(filteredSlots, (child, index) => {\n            let ref\n            if (index === 0) {\n                ref = childrenRef[0]\n            }\n            if (index === filteredSlots.length - 1) {\n                ref = childrenRef[1]\n            }\n\n            const size = {\n                width: widthType ? child.props?.width : \"100%\",\n                height: heightType ? child.props?.height : \"100%\",\n            }\n\n            return (\n                <LayoutGroup inherit=\"id\">\n                    <li ref={ref} style={size}>\n                        {cloneElement(\n                            child,\n                            {\n                                style: {\n                                    ...child.props?.style,\n                                    ...size,\n                                    flexShrink: 0,\n                                    ...childrenStyles,\n                                },\n                                layoutId: child.props.layoutId\n                                    ? child.props.layoutId +\n                                      \"-original-\" +\n                                      index\n                                    : undefined,\n                            },\n                            child.props?.children\n                        )}\n                    </li>\n                </LayoutGroup>\n            )\n        })\n    }\n\n    const isInView = isCanvas ? true : useInView(parentRef)\n\n    if (!isCanvas) {\n        for (let i = 0; i < duplicateBy; i++) {\n            dupedChildren = dupedChildren.concat(\n                Children.map(filteredSlots, (child, childIndex) => {\n                    const size = {\n                        width: widthType ? child.props?.width : \"100%\",\n                        height: heightType ? child.props?.height : \"100%\",\n                        willChange: !isInView ? undefined : \"transform\", // without this, carousel will flash on animation repeat in safari\n                    }\n                    return (\n                        <LayoutGroup inherit=\"id\" key={i + \"lg\" + childIndex}>\n                            <li\n                                style={size}\n                                key={i + \"li\" + childIndex}\n                                aria-hidden\n                            >\n                                {cloneElement(\n                                    child,\n                                    {\n                                        key: i + \" \" + childIndex,\n                                        style: {\n                                            ...child.props?.style,\n                                            width: widthType\n                                                ? child.props?.width\n                                                : \"100%\",\n                                            height: heightType\n                                                ? child.props?.height\n                                                : \"100%\",\n                                            flexShrink: 0,\n                                            ...childrenStyles,\n                                        },\n                                        layoutId: child.props.layoutId\n                                            ? child.props.layoutId +\n                                              \"-dupe-\" +\n                                              i\n                                            : undefined,\n                                    },\n                                    child.props?.children\n                                )}\n                            </li>\n                        </LayoutGroup>\n                    )\n                })\n            )\n        }\n    }\n\n    const animateToValue =\n        size.children + size.children * Math.round(size.parent / size.children)\n\n    const initialTime = useRef(null)\n    const prevTime = useRef(null)\n    const xOrY = useRef(0)\n    const isHover = useRef(false)\n\n    const isReducedMotion = useReducedMotion()\n    const listRef = useRef<HTMLUListElement>(null)\n    const animationRef = useRef<Animation>(null)\n\n    /**\n     * Setup animations\n     */\n    if (!isCanvas) {\n        useEffect(() => {\n            if (isReducedMotion || !animateToValue || !speed) {\n                return\n            }\n\n            animationRef.current = listRef.current.animate(\n                {\n                    transform: [transformer(0), transformer(animateToValue)],\n                },\n                {\n                    duration: (Math.abs(animateToValue) / speed) * 1000,\n                    iterations: Infinity,\n                    easing: \"linear\",\n                }\n            )\n\n            return () => animationRef.current.cancel()\n        }, [hoverFactor, animateToValue, speed])\n\n        const playOrPause = useCallback(() => {\n            if (!animationRef.current) return\n\n            const hidden = document.hidden\n            if (\n                isInView &&\n                !hidden &&\n                animationRef.current.playState === \"paused\"\n            ) {\n                animationRef.current.play()\n            } else if (\n                (!isInView || hidden) &&\n                animationRef.current.playState === \"running\"\n            ) {\n                animationRef.current.pause()\n            }\n        }, [isInView])\n\n        useEffect(() => {\n            playOrPause()\n        }, [isInView, hoverFactor, animateToValue, speed])\n\n        useEffect(() => {\n            document.addEventListener(\"visibilitychange\", playOrPause)\n            return () => {\n                document.removeEventListener(\"visibilitychange\", playOrPause)\n            }\n        }, [playOrPause])\n    }\n\n    /* Fades */\n    const fadeDirection = isHorizontal ? \"to right\" : \"to bottom\"\n    const fadeWidthStart = fadeWidth / 2\n    const fadeWidthEnd = 100 - fadeWidth / 2\n    const fadeInsetStart = clamp(fadeInset, 0, fadeWidthStart)\n    const fadeInsetEnd = 100 - fadeInset\n\n    const fadeMask = `linear-gradient(${fadeDirection}, rgba(0, 0, 0, ${fadeAlpha}) ${fadeInsetStart}%, rgba(0, 0, 0, 1) ${fadeWidthStart}%, rgba(0, 0, 0, 1) ${fadeWidthEnd}%, rgba(0, 0, 0, ${fadeAlpha}) ${fadeInsetEnd}%)`\n\n    /* Empty state */\n    if (!hasChildren) {\n        return (\n            <section style={placeholderStyles}>\n                <div style={emojiStyles}>✨</div>\n                <p style={titleStyles}>Connect to Content</p>\n                <p style={subtitleStyles}>\n                    Add layers or components to infinitely loop on your page.\n                </p>\n            </section>\n        )\n    }\n\n    return (\n        <section\n            style={{\n                ...containerStyle,\n                opacity: opacity,\n                WebkitMaskImage: fadeContent ? fadeMask : undefined,\n                maskImage: fadeContent ? fadeMask : undefined,\n                overflow: overflow ? \"visible\" : \"hidden\",\n                padding: paddingValue,\n            }}\n            ref={parentRef}\n        >\n            <motion.ul\n                ref={listRef}\n                style={{\n                    ...containerStyle,\n                    gap: gap,\n                    top:\n                        direction === \"bottom\" && isValidNumber(animateToValue)\n                            ? -animateToValue\n                            : undefined,\n                    left:\n                        direction === \"right\" && isValidNumber(animateToValue)\n                            ? -animateToValue\n                            : undefined,\n                    placeItems: alignment,\n                    position: \"relative\",\n                    flexDirection: isHorizontal ? \"row\" : \"column\",\n                    ...style,\n                    willChange: isCanvas || !isInView ? \"auto\" : \"transform\",\n                    transform: transformer(0),\n                }}\n                onMouseEnter={() => {\n                    isHover.current = true\n                    if (animationRef.current) {\n                        // TODO Replace with updatePlaybackRate when Chrome bugs sorted\n                        animationRef.current.playbackRate = hoverFactor\n                    }\n                }}\n                onMouseLeave={() => {\n                    isHover.current = false\n                    if (animationRef.current) {\n                        // TODO Replace with updatePlaybackRate when Chrome bugs sorted\n                        animationRef.current.playbackRate = 1\n                    }\n                }}\n            >\n                {clonedChildren}\n                {dupedChildren}\n            </motion.ul>\n        </section>\n    )\n}\n\n/* Default Properties */\nTicker.defaultProps = {\n    gap: 10,\n    padding: 10,\n    sizingOptions: {\n        widthType: true,\n        heightType: true,\n    },\n    fadeOptions: {\n        fadeContent: true,\n        overflow: false,\n        fadeWidth: 25,\n        fadeAlpha: 0,\n        fadeInset: 0,\n    },\n    direction: true,\n}\n\n/* Property Controls */\naddPropertyControls(Ticker, {\n    slots: {\n        type: ControlType.Array,\n        title: \"Children\",\n        control: { type: ControlType.ComponentInstance },\n    },\n    speed: {\n        type: ControlType.Number,\n        title: \"Speed\",\n        min: 0,\n        max: 1000,\n        defaultValue: 100,\n        unit: \"%\",\n        displayStepper: true,\n        step: 5,\n    },\n    direction: {\n        type: ControlType.Enum,\n        title: \"Direction\",\n        options: [\"left\", \"right\", \"top\", \"bottom\"],\n        optionIcons: [\n            \"direction-left\",\n            \"direction-right\",\n            \"direction-up\",\n            \"direction-down\",\n        ],\n        optionTitles: [\"Left\", \"Right\", \"Top\", \"Bottom\"],\n        defaultValue: \"left\",\n        displaySegmentedControl: true,\n    },\n    alignment: {\n        type: ControlType.Enum,\n        title: \"Align\",\n        options: [\"flex-start\", \"center\", \"flex-end\"],\n        optionIcons: {\n            direction: {\n                right: [\"align-top\", \"align-middle\", \"align-bottom\"],\n                left: [\"align-top\", \"align-middle\", \"align-bottom\"],\n                top: [\"align-left\", \"align-center\", \"align-right\"],\n                bottom: [\"align-left\", \"align-center\", \"align-right\"],\n            },\n        },\n        defaultValue: \"center\",\n        displaySegmentedControl: true,\n    },\n    gap: {\n        type: ControlType.Number,\n        title: \"Gap\",\n    },\n    padding: {\n        title: \"Padding\",\n        type: ControlType.FusedNumber,\n        toggleKey: \"paddingPerSide\",\n        toggleTitles: [\"Padding\", \"Padding per side\"],\n        valueKeys: [\n            \"paddingTop\",\n            \"paddingRight\",\n            \"paddingBottom\",\n            \"paddingLeft\",\n        ],\n        valueLabels: [\"T\", \"R\", \"B\", \"L\"],\n        min: 0,\n    },\n    sizingOptions: {\n        type: ControlType.Object,\n        title: \"Sizing\",\n        controls: {\n            widthType: {\n                type: ControlType.Boolean,\n                title: \"Width\",\n                enabledTitle: \"Auto\",\n                disabledTitle: \"Stretch\",\n                defaultValue: true,\n            },\n            heightType: {\n                type: ControlType.Boolean,\n                title: \"Height\",\n                enabledTitle: \"Auto\",\n                disabledTitle: \"Stretch\",\n                defaultValue: true,\n            },\n        },\n    },\n    fadeOptions: {\n        type: ControlType.Object,\n        title: \"Clipping\",\n        controls: {\n            fadeContent: {\n                type: ControlType.Boolean,\n                title: \"Fade\",\n                defaultValue: true,\n            },\n            overflow: {\n                type: ControlType.Boolean,\n                title: \"Overflow\",\n                enabledTitle: \"Show\",\n                disabledTitle: \"Hide\",\n                defaultValue: false,\n                hidden(props) {\n                    return props.fadeContent === true\n                },\n            },\n            fadeWidth: {\n                type: ControlType.Number,\n                title: \"Width\",\n                defaultValue: 25,\n                min: 0,\n                max: 100,\n                unit: \"%\",\n                hidden(props) {\n                    return props.fadeContent === false\n                },\n            },\n            fadeInset: {\n                type: ControlType.Number,\n                title: \"Inset\",\n                defaultValue: 0,\n                min: 0,\n                max: 100,\n                unit: \"%\",\n                hidden(props) {\n                    return props.fadeContent === false\n                },\n            },\n            fadeAlpha: {\n                type: ControlType.Number,\n                title: \"Opacity\",\n                defaultValue: 0,\n                min: 0,\n                max: 1,\n                step: 0.05,\n                hidden(props) {\n                    return props.fadeContent === false\n                },\n            },\n        },\n    },\n    hoverFactor: {\n        type: ControlType.Number,\n        title: \"Hover\",\n        min: 0,\n        max: 1,\n        unit: \"x\",\n        defaultValue: 1,\n        step: 0.1,\n        displayStepper: true,\n        description: \"Slows down the speed while you are hovering.\",\n    },\n})\n\n/* Placeholder Styles */\nconst containerStyle = {\n    display: \"flex\",\n    width: \"100%\",\n    height: \"100%\",\n    maxWidth: \"100%\",\n    maxHeight: \"100%\",\n    placeItems: \"center\",\n    margin: 0,\n    padding: 0,\n    listStyleType: \"none\",\n    textIndent: \"none\",\n}\n\n/* Styles */\nconst placeholderStyles = {\n    display: \"flex\",\n    width: \"100%\",\n    height: \"100%\",\n    placeContent: \"center\",\n    placeItems: \"center\",\n    flexDirection: \"column\",\n    color: \"#96F\",\n    background: \"rgba(136, 85, 255, 0.1)\",\n    fontSize: 11,\n    overflow: \"hidden\",\n    padding: \"20px 20px 30px 20px\",\n}\n\nconst emojiStyles = {\n    fontSize: 32,\n    marginBottom: 10,\n}\n\nconst titleStyles = {\n    margin: 0,\n    marginBottom: 10,\n    fontWeight: 600,\n    textAlign: \"center\",\n}\n\nconst subtitleStyles = {\n    margin: 0,\n    opacity: 0.7,\n    maxWidth: 150,\n    lineHeight: 1.5,\n    textAlign: \"center\",\n}\n\n/* Clamp function, used for fadeInset */\nconst clamp = (num, min, max) => Math.min(Math.max(num, min), max)\n\nconst isValidNumber = (value) => typeof value === \"number\" && !isNaN(value)\n"],"names":[],"mappings":"yDAAA,OACI,QAAQ,CACR,eAAe,CACf,SAAS,CACT,QAAQ,CACR,MAAM,CACN,OAAO,CAEP,WAAW,CACX,YAAY,KAET,QAAO,AACd,OAAS,mBAAmB,CAAE,WAAW,CAAE,YAAY,KAAQ,SAAQ,AACvE,OAEI,gBAAgB,CAChB,WAAW,CACX,SAAS,CACT,cAAc,CACd,YAAY,CACZ,MAAM,CAEN,KAAK,KACF,gBAAe,AACtB,OAAS,MAAM,KAAQ,iBAAgB,AAEvC,MAAM,qBAAuB,IAE7B,MAAM,sBAAwB,CAC1B,KAAM,AAAC,QAAmB,CAAC,YAAY,EAAE,OAAO,GAAG,CAAC,CACpD,MAAO,AAAC,QAAmB,CAAC,WAAW,EAAE,OAAO,GAAG,CAAC,CACpD,IAAK,AAAC,QAAmB,CAAC,YAAY,EAAE,OAAO,GAAG,CAAC,CACnD,OAAQ,AAAC,QAAmB,CAAC,WAAW,EAAE,OAAO,GAAG,CAAC,AACzD,EAEA;;;;;;;;;CASC,EACD,eAAe,SAAS,OAAO,KAAK,EAChC,SAAS,EACT,GAAI,CACA,MAAQ,EAAE,CACV,GAAG,CACH,OAAO,CACP,cAAc,CACd,UAAU,CACV,YAAY,CACZ,aAAa,CACb,WAAW,CACX,KAAK,CACL,WAAW,CACX,SAAS,CACT,SA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