{"version":3,"file":"PlantaImage.cZBbYkgl.mjs","names":["useRef"],"sources":["https:/framerusercontent.com/modules/EpU52OlGTUzyf46xOfr1/3xLuEf1pMMyy0Su8Pxsu/PlantaImage.js"],"sourcesContent":["// Planta template · Responsive photo with focal point, priority loading and reveal/parallax. Edit: Image, Alt, Priority, Focal X/Y, Sizes, Max file, Reveal.\n// Planta — Image. A plain <img> with the loading behaviour Framer's image fills don't expose (rule 2):\n// Priority = eager + fetchpriority=\"high\" (hero / LCP), otherwise loading=\"lazy\". Explicit width/height\n// attributes (from the source's intrinsic size) prevent layout shift; object-fit cover + a focal point\n// keeps faces / the subject in frame at every breakpoint (rule 13). srcset uses Framer's resized copies.\n// The image is a component property, so swapping a photo is one place (rule 9).\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{addPropertyControls,ControlType,RenderTarget}from\"framer\";import{useEffect,useRef}from\"react\";const WIDTHS=[128,256,512,640,768,1024,1536,2048];const PIXEL=\"data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==\";// cap (Max file, px): largest file offered. Framer sometimes composes `sizes` as max(desktop, breakpoint) when the\n// same photo has a desktop and a mobile instance — a cap on the mobile instance keeps phones off the big files.\nfunction buildSrcSet(src,max,cap=0){if(!/framerusercontent\\.com\\/images\\//.test(src))return undefined;const base=src.split(\"?\")[0];if(cap>0&&cap<max)return WIDTHS.filter(w=>w<=cap).map(w=>`${base}?scale-down-to=${w} ${w}w`).join(\", \");const list=WIDTHS.filter(w=>w<max).map(w=>`${base}?scale-down-to=${w} ${w}w`);list.push(`${base} ${max}w`);return list.join(\", \");}const clamp01=v=>v<0?0:v>1?1:v;function paint(it,vh){const r=it.el.getBoundingClientRect();const p=it.clip?clamp01((vh-r.top)/(vh*.55)):1;const q=clamp01((vh-r.top)/(vh+r.height));const st=it.el.style;st.setProperty(\"--pi-p\",p.toFixed(4));st.setProperty(\"--pi-y\",it.parallax?((.5-q)*8).toFixed(3)+\"%\":\"0%\");st.setProperty(\"--pi-s\",((it.parallax?1.1:1)+(1-p)*.12).toFixed(4));}/** Shared scroll ticker for scrubbed photo motion (one per page, created by the first photo that needs it).\n *  Vertical position only — photos inside horizontal sliders (off-screen sideways, clipped by the slider) are still\n *  updated (an IntersectionObserver never reports them, which left them clipped — Task 14 sweep). One rAF loop;\n *  work happens only when scrollY / innerHeight changed, and only for photos within ±25% of the viewport. */function scrubber(){const w=window;if(w.__plantaScrub)return w.__plantaScrub;const items=new Set;let raf=0;let lastY=NaN;let lastH=NaN;const tick=()=>{raf=0;if(!items.size)return;const y=window.scrollY;const h=window.innerHeight;if(y!==lastY||h!==lastH){lastY=y;lastH=h;items.forEach(it=>{const r=it.el.getBoundingClientRect();if(r.bottom>-h*.25&&r.top<h*1.25)paint(it,h);else if(r.bottom<=-h*.25&&it.clip&&it.el.style.getPropertyValue(\"--pi-p\")!==\"1.0000\")paint(it,h)// passed above: settle open\n;});}raf=requestAnimationFrame(tick);};w.__plantaScrub={add:it=>{items.add(it);paint(it,window.innerHeight);lastY=NaN;if(!raf)raf=requestAnimationFrame(tick);},remove:it=>{items.delete(it);}};return w.__plantaScrub;}/**\n * Planta Image\n *\n * @framerIntrinsicWidth 440\n * @framerIntrinsicHeight 600\n *\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight any-prefer-fixed\n */export default function PlantaImage(props){const{image,alt=\"\",priority=false,focalX=50,focalY=50,intrinsicWidth=2048,intrinsicHeight=2048,sizes=\"100vw\",radius=0,skipBelow=0,maxFile=0,reveal=\"none\",parallax=false,style}=props;// Motion 2.0 (Task 14): image motion is SCRUBBED by the scroll position (tied to the wheel / Lenis), not one-shot.\n//   \"clip\"    — the photo opens bottom-up while its top travels from the viewport bottom to 45% of the height\n//               (clip-path inset + a 1.12 → 1 zoom), and closes again when scrolling back. Photos already in\n//               the viewport at hydration are never clipped (nothing above the fold starts hidden).\n//   parallax  — the image drifts ±4% inside its frame over the whole pass through the viewport (scale 1.1, so\n//               no edge ever shows).\n//   \"load\"    — hero only: plays on load (CSS keyframes), not scrubbed.\n// One shared ticker (window.__plantaScrub): a rAF loop updates the photos near the viewport, only when the\n// scroll position or viewport changed. It writes CSS variables\n// (--pi-p, --pi-y, --pi-s) read by <style id=\"planta-motion-2\"> under [data-pi-scrub]. No JS / SSR /\n// reduced motion → the attribute is never set → the photo is static and fully visible.\nconst ref=useRef(null);useEffect(()=>{const el=ref.current;const wantsClip=reveal===\"clip\";if(!el||!wantsClip&&!parallax||RenderTarget.current()===RenderTarget.canvas||window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches)return;const clip=wantsClip&&el.getBoundingClientRect().top>window.innerHeight;if(!clip&&!parallax)return;const item={el,img:el.querySelector(\"img\"),clip,parallax};el.setAttribute(\"data-pi-scrub\",\"\");const s=scrubber();s.add(item);return()=>{s.remove(item);el.removeAttribute(\"data-pi-scrub\");};},[reveal,parallax]);const src=image?.src||\"\";// Always our own srcset (down to 128w) so small slots (avatars) fetch small files.\nconst srcSet=(src?buildSrcSet(src,intrinsicWidth,maxFile):undefined)||image?.srcSet;return /*#__PURE__*/_jsx(\"div\",{ref:ref,\"data-pi-reveal\":reveal===\"none\"?undefined:reveal,\"data-pi-parallax\":parallax?\"\":undefined,style:{position:\"relative\",...style,overflow:\"hidden\",borderRadius:radius},children:src?/*#__PURE__*/_jsxs(\"picture\",{children:[skipBelow>0?/*#__PURE__*/_jsx(\"source\",{media:`(max-width: ${skipBelow-.02}px)`,srcSet:PIXEL}):null,/*#__PURE__*/_jsx(\"img\",{src:src,srcSet:srcSet,sizes:sizes,alt:alt||image?.alt||\"\",width:intrinsicWidth,height:intrinsicHeight,loading:priority?\"eager\":\"lazy\",decoding:priority?\"sync\":\"async\",...{fetchpriority:priority?\"high\":\"auto\"},style:{position:\"absolute\",inset:0,width:\"100%\",height:\"100%\",objectFit:\"cover\",objectPosition:`${focalX}% ${focalY}%`,display:\"block\"}})]}):null});}addPropertyControls(PlantaImage,{image:{type:ControlType.ResponsiveImage,title:\"Image\"},alt:{type:ControlType.String,title:\"Alt\",defaultValue:\"\"},priority:{type:ControlType.Boolean,title:\"Priority (LCP)\",defaultValue:false},focalX:{type:ControlType.Number,title:\"Focal X\",defaultValue:50,min:0,max:100,unit:\"%\"},focalY:{type:ControlType.Number,title:\"Focal Y\",defaultValue:50,min:0,max:100,unit:\"%\"},intrinsicWidth:{type:ControlType.Number,title:\"Source W\",defaultValue:2048,min:1,max:8e3,step:1},intrinsicHeight:{type:ControlType.Number,title:\"Source H\",defaultValue:2048,min:1,max:8e3,step:1},sizes:{type:ControlType.String,title:\"Sizes\",defaultValue:\"100vw\"},radius:{type:ControlType.Number,title:\"Radius\",defaultValue:0,min:0,max:999},skipBelow:{type:ControlType.Number,title:\"Skip below\",defaultValue:0,min:0,max:2e3,step:1,unit:\"px\"},maxFile:{type:ControlType.Number,title:\"Max file\",defaultValue:0,min:0,max:2048,step:1,unit:\"px\"},reveal:{type:ControlType.Enum,title:\"Reveal\",options:[\"none\",\"clip\",\"load\"],optionTitles:[\"None\",\"Clip on scroll\",\"Hero load\"],defaultValue:\"none\"},parallax:{type:ControlType.Boolean,title:\"Parallax\",defaultValue:false}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"PlantaImage\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerIntrinsicHeight\":\"600\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"any-prefer-fixed\",\"framerIntrinsicWidth\":\"440\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./PlantaImage.map"],"mappings":"6MAQA,SAAS,EAAY,EAAI,EAAI,EAAI,EAAE,CAAC,GAAG,CAAC,mCAAmC,KAAK,CAAG,EAAE,OAAiB,IAAM,EAAK,EAAI,MAAM,GAAG,CAAC,CAAC,GAAG,GAAG,EAAI,GAAG,EAAI,EAAI,OAAO,E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