@reuters-graphics/graphics-components 3.4.1 → 3.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,30 @@
1
+ /**
2
+ * A manually authored referral, used to populate `ReferralBlock` with your own
3
+ * stories instead of fetching recent stories from Reuters.com.
4
+ */
5
+ export interface ReferralItem {
6
+ /** URL the referral links to. Used as-is, so include the full address. */
7
+ url: string;
8
+ /** Kicker or category text shown above the title. */
9
+ kicker: string;
10
+ /** Headline text for the referral. */
11
+ title: string;
12
+ /** URL of the thumbnail image. */
13
+ imageUrl: string;
14
+ /** Alt text for the thumbnail image. */
15
+ imageAlt?: string;
16
+ /**
17
+ * Publish time shown beneath the title. Accepts a `Date` or any value the
18
+ * `Date` constructor understands (e.g. an ISO string). Omit to hide the time.
19
+ */
20
+ time?: Date | string | number;
21
+ }
22
+ /**
23
+ * Anchor [target](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#attr-target)
24
+ * for a referral link. The standard keywords are suggested, but any named
25
+ * browsing context is allowed.
26
+ */
27
+ export type LinkTarget = '_self' | '_blank' | '_parent' | '_top' | (string & {});
1
28
  export interface Referrals {
2
29
  statusCode: number;
3
30
  message: string;
@@ -30,7 +57,7 @@ export interface Article {
30
57
  authors: Author[];
31
58
  kicker: Kicker;
32
59
  content_elements: unknown[];
33
- headline_category?: unknown;
60
+ headline_category?: string;
34
61
  content?: {
35
62
  third_party?: unknown;
36
63
  };
@@ -79,6 +79,12 @@
79
79
  textWidth?: ContainerWidth;
80
80
  /** Callback function that receives the map instance when ready */
81
81
  onMapReady?: (map: maplibregl.Map) => void;
82
+ /**
83
+ * Optional content rendered inside the map's `GraphicBlock`, directly above
84
+ * the map. Use it to share a single block — with one title and the standard
85
+ * spacing — between the map and an accompanying element such as a `Legend`.
86
+ */
87
+ legend?: Snippet;
82
88
  /** Child components (e.g., TileMapLayer) */
83
89
  children?: Snippet;
84
90
  }
@@ -99,6 +105,7 @@
99
105
  width = 'normal',
100
106
  textWidth = 'normal',
101
107
  onMapReady,
108
+ legend,
102
109
  children,
103
110
  }: Props = $props();
104
111
 
@@ -174,6 +181,11 @@
174
181
  </script>
175
182
 
176
183
  <GraphicBlock {width} {textWidth} {title} {description} {notes}>
184
+ {#if legend}
185
+ <div class="map-legend">
186
+ {@render legend()}
187
+ </div>
188
+ {/if}
177
189
  <div class="map" {id}>
178
190
  <div
179
191
  bind:this={mapContainer}
@@ -196,4 +208,9 @@
196
208
  width: 100%;
197
209
  position: relative;
198
210
  }
211
+
212
+ /* Sit the legend snug above the map, sharing the block's spacing. */
213
+ .map-legend {
214
+ margin-bottom: 0.5rem;
215
+ }
199
216
  </style>
@@ -59,6 +59,12 @@ interface Props {
59
59
  textWidth?: ContainerWidth;
60
60
  /** Callback function that receives the map instance when ready */
61
61
  onMapReady?: (map: maplibregl.Map) => void;
62
+ /**
63
+ * Optional content rendered inside the map's `GraphicBlock`, directly above
64
+ * the map. Use it to share a single block — with one title and the standard
65
+ * spacing — between the map and an accompanying element such as a `Legend`.
66
+ */
67
+ legend?: Snippet;
62
68
  /** Child components (e.g., TileMapLayer) */
63
69
  children?: Snippet;
64
70
  }
package/dist/index.d.ts CHANGED
@@ -7,6 +7,9 @@ export { default as BlogPost } from './components/BlogPost/BlogPost.svelte';
7
7
  export { default as BlogTOC } from './components/BlogTOC/BlogTOC.svelte';
8
8
  export { default as AdScripts } from './components/AdSlot/AdScripts.svelte';
9
9
  export { default as BeforeAfter } from './components/BeforeAfter/BeforeAfter.svelte';
10
+ export { default as Bio } from './components/BioBox/Bio.svelte';
11
+ export { default as BioBox } from './components/BioBox/BioBox.svelte';
12
+ export { default as SocialLinks } from './components/BioBox/SocialLinks.svelte';
10
13
  export { default as Block } from './components/Block/Block.svelte';
11
14
  export { default as ClockWall } from './components/ClockWall/ClockWall.svelte';
12
15
  export { default as BodyText } from './components/BodyText/BodyText.svelte';
@@ -29,6 +32,7 @@ export { default as InlineAd } from './components/AdSlot/InlineAd.svelte';
29
32
  export { default as KinesisLogo } from './components/KinesisLogo/KinesisLogo.svelte';
