25 lines
4.9 KiB
JavaScript
25 lines
4.9 KiB
JavaScript
import{S as C,i as S,s as M,c as p,m as d,t as f,a as m,d as $,D as q,h as _,r as A,u as B,k as g,K as F,q as D,o as w,f as E,j as P,l as I}from"./index-C9aKRT5A.js";import{g as K,a as O}from"./spread-CgU5AtxT.js";import{p as z,w as G,M as H,T as J,S as L}from"./collect-stories-ceFdpR5E.js";import{e as N}from"./each-D6YF6ztN.js";import{B as Q}from"./Block-C7biTRWl.js";import{M as v}from"./Markdown-BNYiGaXJ.js";const R=`End notes includes notes to the main article — usually things like sources, clarifiying notes and minor corrections at the end of a story.
|
|
|
|
\`\`\`svelte
|
|
<script>
|
|
import { EndNotes } from '@reuters-graphics/graphics-components';
|
|
|
|
const notes = [
|
|
{
|
|
title: 'Note',
|
|
text: 'Data is current as of today.',
|
|
},
|
|
{
|
|
title: 'Sources',
|
|
text: 'Data, Inc.',
|
|
},
|
|
{
|
|
title: 'Edited by',
|
|
text: '<a href="https://www.reuters.com/graphics/">Editor</a>, Copyeditor',
|
|
},
|
|
];
|
|
<\/script>
|
|
|
|
<EndNotes notes="{notes}" />
|
|
\`\`\`
|
|
`;function b(i,n,a){const e=i.slice();return e[1]=n[a],e}function T(i){let n,a,e=N(i[0]),t=[];for(let l=0;l<e.length;l+=1)t[l]=x(b(i,e,l));const s=l=>m(t[l],1,1,()=>{t[l]=null});return{c(){for(let l=0;l<t.length;l+=1)t[l].c();n=q()},m(l,c){for(let o=0;o<t.length;o+=1)t[o]&&t[o].m(l,c);_(l,n,c),a=!0},p(l,c){if(c&1){e=N(l[0]);let o;for(o=0;o<e.length;o+=1){const r=b(l,e,o);t[o]?(t[o].p(r,c),f(t[o],1)):(t[o]=x(r),t[o].c(),f(t[o],1),t[o].m(n.parentNode,n))}for(A(),o=e.length;o<t.length;o+=1)s(o);B()}},i(l){if(!a){for(let c=0;c<e.length;c+=1)f(t[c]);a=!0}},o(l){t=t.filter(Boolean);for(let c=0;c<t.length;c+=1)m(t[c]);a=!1},d(l){l&&g(n),F(t,l)}}}function x(i){let n,a,e,t,s,l,c;return a=new v({props:{source:i[1].title}}),s=new v({props:{source:i[1].text}}),{c(){n=D("div"),p(a.$$.fragment),e=w(),t=D("div"),p(s.$$.fragment),l=w(),E(n,"class","note-title svelte-1rn1hl4"),E(t,"class","note-content svelte-1rn1hl4")},m(o,r){_(o,n,r),d(a,n,null),_(o,e,r),_(o,t,r),d(s,t,null),P(t,l),c=!0},p(o,r){const u={};r&1&&(u.source=o[1].title),a.$set(u);const h={};r&1&&(h.source=o[1].text),s.$set(h)},i(o){c||(f(a.$$.fragment,o),f(s.$$.fragment,o),c=!0)},o(o){m(a.$$.fragment,o),m(s.$$.fragment,o),c=!1},d(o){o&&(g(n),g(e),g(t)),$(a),$(s)}}}function U(i){let n,a,e=i[0]&&T(i);return{c(){e&&e.c(),n=q()},m(t,s){e&&e.m(t,s),_(t,n,s),a=!0},p(t,s){t[0]?e?(e.p(t,s),s&1&&f(e,1)):(e=T(t),e.c(),f(e,1),e.m(n.parentNode,n)):e&&(A(),m(e,1,1,()=>{e=null}),B())},i(t){a||(f(e),a=!0)},o(t){m(e),a=!1},d(t){t&&g(n),e&&e.d(t)}}}function V(i){let n,a;return n=new Q({props:{class:"notes fmt-6 fmb-8",$$slots:{default:[U]},$$scope:{ctx:i}}}),{c(){p(n.$$.fragment)},m(e,t){d(n,e,t),a=!0},p(e,[t]){const s={};t&17&&(s.$$scope={dirty:t,ctx:e}),n.$set(s)},i(e){a||(f(n.$$.fragment,e),a=!0)},o(e){m(n.$$.fragment,e),a=!1},d(e){$(n,e)}}}function W(i,n,a){let{notes:e=[]}=n;return i.$$set=t=>{"notes"in t&&a(0,e=t.notes)},[e]}class k extends C{constructor(n){super(),S(this,n,W,V,M,{notes:0})}}k.__docgen={version:3,name:"EndNotes.svelte",data:[{keywords:[{name:"required",description:""}],visibility:"public",description:"An array of endnote items.",name:"notes",kind:"let",static:!1,readonly:!1,type:{kind:"type",text:"array",type:"array"}}],computed:[],methods:[],components:[],description:null,keywords:[],events:[],slots:[],refs:[]};const X=i=>i.map(n=>({title:n.Title,text:n.Text}));function Y(i){let n,a;const e=[i[1]];let t={};for(let s=0;s<e.length;s+=1)t=I(t,e[s]);return n=new k({props:t}),{c(){p(n.$$.fragment)},m(s,l){d(n,s,l),a=!0},p(s,l){const c=l&2?K(e,[O(s[1])]):{};n.$set(c)},i(s){a||(f(n.$$.fragment,s),a=!0)},o(s){m(n.$$.fragment,s),a=!1},d(s){$(n,s)}}}function Z(i){let n,a,e,t,s,l;const c=[{title:"Components/EndNotes"},{component:k},G(R)];let o={};for(let r=0;r<c.length;r+=1)o=I(o,c[r]);return n=new H({props:o}),e=new J({props:{$$slots:{default:[Y,({args:r})=>({1:r}),({args:r})=>r?2:0]},$$scope:{ctx:i}}}),s=new L({props:{name:"Default",args:{notes:X(i[0])}}}),{c(){p(n.$$.fragment),a=w(),p(e.$$.fragment),t=w(),p(s.$$.fragment)},m(r,u){d(n,r,u),_(r,a,u),d(e,r,u),_(r,t,u),d(s,r,u),l=!0},p(r,[u]){const h={};n.$set(h);const y={};u&6&&(y.$$scope={dirty:u,ctx:r}),e.$set(y)},i(r){l||(f(n.$$.fragment,r),f(e.$$.fragment,r),f(s.$$.fragment,r),l=!0)},o(r){m(n.$$.fragment,r),m(e.$$.fragment,r),m(s.$$.fragment,r),l=!1},d(r){r&&(g(a),g(t)),$(n,r),$(e,r),$(s,r)}}}function ee(i){return[[{Title:"Note",Text:"Data is current as of today."},{Title:"Sources",Text:"Data, Inc."},{Title:"Edited by",Text:'<a href="https://www.reuters.com/graphics/">Editor</a>, Copyeditor'}]]}class te extends C{constructor(n){super(),S(this,n,ee,Z,M,{})}}const j=z(te,{meta:{title:"Components/EndNotes"},stories:{"tpl:default":{name:"default",template:!0,source:"<EndNotes {...args} />",hasArgs:!0},Default:{name:"Default",template:!1,source:"",hasArgs:!1}},allocatedIds:["default","Meta","Template","Story","componentDocs","EndNotes","getEndNotesPropsFromDoc","withComponentDocs"]}),ie=j.meta,ce=["Default"],fe=j.stories.Default;export{fe as Default,ce as __namedExportsOrder,ie as default};
|