hypnagaga/packages/graphics-components/docs/assets/Headline-C-tkYFZ6.js

1 line
6.2 KiB
JavaScript

import{p as o,f as c,a as n,c as y}from"./props-b4vEeO_8.js";import{h as K,G as N,B as Q,a3 as v,F as k,I as l,a4 as X,J as A,k as Y,C as m}from"./runtime-C3rQLW--.js";import{i as d,s as Z}from"./svelte-component-C8Ginrj8.js";import{s as b}from"./snippet-C5kbqVpq.js";import{c as $}from"./style-DvJ3IcV1.js";import{a as ee}from"./attributes-Cg6aLqN3.js";import{B as te}from"./Block-D3Ui8rd-.js";import{B as ie}from"./Byline-BhU2Zjcl.js";import{M as B}from"./Markdown-DUxFwijc.js";var ae=c('<div class="crown-container"><!></div>'),ne=c('<p class="section-title mb-0 font-subhed text-xs text-secondary font-bold uppercase whitespace-nowrap tracking-wider"> </p>'),se=c("<h1><!></h1>"),re=c('<div class="dek fmx-auto fmb-6"><!></div>'),le=c('<div class="dek fmx-auto fmb-6"><!></div>'),de=c('<header class="relative"><!> <div class="title"><!> <!> <!></div> <!></header>'),oe=c('<div class="headline-wrapper svelte-1fvnqbd" style="display:contents;"><!></div>');function ce(C,t){Q(t,!0);let g=o(t,"hed",3,"Reuters Graphics Interactive"),H=o(t,"class",3,""),O=o(t,"hedSize",3,"normal"),h=o(t,"authors",19,()=>[]),x=o(t,"publishTime",3,""),P=o(t,"updateTime",3,""),z=o(t,"width",3,"normal"),p=X("text-3xl");K(()=>{switch(O()){case"biggest":v(p,"text-6xl");break;case"bigger":v(p,"text-5xl");break;case"big":v(p,"text-4xl");break;case"small":v(p,"text-2xl");break;default:v(p,"text-3xl")}});var w=oe(),G=l(w);te(G,{get width(){return z()},get class(){return`headline text-center fmt-7 fmb-6 ${H()??""}`},children:(I,pe)=>{var _=de(),S=l(_);{var q=e=>{var i=ae(),a=l(i);b(a,()=>t.crown),n(e,i)};d(S,e=>{t.crown&&e(q)})}var T=k(S,2),R=l(T);{var M=e=>{var i=ne(),a=l(i);A(()=>Z(a,t.section)),n(e,i)};d(R,e=>{t.section&&e(M)})}var V=k(R,2);{var U=e=>{var i=se(),a=l(i);B(a,{get source(){return g()},inline:!0}),A(()=>ee(i,1,$(Y(p)),"svelte-1fvnqbd")),n(e,i)},D=e=>{var i=y(),a=m(i);{var u=s=>{var r=y(),f=m(r);b(f,g),n(s,r)};d(a,s=>{g()&&s(u)},!0)}n(e,i)};d(V,e=>{typeof g()=="string"?e(U):e(D,!1)})}var F=k(V,2);{var J=e=>{var i=re(),a=l(i);B(a,{get source(){return t.dek}}),n(e,i)},L=e=>{var i=y(),a=m(i);{var u=s=>{var r=le(),f=l(r);b(f,()=>t.dek),n(s,r)};d(a,s=>{t.dek&&s(u)},!0)}n(e,i)};d(F,e=>{typeof t.dek=="string"?e(J):e(L,!1)})}var W=k(T,2);{var j=e=>{ie(e,{cls:"fmy-4",get authors(){return h()},get publishTime(){return x()},get updateTime(){return P()},get getAuthorPage(){return t.getAuthorPage},get published(){return t.published},get updated(){return t.updated},align:"center"})},E=e=>{var i=y(),a=m(i);{var u=s=>{var r=y(),f=m(r);b(f,()=>t.byline),n(s,r)};d(a,s=>{t.byline&&s(u)},!0)}n(e,i)};d(W,e=>{h().length>0||x()?e(j):e(E,!1)})}n(I,_)},$$slots:{default:!0}}),n(C,w),N()}ce.__docgen={data:[{name:"hed",visibility:"public",description:"Headline, parsed as an _inline_ markdown string in an `h1` element OR as a custom snippet.",keywords:[],kind:"let",type:{kind:"union",type:[{kind:"type",type:"string",text:"string"},{kind:"function",text:"Snippet<[]>"}],text:"string | Snippet<[]>"},static:!1,readonly:!1,defaultValue:'"Reuters Graphics Interactive"'},{name:"class",visibility:"public",description:"Add extra classes to the block tag to target it with custom CSS.",keywords:[],kind:"let",type:{kind:"type",type:"string",text:"string"},static:!1,readonly:!1},{name:"hedSize",visibility:"public",description:"Headline size: small, normal, big, bigger, biggest",keywords:[],kind:"let",type:{kind:"union",type:[{kind:"const",type:"string",value:"small",text:'"small"'},{kind:"const",type:"string",value:"normal",text:'"normal"'},{kind:"const",type:"string",value:"big",text:'"big"'},{kind:"const",type:"string",value:"bigger",text:'"bigger"'},{kind:"const",type:"string",value:"biggest",text:'"biggest"'}],text:'"small" | "normal" | "big" | "bigger" | "biggest"'},static:!1,readonly:!1,defaultValue:'"normal"'},{name:"dek",visibility:"public",description:"Dek, parsed as a markdown string OR as a custom snippet.",keywords:[],kind:"let",type:{kind:"union",type:[{kind:"type",type:"string",text:"string"},{kind:"function",text:"Snippet<[]>"}],text:"string | Snippet<[]>"},static:!1,readonly:!1},{name:"section",visibility:"public",description:"Section title",keywords:[],kind:"let",type:{kind:"type",type:"string",text:"string"},static:!1,readonly:!1},{name:"authors",visibility:"public",description:"Array of author names, which will be slugified to create links to Reuters author pages",keywords:[],kind:"let",type:{kind:"type",type:"array",text:"string[]"},static:!1,readonly:!1,defaultValue:"[]"},{name:"publishTime",visibility:"public",description:"Publish time as a datetime string.",keywords:[],kind:"let",type:{kind:"type",type:"string",text:"string"},static:!1,readonly:!1,defaultValue:'""'},{name:"updateTime",visibility:"public",description:"Update time as a datetime string.",keywords:[],kind:"let",type:{kind:"type",type:"string",text:"string"},static:!1,readonly:!1,defaultValue:'""'},{name:"width",visibility:"public",description:"Width of the headline: normal, wide, wider, widest",keywords:[],kind:"let",type:{kind:"union",type:[{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"'}],text:'"normal" | "wide" | "wider" | "widest"'},static:!1,readonly:!1,defaultValue:'"normal"'},{name:"getAuthorPage",visibility:"public",description:"Custom function that returns an author page URL.",keywords:[],kind:"let",type:{kind:"function",text:"(author: string) => string"},static:!1,readonly:!1},{name:"crown",visibility:"public",description:"Custom crown snippet",keywords:[],kind:"let",type:{kind:"function",text:"Snippet<[]>"},static:!1,readonly:!1},{name:"byline",visibility:"public",description:"Optional snippet for a custom byline.",keywords:[],kind:"let",type:{kind:"function",text:"Snippet<[]>"},static:!1,readonly:!1},{name:"published",visibility:"public",description:"Optional snippet for a custom published dateline.",keywords:[],kind:"let",type:{kind:"function",text:"Snippet<[]>"},static:!1,readonly:!1},{name:"updated",visibility:"public",description:"Optional snippet for a custom updated dateline.",keywords:[],kind:"let",type:{kind:"function",text:"Snippet<[]>"},static:!1,readonly:!1}],name:"Headline.svelte"};export{ce as H};