30
33
  export { default as LanguageButton } from './components/LanguageButton/LanguageButton.svelte';
31
34
  export { default as LeaderboardAd } from './components/AdSlot/LeaderboardAd.svelte';
35
+ export { default as Legend } from './components/Legend/Legend.svelte';
32
36
  export { default as TileMap } from './components/TileMap/TileMap.svelte';
33
37
  export { default as TileMapLayer } from './components/TileMap/TileMapLayer.svelte';
34
38
  export { default as PaddingReset } from './components/PaddingReset/PaddingReset.svelte';
@@ -36,6 +40,7 @@ export { default as PhotoPack } from './components/PhotoPack/PhotoPack.svelte';
36
40
  export { default as PymChild } from './components/PymChild/PymChild.svelte';
37
41
  export { pym } from './components/PymChild/state.svelte';
38
42
  export { default as ReferralBlock } from './components/ReferralBlock/ReferralBlock.svelte';
43
+ export { default as Referral } from './components/ReferralBlock/Referral.svelte';
39
44
  export { default as ReutersGraphicsLogo } from './components/ReutersGraphicsLogo/ReutersGraphicsLogo.svelte';
40
45
  export { default as ReutersLogo } from './components/ReutersLogo/ReutersLogo.svelte';
41
46
  export { default as Scroller } from './components/Scroller/Scroller.svelte';
@@ -58,4 +63,8 @@ export { default as ToolsHeader } from './components/ToolsHeader/ToolsHeader.sve
58
63
  export { default as Video } from './components/Video/Video.svelte';
59
64
  export { default as Visible } from './components/Visible/Visible.svelte';
60
65
  export type { ContainerWidth, HeadlineSize, ScrollerVideoInstance, } from './components/@types/global';
66
+ export type { ReferralItem } from './components/ReferralBlock/types';
67
+ export type { LinkTarget } from './components/ReferralBlock/types';
68
+ export type { Author, SocialLink, SocialPlatform, } from './components/BioBox/types';
61
69
  export type { GeocodeOptions, GeocodeFeature, GeocodeFeatureType, } from './components/Geocoder/geocode';
70
+ export type { LegendMode, LegendFormatter, LegendItem, LegendStop, LegendTick, LegendMidpoint, LegendSymbolItem, LegendNoData, } from './components/Legend/Legend.svelte';
package/dist/index.js CHANGED
@@ -10,6 +10,9 @@ export { default as BlogPost } from './components/BlogPost/BlogPost.svelte';
10
10
  export { default as BlogTOC } from './components/BlogTOC/BlogTOC.svelte';
11
11
  export { default as AdScripts } from './components/AdSlot/AdScripts.svelte';
12
12
  export { default as BeforeAfter } from './components/BeforeAfter/BeforeAfter.svelte';
13
+ export { default as Bio } from './components/BioBox/Bio.svelte';
14
+ export { default as BioBox } from './components/BioBox/BioBox.svelte';
15
+ export { default as SocialLinks } from './components/BioBox/SocialLinks.svelte';
13
16
  export { default as Block } from './components/Block/Block.svelte';
14
17
  export { default as ClockWall } from './components/ClockWall/ClockWall.svelte';
15
18
  export { default as BodyText } from './components/BodyText/BodyText.svelte';
@@ -32,6 +35,7 @@ export { default as InlineAd } from './components/AdSlot/InlineAd.svelte';
32
35
  export { default as KinesisLogo } from './components/KinesisLogo/KinesisLogo.svelte';
33
36
  export { default as LanguageButton } from './components/LanguageButton/LanguageButton.svelte';
34
37
  export { default as LeaderboardAd } from './components/AdSlot/LeaderboardAd.svelte';
38
+ export { default as Legend } from './components/Legend/Legend.svelte';
35
39
  export { default as TileMap } from './components/TileMap/TileMap.svelte';
36
40
  export { default as TileMapLayer } from './components/TileMap/TileMapLayer.svelte';
37
41
  export { default as PaddingReset } from './components/PaddingReset/PaddingReset.svelte';
@@ -39,6 +43,7 @@ export { default as PhotoPack } from './components/PhotoPack/PhotoPack.svelte';
39
43
  export { default as PymChild } from './components/PymChild/PymChild.svelte';
40
44
  export { pym } from './components/PymChild/state.svelte';
41
45
  export { default as ReferralBlock } from './components/ReferralBlock/ReferralBlock.svelte';
46
+ export { default as Referral } from './components/ReferralBlock/Referral.svelte';
42
47
  export { default as ReutersGraphicsLogo } from './components/ReutersGraphicsLogo/ReutersGraphicsLogo.svelte';
43
48
  export { default as ReutersLogo } from './components/ReutersLogo/ReutersLogo.svelte';
44
49
  export { default as Scroller } from './components/Scroller/Scroller.svelte';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reuters-graphics/graphics-components",
3
- "version": "3.4.1",
3
+ "version": "3.6.0",
4
4
  "type": "module",
5
5
  "private": false,
6
6
  "homepage": "https://reuters-graphics.github.io/graphics-components",