{"version":3,"file":"ExcFontGuard.BdpubSHM.mjs","names":["__esmMin","init_npm_react_18_3_1","init_jsx_runtime","c","ce","init_framer_D6uXRwWs","addPropertyControls","ExcFontGuard","DEFAULT_HREF","props","enabled","loadWebfont","href","webfontHref","head","LINK_ID","pre","link","style","skip","excludeSelector","not","css","TEXT_ELEMENTS","fontStack","init_ExcFontGuard","ControlType","p"],"sources":["https:/framerusercontent.com/modules/LDND2kJBffrZJsUoP5WF/vi0VGJHJGYj3nqpNx81N/ExcFontGuard.js"],"sourcesContent":["// ExcFontGuard — forces Montserrat across an entire page, AND guarantees the\n// typeface is actually downloaded.\n//\n// WHY THIS EXISTS. Three separate causes, and fixing them one component at a\n// time does not hold:\n//\n//   1. THE FACE IS NEVER LOADED (the big one). Framer only ships a webfont to a\n//      page when something Framer knows about references it — a text style, a\n//      Font picker, a native text layer. A code component that writes\n//      `fontFamily: \"Montserrat, sans-serif\"` in plain CSS is invisible to that\n//      mechanism. On a page built entirely from code components (e.g.\n//      /homepage-review) there is no Framer text node at all, so Montserrat is\n//      never fetched and EVERY declaration silently falls through to\n//      `sans-serif` — Helvetica/Arial, which reads as \"not Montserrat\". This is\n//      why naming the font correctly in a dozen components changed nothing.\n//      Fix: this component injects a real @font-face source itself.\n//   2. Code components that read a Framer Font picker with\n//      `picker?.fontFamily || \"Montserrat, sans-serif\"` only fall back to\n//      Montserrat when the picker is UNSET. A picker resolving to anything else\n//      (Framer's default sans is Inter) beats the fallback.\n//   3. Framer emits its own element-level rules for h1/h2/p and friends, and an\n//      element-level rule beats a family inherited from an ancestor.\n//\n// One instance per page closes all three. It renders nothing visible and also\n// covers native Framer text layers, CMS-rendered rich text, and any component\n// added later.\n//\n// SAFETY: the selector deliberately excludes <svg> and everything inside it, so\n// icon components (Phosphor and friends) are untouched. `:where()` keeps\n// specificity at zero; the override comes from !important alone, so anything\n// you genuinely need in another face can still win via the Exclude Selector\n// escape hatch below, or by turning Enforce off.\nimport{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect}from\"react\";import{addPropertyControls,ControlType}from\"framer\";const TEXT_ELEMENTS=[\"h1\",\"h2\",\"h3\",\"h4\",\"h5\",\"h6\",\"p\",\"a\",\"span\",\"li\",\"td\",\"th\",\"dt\",\"dd\",\"figcaption\",\"blockquote\",\"strong\",\"em\",\"b\",\"i\",\"small\",\"label\",\"button\",\"input\",\"textarea\",\"select\",\"div\"].join(\",\");const DEFAULT_HREF=\"https://fonts.googleapis.com/css2?family=Montserrat:ital,wght@0,300..800;1,300..800&display=swap\";const LINK_ID=\"exc-font-guard-webfont\";/**\n * Excelerate Font Guard\n *\n * @framerIntrinsicWidth 1\n * @framerIntrinsicHeight 1\n *\n * @framerSupportedLayoutWidth fixed\n * @framerSupportedLayoutHeight fixed\n * @framerDisableUnlink\n */export default function ExcFontGuard(props){const{fontStack=`Montserrat, \"Montserrat Placeholder\", sans-serif`,enabled=true,loadWebfont=true,webfontHref=DEFAULT_HREF,excludeSelector=\"\",style}=props;// Put a real @font-face source on the page. Without this the rule below\n// names a family the browser does not have and quietly falls back.\n// Idempotent: several instances (or several breakpoints) share one link.\nuseEffect(()=>{if(typeof document===\"undefined\")return;if(!enabled||!loadWebfont)return;const href=String(webfontHref).trim();if(!href)return;const head=document.head||document.documentElement;if(!document.getElementById(LINK_ID+\"-pre\")){const pre=document.createElement(\"link\");pre.id=LINK_ID+\"-pre\";pre.rel=\"preconnect\";pre.href=\"https://fonts.gstatic.com\";pre.crossOrigin=\"anonymous\";head.appendChild(pre);}let link=document.getElementById(LINK_ID);if(!link){link=document.createElement(\"link\");link.id=LINK_ID;link.rel=\"stylesheet\";head.appendChild(link);}if(link.href!==href)link.href=href;// Deliberately not removed on unmount: other instances and later\n// navigations rely on it, and a stray stylesheet link costs nothing.\n},[enabled,loadWebfont,webfontHref]);if(!enabled)return /*#__PURE__*/_jsx(\"div\",{style:{...style,width:1,height:1}});const skip=String(excludeSelector).trim();const not=`:not(svg):not(svg *)${skip?`:not(${skip}):not(${skip} *)`:\"\"}`;const css=`\nbody :where(${TEXT_ELEMENTS})${not}{font-family:${fontStack} !important}\nbody{font-family:${fontStack}}\n`;return /*#__PURE__*/_jsx(\"div\",{\"aria-hidden\":\"true\",style:{...style,width:1,height:1,overflow:\"hidden\",pointerEvents:\"none\"},children:/*#__PURE__*/_jsx(\"style\",{children:css})});}addPropertyControls(ExcFontGuard,{enabled:{type:ControlType.Boolean,title:\"Enforce\",defaultValue:true,enabledTitle:\"On\",disabledTitle:\"Off\",description:\"Turn off to let each component use its own font settings again.\"},fontStack:{type:ControlType.String,title:\"Font Stack\",defaultValue:`Montserrat, \"Montserrat Placeholder\", sans-serif`,description:\"The CSS font stack applied to every text element on the page.\"},loadWebfont:{type:ControlType.Boolean,title:\"Load Face\",defaultValue:true,enabledTitle:\"Yes\",disabledTitle:\"No\",description:\"Adds a real @font-face source so the family exists even on pages built only from code components.\"},webfontHref:{type:ControlType.String,title:\"Face URL\",defaultValue:DEFAULT_HREF,hidden:p=>p.loadWebfont===false,description:\"Stylesheet that defines the family. Google Fonts by default.\"},excludeSelector:{type:ControlType.String,title:\"Exclude Selector\",defaultValue:\"\",placeholder:\"e.g. .keep-this-font\",description:\"Optional CSS selector to leave alone. SVG and its contents are always excluded.\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"ExcFontGuard\",\"slots\":[],\"annotations\":{\"framerIntrinsicWidth\":\"1\",\"framerDisableUnlink\":\"\",\"framerIntrinsicHeight\":\"1\",\"framerSupportedLayoutHeight\":\"fixed\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ExcFontGuard.map"],"mappings":"A,qKAyCG,SAAwBO,EAAa,EAAM,CAAC,GAAK,CAAC,YAAU,mDAAmD,UAAQ,GAAK,cAAY,GAAK,cAAYC,EAAa,kBAAgB,GAAG,SAAOC,EAK9J,GAFrCL,MAAc,CAA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