@reuters-graphics/graphics-components 3.2.1 → 3.3.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.
@@ -0,0 +1,28 @@
1
+ declare const Clock: import("svelte").Component<{
2
+ /**
3
+ * The name of the clock (to be displayed), e.g. "New York"
4
+ */
5
+ name: string;
6
+ /**
7
+ * The UTC time to display, defaults to current time
8
+ */
9
+ UTCTime?: Date;
10
+ /**
11
+ * The timezone identifier, e.g. "America/New_York"
12
+ */
13
+ tzIdentifier: string;
14
+ /**
15
+ * Whether to show the clock, defaults to true
16
+ */
17
+ showClock?: boolean;
18
+ /**
19
+ * The weight of the clock, either "normal" or "bold"
20
+ */
21
+ clockWeight?: "Light" | "Normal" | "Bold";
22
+ /**
23
+ * The size of the clock, either "XS", "MD", "LG", or "XL"
24
+ */
25
+ clockSize?: "XS" | "MD" | "LG" | "XL";
26
+ }, {}, "">;
27
+ type Clock = ReturnType<typeof Clock>;
28
+ export default Clock;
@@ -0,0 +1,65 @@
1
+ <script lang="ts">
2
+ import type { ComponentProps } from 'svelte';
3
+ import type { ContainerWidth } from '../@types/global';
4
+ import Block from '../Block/Block.svelte';
5
+ import Clock from './Clock.svelte';
6
+
7
+ type ClockProps = ComponentProps<typeof Clock>;
8
+
9
+ interface City {
10
+ name: string;
11
+ tzIdentifier: string;
12
+ }
13
+
14
+ interface Props {
15
+ cities?: City[];
16
+ width?: ContainerWidth;
17
+ clockSize?: ClockProps['clockSize'];
18
+ clockWeight?: ClockProps['clockWeight'];
19
+ }
20
+
21
+ let {
22
+ cities = [
23
+ { name: 'Tehran', tzIdentifier: 'Asia/Tehran' },
24
+ { name: 'Tel Aviv', tzIdentifier: 'Asia/Tel_Aviv' },
25
+ { name: 'Washington D.C.', tzIdentifier: 'America/New_York' },
26
+ ],
27
+ width = 'normal',
28
+ clockSize = 'XS',
29
+ clockWeight = 'Bold',
30
+ }: Props = $props();
31
+ </script>
32
+
33
+ <Block {width}>
34
+ <div id="clock-group">
35
+ {#each cities as city (city.tzIdentifier)}
36
+ <Clock
37
+ name={city.name}
38
+ tzIdentifier={city.tzIdentifier}
39
+ {clockSize}
40
+ {clockWeight}
41
+ />
42
+ {/each}
43
+ </div>
44
+ </Block>
45
+
46
+ <style>/* Generated from
47
+ https://utopia.fyi/space/calculator/?c=320,18,1.125,1280,21,1.25,7,3,&s=0.75|0.5|0.25,1.5|2|3|4|6,s-l&g=s,l,xl,12
48
+ */
49
+ /* Generated from
50
+ https://utopia.fyi/space/calculator/?c=320,18,1.125,1280,21,1.25,7,3,&s=0.75|0.5|0.25,1.5|2|3|4|6,s-l&g=s,l,xl,12
51
+ */
52
+ /* Scales by 1.125 */
53
+ div#clock-group {
54
+ width: 100%;
55
+ margin: 0px auto;
56
+ display: flex;
57
+ flex-wrap: wrap;
58
+ gap: 10px 2rem;
59
+ justify-content: space-evenly;
60
+ }
61
+ @media (max-width: 659px) {
62
+ div#clock-group {
63
+ justify-content: center;
64
+ }
65
+ }</style>
@@ -0,0 +1,17 @@
1
+ import type { ComponentProps } from 'svelte';
2
+ import type { ContainerWidth } from '../@types/global';
3
+ import Clock from './Clock.svelte';
4
+ type ClockProps = ComponentProps<typeof Clock>;
5
+ interface City {
6
+ name: string;
7
+ tzIdentifier: string;
8
+ }
9
+ interface Props {
10
+ cities?: City[];
11
+ width?: ContainerWidth;
12
+ clockSize?: ClockProps['clockSize'];
13
+ clockWeight?: ClockProps['clockWeight'];
14
+ }
15
+ declare const ClockWall: import("svelte").Component<Props, {}, "">;
16
+ type ClockWall = ReturnType<typeof ClockWall>;
17
+ export default ClockWall;
@@ -0,0 +1,140 @@
1
+ <!-- @component `ReutersLogo` [Read the docs.](https://reuters-graphics.github.io/graphics-components/?path=/docs/components-logos-reuterslogo--docs) -->
2
+ <script lang="ts">
3
+ interface Props {
4
+ /** "Kinesis" colour */
5
+ colour?: string;
6
+ /** CSS width value */
7
+ width?: string;
8
+ }
9
+
10
+ let { colour = '#D64000', width = '100%' }: Props = $props();
11
+ </script>
12
+
13
+ <svg
14
+ aria-hidden="true"
15
+ focusable="false"
16
+ viewBox="0 0 558.7 558.7"
17
+ style="width: {width}; --logoColour: {colour};"
18
+ >
19
+ <g id="Primary_Logo" data-name="Primary Logo">
20
+ <path
21
+ class="cls-1"
22
+ d="M483,75c7.1,7.1,11,16.6,11,26.7s-3.9,19.6-11,26.7c-14.7,14.7-38.6,14.7-53.3,0-7.1-7.1-11-16.6-11-26.7s3.9-19.6,11-26.7c7.4-7.4,17-11.1,26.7-11.1s19.3,3.7,26.7,11.1Z"
23
+ ></path>
24
+ <path
25
+ class="cls-1"
26
+ d="M75.1,483.6c-14.7-14.7-14.7-38.7,0-53.4,7.1-7.1,16.6-11.1,26.7-11.1s19.6,3.9,26.7,11.1c14.7,14.7,14.7,38.7,0,53.4-7.1,7.1-16.6,11.1-26.7,11.1s-19.6-3.9-26.7-11.1Z"
27
+ ></path>
28
+ <path
29
+ class="cls-1"
30
+ d="M362.6,77.9h-.3c-8-3.5-14.3-9.8-17.6-17.9-3.4-8.1-3.4-17.1,0-25.3,3.4-8.1,9.7-14.5,17.9-17.9,4.1-1.7,8.4-2.5,12.6-2.5s8.6.9,12.6,2.5c16.8,7,24.8,26.3,17.9,43.2-7,16.8-26.3,24.8-43.1,17.9h0Z"
31
+ ></path>
32
+ <path
33
+ class="cls-1"
34
+ d="M183.1,478.3c4.3,0,8.5.9,12.6,2.5,16.8,7,24.8,26.3,17.9,43.2-3.4,8.2-9.7,14.5-17.9,17.9-8.1,3.4-17.1,3.4-25.3,0-16.8-7-24.8-26.3-17.9-43.2,3.4-8.1,9.7-14.5,17.9-17.9,4.1-1.7,8.4-2.5,12.6-2.5h0s0,0,0,0Z"
35
+ ></path>
36
+ <path
37
+ class="cls-1"
38
+ d="M307.4,28.3c0,15.2-12,27.6-27,28.3h-1.3c-15.6,0-28.3-12.7-28.3-28.3S263.5,0,279.1,0s28.3,12.8,28.3,28.4h0s0,0,0,0Z"
39
+ ></path>
40
+ <path
41
+ class="cls-1"
42
+ d="M250.8,530.4c0-15.6,12.7-28.3,28.3-28.3s28.3,12.7,28.3,28.3-12.7,28.3-28.3,28.3-28.3-12.7-28.3-28.3Z"
43
+ ></path>
44
+ <path
45
+ class="cls-1"
46
+ d="M192.2,69.2c-5.8,2.4-12.2,2.4-18,0-5.9-2.4-10.4-7-12.8-12.8-5-12.1.7-25.9,12.8-30.9,2.9-1.2,6-1.8,9-1.8,9.3,0,18.1,5.5,21.8,14.6,2.4,5.9,2.4,12.3,0,18.1-2.4,5.9-6.9,10.4-12.8,12.8h0Z"
47
+ ></path>
48
+ <path
49
+ class="cls-1"
50
+ d="M365.9,489.5c3-1.2,6-1.8,9.1-1.8s6.1.6,9,1.8c5.9,2.4,10.4,7,12.8,12.8,2.4,5.9,2.4,12.3,0,18.1-2.4,5.9-6.9,10.4-12.8,12.8-5.9,2.4-12.2,2.4-18.1,0-5.9-2.4-10.4-6.9-12.8-12.8-2.4-5.9-2.4-12.2,0-18.1,2.4-5.8,6.9-10.4,12.8-12.8h0Z"
51
+ ></path>
52
+ <path
53
+ class="cls-1"
54
+ d="M115.1,88.6c7.2,7.3,7.4,18.9.4,26.4l-.4.4c-7.4,7.4-19.4,7.4-26.7,0-7.4-7.4-7.4-19.4,0-26.8,3.7-3.7,8.5-5.5,13.4-5.5s9.7,1.8,13.4,5.5h0,0Z"
55
+ ></path>
56
+ <path
57
+ class="cls-1"
58
+ d="M442.8,443.5c3.6-3.7,8.5-5.5,13.3-5.5s9.7,1.8,13.4,5.5c3.6,3.5,5.5,8.3,5.5,13.4s-2,9.8-5.5,13.4c-7.4,7.4-19.3,7.4-26.7,0-3.6-3.6-5.5-8.4-5.5-13.4s2-9.8,5.5-13.4h0Z"
59
+ ></path>
60
+ <path
61
+ class="cls-1"
62
+ d="M38.4,205.1c-12-5-17.8-18.8-12.8-30.9,2.4-5.9,6.9-10.4,12.8-12.8,3-1.2,6-1.8,9.1-1.8s6.1.6,9,1.8c12,5,17.7,18.8,12.8,30.9-2.4,5.9-6.9,10.4-12.8,12.8-5.9,2.4-12.3,2.4-18,0h0Z"
63
+ ></path>
64
+ <path
65
+ class="cls-1"
66
+ d="M519.8,353.7c5.8,2.4,10.4,6.9,12.8,12.8,2.4,5.9,2.4,12.2,0,18.1-5,12-18.8,17.8-30.8,12.8-5.9-2.4-10.4-6.9-12.8-12.8-2.4-5.9-2.4-12.2,0-18.1,3.8-9.1,12.6-14.6,21.8-14.6s6,.6,9,1.8h0Z"
67
+ ></path>
68
+ <path
69
+ class="cls-1"
70
+ d="M0,279.5c0-15.6,12.7-28.3,28.3-28.3s28.3,12.7,28.3,28.3-12.7,28.3-28.3,28.3S0,295.1,0,279.5Z"
71
+ ></path>
72
+ <path
73
+ class="cls-1"
74
+ d="M501.6,279.5c0-15.6,12.7-28.3,28.3-28.3s28.3,12.7,28.3,28.3-12.7,28.3-28.3,28.3-28.3-12.7-28.3-28.3Z"
75
+ ></path>
76
+ <path
77
+ class="cls-1"
78
+ d="M16.8,388.1c-7-16.9,1-36.2,17.9-43.2,8.1-3.4,17.1-3.4,25.3,0,8.1,3.4,14.5,9.7,17.9,17.9s3.4,17.1,0,25.3c-3.4,8.1-9.7,14.5-17.9,17.9s-17.1,3.4-25.3,0c-8.1-3.4-14.5-9.7-17.9-17.9Z"
79
+ ></path>
80
+ <path
81
+ class="cls-1"
82
+ d="M480.1,195.9c-3.4-8.1-3.4-17.1,0-25.2,3.4-8.1,9.7-14.5,17.9-17.9,4.1-1.7,8.4-2.5,12.6-2.5,13,0,25.3,7.7,30.5,20.4,7,16.9-1,36.2-17.9,43.2-8.1,3.4-17.1,3.4-25.3,0-8.1-3.4-14.5-9.7-17.9-17.9h0,0Z"
83
+ ></path>
84
+ <path
85
+ class="cls-1"
86
+ d="M359.3,359.7c-10.4,10.3-10.4,27.2,0,37.5,10.4,10.4,27.1,10.4,37.5,0,5-5,7.8-11.6,7.8-18.7s-2.8-13.8-7.8-18.7c-5.2-5.2-11.9-7.7-18.7-7.7s-13.6,2.6-18.8,7.7h0Z"
87
+ ></path>
88
+ <path
89
+ class="cls-1"
90
+ d="M138.3,263.3c-11.2-3-17.8-14.5-14.8-25.7,1.5-5.4,4.9-9.9,9.8-12.8,3.2-1.9,6.8-2.8,10.4-2.8s3.6.2,5.4.7c5.4,1.5,9.9,4.9,12.7,9.8s3.5,10.5,2.1,16c-3,11.2-14.5,17.9-25.7,14.9h0,0Z"
91
+ ></path>
92
+ <path
93
+ class="cls-1"
94
+ d="M408.9,335.9c-5.4-1.5-9.9-4.9-12.7-9.8s-3.5-10.5-2.1-16c1.5-5.4,4.9-10,9.8-12.8,3.2-1.9,6.9-2.8,10.5-2.8s3,.1,4.5.5l1,.3c11.2,3,17.8,14.6,14.8,25.7-1.5,5.4-4.9,10-9.8,12.8-4.9,2.8-10.5,3.6-16,2.1h0s0,0,0,0Z"
95
+ ></path>
96
+ <path
97
+ class="cls-1"
98
+ d="M127.6,320c-2.3-8.7,2.5-17.5,10.9-20.4l1-.3c8.9-2.4,18.2,3,20.6,11.9,1.2,4.4.6,8.9-1.7,12.8-2.2,3.9-5.9,6.7-10.2,7.9-4.4,1.2-8.8.6-12.8-1.7-3.9-2.2-6.7-5.9-7.8-10.2h0s0,0,0,0Z"
99
+ ></path>
100
+ <path
101
+ class="cls-1"
102
+ d="M405.9,257.8l-.7-.4c-3.5-2.3-6-5.7-7.1-9.8-2.4-9,2.9-18.2,11.9-20.6,8.9-2.4,18.2,2.9,20.6,11.9,2.4,9-2.9,18.2-11.9,20.6-4.3,1.2-8.8.5-12.8-1.7h0Z"
103
+ ></path>
104
+ <path
105
+ class="cls-1"
106
+ d="M189.4,386.7l-.5.5c-4.9,4.9-13,4.9-17.9,0-4.9-4.9-4.9-12.9,0-17.9s13-4.9,17.9,0c2.4,2.4,3.7,5.6,3.7,9s-1.1,6.1-3.2,8.4Z"
107
+ ></path>
108
+ <path
109
+ class="cls-1"
110
+ d="M386.9,171.2c2.4,2.4,3.7,5.6,3.7,9s-1.3,6.6-3.7,9c-4.9,4.9-13,4.9-17.9,0-2.4-2.4-3.7-5.6-3.7-9s1.3-6.6,3.7-9c2.4-2.4,5.6-3.7,9-3.7s6.6,1.3,9,3.7h0s0,0,0,0Z"
111
+ ></path>
112
+ <path
113
+ class="cls-1"
114
+ d="M257.3,406.3c2.2,3.9,2.8,8.4,1.7,12.8-1.2,4.4-3.9,8-7.8,10.2s-8.4,2.8-12.8,1.7c-8.9-2.4-14.3-11.6-11.9-20.6,1.2-4.4,3.9-8,7.8-10.2,3.9-2.2,8.4-2.8,12.8-1.7,4.4,1.2,7.9,4,10.2,7.9h0s0,0,0,0Z"
115
+ ></path>
116
+ <path
117
+ class="cls-1"
118
+ d="M300.6,152.5c-2.2-3.9-2.8-8.4-1.7-12.8,1.2-4.4,3.9-8,7.8-10.2,2.6-1.5,5.5-2.2,8.4-2.2s2.9.2,4.4.6c4.4,1.2,8,3.9,10.2,7.9,2.2,3.9,2.8,8.4,1.7,12.8-2.4,9-11.6,14.3-20.6,11.9-4.4-1.2-8-3.9-10.2-7.9h0Z"
119
+ ></path>
120
+ <path
121
+ class="cls-1"
122
+ d="M325.9,396.6l.9.5c4.4,2.8,7.5,7.1,8.9,12.2,3,11.2-3.6,22.8-14.8,25.7-5.5,1.5-11.1.7-16-2.1-4.9-2.8-8.3-7.3-9.8-12.8-1.5-5.4-.7-11.1,2.1-16,2.8-4.9,7.3-8.3,12.7-9.8,1.8-.5,3.7-.7,5.5-.7,3.6,0,7.2,1,10.5,2.8h0Z"
123
+ ></path>
124
+ <path
125
+ class="cls-1"
126
+ d="M248.2,164.3c-11.2,3-22.7-3.7-25.7-14.9-3-11.2,3.6-22.8,14.8-25.7,1.8-.5,3.6-.7,5.4-.7,9.3,0,17.8,6.2,20.3,15.6,3,11.2-3.6,22.8-14.8,25.7Z"
127
+ ></path>
128
+ <path
129
+ class="cls-1"
130
+ d="M180,206.5c14.6,0,26.4-11.9,26.4-26.5s-11.8-26.5-26.4-26.5-26.4,11.9-26.4,26.5,11.8,26.5,26.4,26.5Z"
131
+ ></path>
132
+ </g>
133
+ </svg>
134
+
135
+ <style>
136
+ .cls-1 {
137
+ fill: var(--logoColour);
138
+ stroke-width: 0px;
139
+ }
140
+ </style>
@@ -0,0 +1,10 @@
1
+ interface Props {
2
+ /** "Kinesis" colour */
3
+ colour?: string;
4
+ /** CSS width value */
5
+ width?: string;
6
+ }
7
+ /** `ReutersLogo` [Read the docs.](https://reuters-graphics.github.io/graphics-components/?path=/docs/components-logos-reuterslogo--docs) */
8
+ declare const KinesisLogo: import("svelte").Component<Props, {}, "">;
9
+ type KinesisLogo = ReturnType<typeof KinesisLogo>;
10
+ export default KinesisLogo;
package/dist/index.d.ts CHANGED
@@ -3,9 +3,12 @@ export { default as resizeObserver } from './actions/resizeObserver/index';
3
3
  export { prettifyDate } from './utils/index';
4
4
  export { default as Analytics, registerPageview, } from './components/Analytics/Analytics.svelte';
5
5
  export { default as Article } from './components/Article/Article.svelte';
6
+ export { default as BlogPost } from './components/BlogPost/BlogPost.svelte';
7
+ export { default as BlogTOC } from './components/BlogTOC/BlogTOC.svelte';
6
8
  export { default as AdScripts } from './components/AdSlot/AdScripts.svelte';
7
9
  export { default as BeforeAfter } from './components/BeforeAfter/BeforeAfter.svelte';
8
10
  export { default as Block } from './components/Block/Block.svelte';
11
+ export { default as ClockWall } from './components/ClockWall/ClockWall.svelte';
9
12
  export { default as BodyText } from './components/BodyText/BodyText.svelte';
10
13
  export { default as Byline } from './components/Byline/Byline.svelte';
11
14
  export { default as DatawrapperChart } from './components/DatawrapperChart/DatawrapperChart.svelte';
@@ -21,6 +24,7 @@ export { default as HorizontalScroller } from './components/HorizontalScroller/H
21
24
  export { default as EndNotes } from './components/EndNotes/EndNotes.svelte';
22
25
  export { default as InfoBox } from './components/InfoBox/InfoBox.svelte';
23
26
  export { default as InlineAd } from './components/AdSlot/InlineAd.svelte';
27
+ export { default as KinesisLogo } from './components/KinesisLogo/KinesisLogo.svelte';
24
28
  export { default as LeaderboardAd } from './components/AdSlot/LeaderboardAd.svelte';
25
29
  export { default as TileMap } from './components/TileMap/TileMap.svelte';
26
30
  export { default as TileMapLayer } from './components/TileMap/TileMapLayer.svelte';
package/dist/index.js CHANGED
@@ -6,9 +6,12 @@ export { prettifyDate } from './utils/index';
6
6
  // Components
7
7
  export { default as Analytics, registerPageview, } from './components/Analytics/Analytics.svelte';
8
8
  export { default as Article } from './components/Article/Article.svelte';
9
+ export { default as BlogPost } from './components/BlogPost/BlogPost.svelte';
10
+ export { default as BlogTOC } from './components/BlogTOC/BlogTOC.svelte';
9
11
  export { default as AdScripts } from './components/AdSlot/AdScripts.svelte';
10
12
  export { default as BeforeAfter } from './components/BeforeAfter/BeforeAfter.svelte';
11
13
  export { default as Block } from './components/Block/Block.svelte';
14
+ export { default as ClockWall } from './components/ClockWall/ClockWall.svelte';
12
15
  export { default as BodyText } from './components/BodyText/BodyText.svelte';
13
16
  export { default as Byline } from './components/Byline/Byline.svelte';
14
17
  export { default as DatawrapperChart } from './components/DatawrapperChart/DatawrapperChart.svelte';
@@ -24,6 +27,7 @@ export { default as HorizontalScroller } from './components/HorizontalScroller/H
24
27
  export { default as EndNotes } from './components/EndNotes/EndNotes.svelte';
25
28
  export { default as InfoBox } from './components/InfoBox/InfoBox.svelte';
26
29
  export { default as InlineAd } from './components/AdSlot/InlineAd.svelte';
30
+ export { default as KinesisLogo } from './components/KinesisLogo/KinesisLogo.svelte';
27
31
  export { default as LeaderboardAd } from './components/AdSlot/LeaderboardAd.svelte';
28
32
  export { default as TileMap } from './components/TileMap/TileMap.svelte';
29
33
  export { default as TileMapLayer } from './components/TileMap/TileMapLayer.svelte';
@@ -16,4 +16,13 @@ declare module 'journalize' {
16
16
  * @returns The converted value
17
17
  */
18
18
  export function intcomma(val: number | string): string;
19
+
20
+ /**
21
+ * Returns an AP-formatted month string that corresponds with the supplied
22
+ * Date. If an `input` is not passed, it will use the result of `new Date();`.
23
+ *
24
+ * @param date - The supplied Date
25
+ * @returns The converted date as a string
26
+ */
27
+ export function apmonth(date?: Date): string;
19
28
  }
@@ -24,3 +24,10 @@ export declare const getAuthorPageUrl: (author: string) => string;
24
24
  *
25
25
  */
26
26
  export declare const prettifyDate: (input: string) => string;
27
+ /**
28
+ * Converts a string into a URL-friendly slug.
29
+ *
30
+ * @param str The string to be slugified.
31
+ * @returns The slugified string.
32
+ */
33
+ export declare const slugify: (str: string) => string;
@@ -1,4 +1,4 @@
1
- import slugify from 'slugify';
1
+ import slug from 'slugify';
2
2
  /** Helper function to generate a random 4-character string */
3
3
  export const random4 = () => Math.floor((1 + Math.random()) * 0x10000)
4
4
  .toString(16)
@@ -7,7 +7,7 @@ export const random4 = () => Math.floor((1 + Math.random()) * 0x10000)
7
7
  * Custom function that returns an author page URL.
8
8
  */
9
9
  export const getAuthorPageUrl = (author) => {
10
- const authorSlug = slugify(author.trim(), { lower: true });
10
+ const authorSlug = slug(author.trim(), { lower: true });
11
11
  return `https://www.reuters.com/authors/${authorSlug}/`;
12
12
  };
13
13
  /** Formats a string containing a full or 3-letter abbreviated month, AM/PM, and am/pm to match the Reuters style.
@@ -79,3 +79,10 @@ const prettifyAmPm = (text) => {
79
79
  return `${digit} ${formattedDesignator}`;
80
80
  });
81
81
  };
82
+ /**
83
+ * Converts a string into a URL-friendly slug.
84
+ *
85
+ * @param str The string to be slugified.
86
+ * @returns The slugified string.
87
+ */
88
+ export const slugify = (str) => slug(str, { lower: true, strict: true });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reuters-graphics/graphics-components",
3
- "version": "3.2.1",
3
+ "version": "3.3.0",
4
4
  "type": "module",
5
5
  "private": false,
6
6
  "homepage": "https://reuters-graphics.github.io/graphics-components",