{"version":3,"file":"TextRoll.BE5VdOi6.mjs","names":["useRef","forwardRef"],"sources":["https:/framerusercontent.com/modules/XpVb60Z186GoG9biih2H/6AXc1lHiXWBIeAxRcitQ/TextRoll.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{forwardRef,useEffect,useRef}from\"react\";/**\n * Rolling hover effect for links, navigation items and button labels.\n *\n * The text is rendered twice inside a mask one line tall. On hover the pair\n * rolls up: the visible line swings out around its right edge while the copy\n * below swings in around its left edge.\n *\n * Overrides:\n *   withTextRoll  — put on the text layer that should roll\n *   withRollScope — put on a surrounding frame (a card, a button) so hovering\n *                   anywhere on it drives the layers inside\n *\n * The effect follows a surrounding <a> or <button> on its own, so linked\n * buttons need no scope layer. Touch devices and \"reduce motion\" get the\n * plain label.\n *\n * Important: the layer itself stays the mask. Wrapping a Framer layer in an\n * extra element breaks Framer's own variant animations — the navigation bar\n * hides on scroll, and the wrapped labels came back stuck at opacity 0. Only\n * the *contents* of the layer are restructured here.\n */// Swing of the two lines, in degrees.\nconst ANGLE=20;// Aus der Bewegungsskala des Projekts (<style id=\"neal-motion\"> im Custom Code).\n// Ein Hover-Roll ist ein kurzer Weg, also die Basisstufe, und er kommt an,\n// also die Aus-Kurve.\nconst DURATION=\"var(--neal-dur-base)\";const EASE=\"var(--neal-ease-out)\";const STYLE_ID=\"neal-text-roll\";const CSS=`\n/* The linked line rolls out of the mask on hover, and the copy that takes its\n   place ignores the pointer — without this the cursor falls back to default. */\n[data-nl-roll]:has(a[href]) {\n    cursor: pointer;\n}\n[data-nl-roll] > .nl-roll-track {\n    display: block;\n    position: relative;\n    transform: translateY(0);\n    will-change: transform;\n    transition: transform ${DURATION} ${EASE};\n}\n[data-nl-roll] .nl-roll-line {\n    display: block;\n    transition: transform ${DURATION} ${EASE};\n}\n[data-nl-roll] .nl-roll-a {\n    transform-origin: right center;\n    transform: rotate(0deg);\n}\n[data-nl-roll] .nl-roll-b {\n    position: absolute;\n    left: 0;\n    top: 100%;\n    width: 100%;\n    pointer-events: none;\n    transform-origin: left center;\n    transform: rotate(${ANGLE}deg);\n}\n\n@media (hover: hover) and (pointer: fine) {\n    [data-nl-roll]:hover > .nl-roll-track,\n    a:hover [data-nl-roll] > .nl-roll-track,\n    button:hover [data-nl-roll] > .nl-roll-track,\n    [data-nl-roll-scope]:hover [data-nl-roll] > .nl-roll-track {\n        transform: translateY(-100%);\n    }\n    [data-nl-roll]:hover .nl-roll-a,\n    a:hover [data-nl-roll] .nl-roll-a,\n    button:hover [data-nl-roll] .nl-roll-a,\n    [data-nl-roll-scope]:hover [data-nl-roll] .nl-roll-a {\n        transform: rotate(${ANGLE}deg);\n    }\n    [data-nl-roll]:hover .nl-roll-b,\n    a:hover [data-nl-roll] .nl-roll-b,\n    button:hover [data-nl-roll] .nl-roll-b,\n    [data-nl-roll-scope]:hover [data-nl-roll] .nl-roll-b {\n        transform: rotate(0deg);\n    }\n}\n\n@media (prefers-reduced-motion: reduce) {\n    [data-nl-roll] > .nl-roll-track,\n    [data-nl-roll] .nl-roll-line {\n        transition: none !important;\n        transform: none !important;\n    }\n    [data-nl-roll] .nl-roll-b {\n        display: none !important;\n    }\n}\n`;if(typeof document!==\"undefined\"&&!document.getElementById(STYLE_ID)){const tag=document.createElement(\"style\");tag.id=STYLE_ID;tag.textContent=CSS;document.head.appendChild(tag);}function useMarker(attribute,forwardedRef){const ownRef=useRef(null);useEffect(()=>{ownRef.current?.setAttribute(attribute,\"\");});return node=>{ownRef.current=node;if(typeof forwardedRef===\"function\")forwardedRef(node);else if(forwardedRef)forwardedRef.current=node;};}/**\n * Framer renders a link on a text layer as an <a> *inside* the layer, so the\n * anchor sits on the line that rolls away. While the pointer hovers, what is\n * under it is the copy below — aria-hidden, and stripped of its href. A real\n * click therefore hit nothing and the navigation bar stopped navigating.\n *\n * The mask catches that click and hands it to the original anchor, which still\n * carries Framer's router handler — so the site keeps its client-side page\n * transitions instead of reloading. Clicks that already landed on a link or a\n * button are left alone, and a label without a link (a button caption) falls\n * through to the Framer interaction on the frame around it.\n */function forwardToLink(event,line){if(event.defaultPrevented)return;const target=event.target;if(!(target instanceof Element))return;if(target.closest(\"a[href], button\"))return;const link=line?.querySelector(\"a[href]\");if(!link)return;event.preventDefault();link.click();}export function withTextRoll(Component){const Wrapped=/*#__PURE__*/forwardRef((props,forwardedRef)=>{const setRef=useMarker(\"data-nl-roll\",forwardedRef);const first=useRef(null);// The second line is a copy of the rendered first one, built in\n// the DOM rather than rendered by React. Framer walks the children\n// of a text layer itself and, where the text is bound to a\n// variable, keeps only the first of them — a second React child is\n// silently dropped. A plain DOM node stays out of all of that.\n// One observer per rendered line. This used to be torn down and\n// rebuilt after every render of every rolling label; it only needs\n// redoing when the line element itself or its copy goes away.\nconst setup=useRef({source:null,off:null});useEffect(()=>()=>{setup.current.off?.();setup.current={source:null,off:null};},[]);useEffect(()=>{const source=first.current;const state=setup.current;if(source&&source===state.source&&source.parentElement?.querySelector(\":scope > .nl-roll-b\")){// Framer changes attributes inside the line without a DOM\n// mutation the observer sees (the current-page state of a\n// link), so the copy still follows every render — only the\n// observer is no longer rebuilt.\nstate.sync?.();return;}state.off?.();state.off=null;state.source=source;const track=source?.parentElement;if(!source||!track)return;let target=track.querySelector(\":scope > .nl-roll-b\");if(!target){target=document.createElement(\"span\");target.className=\"nl-roll-line nl-roll-b\";target.setAttribute(\"aria-hidden\",\"true\");track.appendChild(target);}const sync=()=>{if(target.innerHTML===source.innerHTML)return;target.innerHTML=source.innerHTML;target.querySelectorAll(\"a[href], [id]\").forEach(node=>{node.removeAttribute(\"href\");node.removeAttribute(\"id\");});};sync();state.sync=sync;const observer=new MutationObserver(sync);observer.observe(source,{childList:true,characterData:true,subtree:true});// No cleanup returned here: an effect cleanup would run before\n// every re-render and drop the observer. setup.current.off does\n// it when the line changes or the label unmounts.\nstate.off=()=>observer.disconnect();});const{style,children,onClick,...rest}=props;return /*#__PURE__*/_jsx(Component,{...rest,ref:setRef,onClick:event=>{onClick?.(event);forwardToLink(event,first.current);},style:{...style,overflow:\"hidden\"},children:/*#__PURE__*/_jsx(\"span\",{className:\"nl-roll-track\",children:/*#__PURE__*/_jsx(\"span\",{className:\"nl-roll-line nl-roll-a\",ref:first,children:children})})});});return Wrapped;}/**\n * Marks a frame as the hover area for every rolling layer inside it — for\n * buttons and cards that are not links themselves.\n */export function withRollScope(Component){const Wrapped=/*#__PURE__*/forwardRef((props,forwardedRef)=>{const setRef=useMarker(\"data-nl-roll-scope\",forwardedRef);return /*#__PURE__*/_jsx(Component,{ref:setRef,...props});});return Wrapped;}\nexport const __FramerMetadata__ = {\"exports\":{\"withRollScope\":{\"type\":\"reactHoc\",\"name\":\"withRollScope\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withTextRoll\":{\"type\":\"reactHoc\",\"name\":\"withTextRoll\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./TextRoll.map"],"mappings":"gIAsFsL,SAAS,EAAU,EAAU,EAAa,CAAC,IAAM,EAAOA,EAAO,IAAI,EAA+D,OAA7D,MAAc,CAAC,EAAO,SAAS,aAAa,EAAU,EAAE,CAAE,CAAC,EAAS,GAAM,CAAC,EAAO,QAAQ,EAAQ,OAAO,GAAe,WAAW,EAAa,CAAI,EAAU,IAAa,EAAa,QAAQ,EAAK,CAAE,CAW/b,SAAS,EAAc,EAAM,EAAK,CAAC,GAAG,EAAM,iBAAiB,OAAO,IAAM,EAAO,EAAM,OAA8C,GAApC,EAAE,aAAkB,UAAmB,EAAO,QAAQ,iBAAiB,EAAE,OAAO,IAAM,EAAK,GAAM,cAAc,SAAS,EAAM,IAAY,EAAM,eAAe,EAAE,EAAK,MAAM,EAAE,CAAC,SAAgB,EAAa,EAAU,CAeiG,OAfrEC,GAAY,EAAM,IAAe,CAAC,IAAM,EAAO,EAAU,eAAe,CAAY,EAAQ,EAAMD,EAAO,IAAI,EAQ7b,EAAMA,EAAO,CAAC,OAAO,KAAK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