{"version":3,"file":"TextHighlight.Dy22ICph.mjs","names":[],"sources":["https:/framerusercontent.com/modules/BRhICJ7Bz1ygq43mYHFG/YK5XHpCpi5lB24r6ZhxK/TextHighlight.js"],"sourcesContent":["// Text Highlight - Customizable browser text selection colors with theme support\nimport{jsx as _jsx}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{useEffect}from\"react\";/**\n * @framerIntrinsicWidth 5\n * @framerIntrinsicHeight 5\n * \n * @framerSupportedLayoutWidth fixed\n * @framerSupportedLayoutHeight fixed\n */export default function TextHighlight(props){const{scopes=[],includeInputs=true}=props;useEffect(()=>{if(typeof document===\"undefined\")return;const styleId=\"framer-text-highlight-global\";let styleEl=document.getElementById(styleId);if(!styleEl){styleEl=document.createElement(\"style\");styleEl.id=styleId;document.head.appendChild(styleEl);}const getSelectorForScope=(scope,customSelector)=>{switch(scope){case\"global\":return\"\";case\"headings\":return\"h1::selection, h2::selection, h3::selection, h4::selection, h5::selection, h6::selection\";case\"links\":return\"a\";case\"code\":return\"code, pre\";case\"inputs\":return\"input, textarea\";case\"custom\":// Split custom selectors by comma and add ::selection to each\nif(!customSelector||customSelector.trim()===\"\")return\"*\";return customSelector.split(\",\").map(s=>s.trim()).filter(s=>s.length>0).map(s=>`${s}::selection`).join(\", \");default:return\"\";}};let css=\"\";// Sort scopes to ensure global is first\nconst sortedScopes=[...scopes].sort((a,b)=>{if(a.scope===\"global\")return-1;if(b.scope===\"global\")return 1;return 0;});sortedScopes.forEach(scopeConfig=>{const selector=getSelectorForScope(scopeConfig.scope,scopeConfig.customSelector);// For headings and custom, the selector already includes ::selection\nconst prefix=scopeConfig.scope===\"headings\"||scopeConfig.scope===\"custom\"?selector:selector?`${selector}::selection`:\"::selection\";const mozPrefix=scopeConfig.scope===\"headings\"||scopeConfig.scope===\"custom\"?selector.replace(/::selection/g,\"::-moz-selection\"):selector?`${selector}::-moz-selection`:\"::-moz-selection\";if(scopeConfig.themeMode){// Base styles (fallback)\ncss+=`\n            ${prefix} {\n                background-color: ${scopeConfig.lightBg};\n                color: ${scopeConfig.lightText};\n            }\n            ${mozPrefix} {\n                background-color: ${scopeConfig.lightBg};\n                color: ${scopeConfig.lightText};\n            }\n            \n            @media (prefers-color-scheme: light) {\n                ${prefix} {\n                    background-color: ${scopeConfig.lightBg};\n                    color: ${scopeConfig.lightText};\n                }\n                ${mozPrefix} {\n                    background-color: ${scopeConfig.lightBg};\n                    color: ${scopeConfig.lightText};\n                }\n            }\n            \n            @media (prefers-color-scheme: dark) {\n                ${prefix} {\n                    background-color: ${scopeConfig.darkBg};\n                    color: ${scopeConfig.darkText};\n                }\n                ${mozPrefix} {\n                    background-color: ${scopeConfig.darkBg};\n                    color: ${scopeConfig.darkText};\n                }\n            }\n            `;}else{css+=`\n            ${prefix} {\n                background-color: ${scopeConfig.bg};\n                color: ${scopeConfig.text};\n            }\n            ${mozPrefix} {\n                background-color: ${scopeConfig.bg};\n                color: ${scopeConfig.text};\n            }\n            `;}});// Handle input exclusion if needed\nif(!includeInputs&&!scopes.some(s=>s.scope===\"inputs\")){css+=`\n            input::selection,\n            textarea::selection {\n                background-color: Highlight;\n                color: HighlightText;\n            }\n            input::-moz-selection,\n            textarea::-moz-selection {\n                background-color: Highlight;\n                color: HighlightText;\n            }\n            `;}// Forced colors mode for accessibility\ncss+=`\n            @media (forced-colors: active) {\n                ::selection {\n                    background-color: Highlight;\n                    color: HighlightText;\n                }\n                ::-moz-selection {\n                    background-color: Highlight;\n                    color: HighlightText;\n                }\n            }\n        `;styleEl.textContent=css;return()=>{// Cleanup: remove style when component unmounts\nif(styleEl&&styleEl.parentNode){styleEl.parentNode.removeChild(styleEl);}};},[scopes,includeInputs]);return /*#__PURE__*/_jsx(\"div\",{style:{width:5,height:5,pointerEvents:\"none\"}});}addPropertyControls(TextHighlight,{scopes:{type:ControlType.Array,title:\"Color Scopes\",control:{type:ControlType.Object,controls:{scope:{type:ControlType.Enum,title:\"Scope\",options:[\"global\",\"headings\",\"links\",\"code\",\"inputs\",\"custom\"],optionTitles:[\"Global\",\"Headings\",\"Links\",\"Code\",\"Inputs\",\"Custom\"],defaultValue:\"global\"},customSelector:{type:ControlType.String,title:\"Custom Selector\",defaultValue:\"\",placeholder:\".my-class, #my-id\",hidden:props=>props.scope!==\"custom\"},themeMode:{type:ControlType.Boolean,title:\"Theme Mode\",defaultValue:false,enabledTitle:\"Light/Dark\",disabledTitle:\"Single\"},bg:{type:ControlType.Color,title:\"Background\",defaultValue:\"#0099FF\",hidden:props=>props.themeMode},text:{type:ControlType.Color,title:\"Text\",defaultValue:\"#FFFFFF\",hidden:props=>props.themeMode},lightBg:{type:ControlType.Color,title:\"Light BG\",defaultValue:\"#0099FF\",hidden:props=>!props.themeMode},lightText:{type:ControlType.Color,title:\"Light Text\",defaultValue:\"#FFFFFF\",hidden:props=>!props.themeMode},darkBg:{type:ControlType.Color,title:\"Dark BG\",defaultValue:\"#8855FF\",hidden:props=>!props.themeMode},darkText:{type:ControlType.Color,title:\"Dark Text\",defaultValue:\"#FFFFFF\",hidden:props=>!props.themeMode}}},defaultValue:[{scope:\"global\",customSelector:\"\",themeMode:false,bg:\"#0099FF\",text:\"#FFFFFF\",lightBg:\"#0099FF\",lightText:\"#FFFFFF\",darkBg:\"#8855FF\",darkText:\"#FFFFFF\"}],maxCount:10},includeInputs:{type:ControlType.Boolean,title:\"Include Inputs\",defaultValue:true,enabledTitle:\"Yes\",disabledTitle:\"No\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"TextHighlight\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"fixed\",\"framerContractVersion\":\"1\",\"framerIntrinsicWidth\":\"5\",\"framerIntrinsicHeight\":\"5\",\"framerSupportedLayoutWidth\":\"fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./TextHighlight.map"],"mappings":"0KAOG,SAAwB,EAAc,EAAM,CAAC,GAAK,CAAC,SAAO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