1 line
6.1 KiB
JavaScript
1 line
6.1 KiB
JavaScript
import{p as r,f as s,a as o}from"./props-b4vEeO_8.js";import{o as J}from"./index-client-BAw8T8-V.js";import{G as N,B as R,F as h,I as k,a3 as j,a4 as D,k as p,J as u,N as E}from"./runtime-C3rQLW--.js";import{i as y,s as K}from"./svelte-component-C8Ginrj8.js";import{s as x}from"./attributes-Cg6aLqN3.js";import{s as L}from"./style-DvJ3IcV1.js";import{b as Q}from"./this-CrUBQEQ_.js";import{B as _}from"./Block-D3Ui8rd-.js";import{P as X}from"./PaddingReset-_TGvg1_B.js";var Y=s('<img class="w-full my-0"/>'),Z=s('<div class="placeholder w-full svelte-g9m2b0"></div>'),$=s("<figcaption> </figcaption>"),ee=s('<div class="alt-warning absolute text-xxs py-1 px-2 svelte-g9m2b0">altText</div>'),te=s('<figure aria-label="media" class="w-full flex flex-col relative"><!> <!> <!></figure>');function ie(I,e){R(e,!0);let P=r(e,"id",3,""),z=r(e,"class",3,""),S=r(e,"height",3,100),f=r(e,"width",3,"normal"),A=r(e,"textWidth",3,"normal"),m=r(e,"lazy",3,!0),O=r(e,"top",3,0),W=r(e,"bottom",3,0),V=r(e,"left",3,0),F=r(e,"right",3,0),d=D(!1),n;const v=typeof IntersectionObserver<"u";J(()=>{if(m()&&v){const c=`${W()}px ${V()}px ${O()}px ${F()}px`,l=new IntersectionObserver(a=>{j(d,a[0].isIntersecting,!0),p(d)&&l.unobserve(n)},{rootMargin:c});return l.observe(n),()=>l.unobserve(n)}}),_(I,{get width(){return f()},get class(){return`photo fmy-6 ${z()??""}`},get id(){return P()},children:(c,l)=>{var a=te(),g=k(a);{var M=t=>{var i=Y();u(()=>{x(i,"src",e.src),x(i,"alt",e.altText)}),o(t,i)},T=t=>{var i=Z();u(()=>L(i,`height: ${S()}px;`)),o(t,i)};y(g,t=>{!m()||v&&p(d)?t(M):t(T,!1)})}var b=h(g,2);{var U=t=>{{let i=E(()=>f()==="fluid");X(t,{get containerIsFluid(){return p(i)},children:(q,re)=>{_(q,{get width(){return A()},class:"notes w-full fmy-0",children:(G,ne)=>{var w=$(),H=k(w);u(()=>K(H,e.caption)),o(G,w)},$$slots:{default:!0}})},$$slots:{default:!0}})}};y(b,t=>{e.caption&&t(U)})}var B=h(b,2);{var C=t=>{var i=ee();o(t,i)};y(B,t=>{e.altText||t(C)})}Q(a,t=>n=t,()=>n),o(c,a)},$$slots:{default:!0}}),N()}ie.__docgen={data:[{name:"src",visibility:"public",description:"Photo source",keywords:[{name:"required",description:""}],kind:"let",type:{kind:"type",type:"string",text:"string"},static:!1,readonly:!1},{name:"altText",visibility:"public",description:"Photo altText",keywords:[{name:"required",description:""}],kind:"let",type:{kind:"type",type:"string",text:"string"},static:!1,readonly:!1},{name:"id",visibility:"public",description:"Add an id to target with custom CSS.",keywords:[],kind:"let",type:{kind:"type",type:"string",text:"string"},static:!1,readonly:!1,defaultValue:'""'},{name:"class",visibility:"public",description:"Add classes to target with custom CSS.",keywords:[],kind:"let",type:{kind:"type",type:"string",text:"string"},static:!1,readonly:!1},{name:"caption",visibility:"public",description:"Photo caption",keywords:[],kind:"let",type:{kind:"type",type:"string",text:"string"},static:!1,readonly:!1},{name:"height",visibility:"public",description:"Height of the photo placeholder when lazy-loading",keywords:[],kind:"let",type:{kind:"type",type:"number",text:"number"},static:!1,readonly:!1,defaultValue:"100"},{name:"width",visibility:"public",description:"Width of the container: normal, wide, wider, widest or fluid",keywords:[],kind:"let",type:{kind:"union",type:[{kind:"const",type:"string",value:"narrower",text:'"narrower"'},{kind:"const",type:"string",value:"narrow",text:'"narrow"'},{kind:"const",type:"string",value:"normal",text:'"normal"'},{kind:"const",type:"string",value:"wide",text:'"wide"'},{kind:"const",type:"string",value:"wider",text:'"wider"'},{kind:"const",type:"string",value:"widest",text:'"widest"'},{kind:"const",type:"string",value:"fluid",text:'"fluid"'}],text:'"narrower" | "narrow" | "normal" | "wide" | "wider" | "widest" | "fluid"'},static:!1,readonly:!1,defaultValue:'"normal"'},{name:"textWidth",visibility:"public",description:'Set a different width for the text vs the photo. For example, "normal" to keep the title, description and notes inline with the rest of the text well. Can\'t ever be wider than `width`.',keywords:[],kind:"let",type:{kind:"union",type:[{kind:"const",type:"string",value:"narrower",text:'"narrower"'},{kind:"const",type:"string",value:"narrow",text:'"narrow"'},{kind:"const",type:"string",value:"normal",text:'"normal"'},{kind:"const",type:"string",value:"wide",text:'"wide"'},{kind:"const",type:"string",value:"wider",text:'"wider"'},{kind:"const",type:"string",value:"widest",text:'"widest"'},{kind:"const",type:"string",value:"fluid",text:'"fluid"'}],text:'"narrower" | "narrow" | "normal" | "wide" | "wider" | "widest" | "fluid"'},static:!1,readonly:!1,defaultValue:'"normal"'},{name:"lazy",visibility:"public",description:"Whether to lazy load the photo using the [Intersection Observer API](https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API)",keywords:[],kind:"let",type:{kind:"type",type:"boolean",text:"boolean"},static:!1,readonly:!1,defaultValue:"true"},{name:"top",visibility:"public",description:"Set Intersection Observer [rootMargin](https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API#rootmargin) `top` when lazy loading.",keywords:[],kind:"let",type:{kind:"type",type:"number",text:"number"},static:!1,readonly:!1,defaultValue:"0"},{name:"bottom",visibility:"public",description:"Set Intersection Observer [rootMargin](https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API#rootmargin) `bottom` when lazy loading.",keywords:[],kind:"let",type:{kind:"type",type:"number",text:"number"},static:!1,readonly:!1,defaultValue:"0"},{name:"left",visibility:"public",description:"Set Intersection Observer [rootMargin](https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API#rootmargin) `left` when lazy loading.",keywords:[],kind:"let",type:{kind:"type",type:"number",text:"number"},static:!1,readonly:!1,defaultValue:"0"},{name:"right",visibility:"public",description:"Set Intersection Observer [rootMargin](https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API#rootmargin) `right` when lazy loading.",keywords:[],kind:"let",type:{kind:"type",type:"number",text:"number"},static:!1,readonly:!1,defaultValue:"0"}],name:"FeaturePhoto.svelte"};export{ie as F};
|