@reuters-graphics/graphics-components 3.0.1 → 3.0.2
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.
- package/dist/components/AdSlot/@types/ads.d.ts +7 -7
- package/dist/components/AdSlot/InlineAd.svelte +2 -2
- package/dist/components/AdSlot/InlineAd.svelte.d.ts +0 -1
- package/dist/components/AdSlot/LeaderboardAd.svelte +2 -2
- package/dist/components/AdSlot/LeaderboardAd.svelte.d.ts +0 -1
- package/dist/components/AdSlot/SponsorshipAd.svelte +2 -2
- package/dist/components/AdSlot/SponsorshipAd.svelte.d.ts +0 -1
- package/dist/components/Framer/Dropdown/index.svelte +53 -0
- package/dist/components/Framer/Dropdown/index.svelte.d.ts +11 -0
- package/dist/components/Framer/Framer.svelte +66 -37
- package/dist/components/Framer/Framer.svelte.d.ts +1 -0
- package/dist/components/Framer/Resizer/index.svelte +6 -7
- package/dist/components/Framer/Typeahead/index.svelte +0 -1
- package/dist/components/ReferralBlock/ReferralBlock.svelte +3 -0
- package/dist/components/SEO/SEO.svelte +2 -0
- package/dist/components/SiteFooter/CompanyLinks.svelte +9 -1
- package/dist/components/SiteHeader/MobileMenu/index.svelte +5 -1
- package/dist/components/SiteHeader/NavBar/NavDropdown/index.svelte +2 -2
- package/dist/components/SiteHeader/NavBar/index.svelte +1 -1
- package/package.json +1 -1
- package/dist/components/Framer/stories/docs/component.md +0 -11
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type
|
|
1
|
+
export type LeaderboardAdType = {
|
|
2
2
|
mobile: {
|
|
3
3
|
adType: 'leaderboard';
|
|
4
4
|
placementName: 'reuters_mobile_leaderboard';
|
|
@@ -8,7 +8,7 @@ export type LeaderboardAd = {
|
|
|
8
8
|
placementName: 'reuters_desktop_leaderboard_atf';
|
|
9
9
|
};
|
|
10
10
|
};
|
|
11
|
-
export type
|
|
11
|
+
export type SponsorshipAdType = {
|
|
12
12
|
mobile: {
|
|
13
13
|
adType: 'sponsorlogo';
|
|
14
14
|
placementName: 'reuters_sponsorlogo';
|
|
@@ -18,7 +18,7 @@ export type SponsorshipAd = {
|
|
|
18
18
|
placementName: 'reuters_sponsorlogo';
|
|
19
19
|
};
|
|
20
20
|
};
|
|
21
|
-
export type
|
|
21
|
+
export type InlineAdType = {
|
|
22
22
|
mobile: {
|
|
23
23
|
adType: 'mpu' | 'native' | 'mpu2';
|
|
24
24
|
placementName: 'reuters_mobile_mpu_1' | 'reuters_mobile_mpu_2' | 'reuters_mobile_mpu_3';
|
|
@@ -28,7 +28,7 @@ export type InlineAd = {
|
|
|
28
28
|
placementName: 'reuters_desktop_native_1' | 'reuters_desktop_native_2' | 'reuters_desktop_native_3';
|
|
29
29
|
};
|
|
30
30
|
};
|
|
31
|
-
export type DesktopPlacementName =
|
|
32
|
-
export type MobilePlacementName =
|
|
33
|
-
export type DesktopAdType =
|
|
34
|
-
export type MobileAdType =
|
|
31
|
+
export type DesktopPlacementName = LeaderboardAdType['desktop']['placementName'] | SponsorshipAdType['desktop']['placementName'] | InlineAdType['desktop']['placementName'];
|
|
32
|
+
export type MobilePlacementName = LeaderboardAdType['mobile']['placementName'] | SponsorshipAdType['mobile']['placementName'] | InlineAdType['mobile']['placementName'];
|
|
33
|
+
export type DesktopAdType = LeaderboardAdType['desktop']['adType'] | SponsorshipAdType['desktop']['adType'] | InlineAdType['desktop']['adType'];
|
|
34
|
+
export type MobileAdType = LeaderboardAdType['mobile']['adType'] | SponsorshipAdType['mobile']['adType'] | InlineAdType['mobile']['adType'];
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<!-- @component `InlineAd` [Read the docs.](https://reuters-graphics.github.io/graphics-components/?path=/docs/components-ads-analytics-inlinead--docs) -->
|
|
3
3
|
<script lang="ts">
|
|
4
4
|
import Block from '../Block/Block.svelte';
|
|
5
|
-
import type {
|
|
5
|
+
import type { InlineAdType } from './@types/ads';
|
|
6
6
|
import ResponsiveAd from './ResponsiveAd.svelte';
|
|
7
7
|
|
|
8
8
|
interface Props {
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
|
|
17
17
|
let { id = '', class: cls = 'my-12', n = 1 }: Props = $props();
|
|
18
18
|
|
|
19
|
-
const desktopPlacementName:
|
|
19
|
+
const desktopPlacementName: InlineAdType['desktop']['placementName'] = `reuters_desktop_native_${n}`;
|
|
20
20
|
</script>
|
|
21
21
|
|
|
22
22
|
<Block {id} class="freestar-adslot {cls}">
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<!-- @component `LeaderboardAd` [Read the docs.](https://reuters-graphics.github.io/graphics-components/?path=/docs/components-ads-analytics-leaderboardad--docs) -->
|
|
2
2
|
<script lang="ts">
|
|
3
|
-
import type {
|
|
3
|
+
import type { LeaderboardAdType } from './@types/ads';
|
|
4
4
|
import ResponsiveAd from './ResponsiveAd.svelte';
|
|
5
5
|
import { onMount } from 'svelte';
|
|
6
6
|
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
let windowWidth = $state(1200);
|
|
17
17
|
let adSize = $derived(windowWidth < 1024 ? 110 : 275);
|
|
18
18
|
|
|
19
|
-
const desktopPlacementName:
|
|
19
|
+
const desktopPlacementName: LeaderboardAdType['desktop']['placementName'] =
|
|
20
20
|
'reuters_desktop_leaderboard_atf';
|
|
21
21
|
|
|
22
22
|
let sticky = $state(false);
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<!-- @component `SponsorshipAd` [Read the docs.](https://reuters-graphics.github.io/graphics-components/?path=/docs/components-ads-analytics-sponsorshipad--docs) -->
|
|
3
3
|
<script lang="ts">
|
|
4
4
|
import Block from '../Block/Block.svelte';
|
|
5
|
-
import type {
|
|
5
|
+
import type { SponsorshipAdType } from './@types/ads';
|
|
6
6
|
import ResponsiveAd from './ResponsiveAd.svelte';
|
|
7
7
|
|
|
8
8
|
interface Props {
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
|
|
19
19
|
let { id = '', class: cls = 'my-12', adLabel = '' }: Props = $props();
|
|
20
20
|
|
|
21
|
-
const desktopPlacementName:
|
|
21
|
+
const desktopPlacementName: SponsorshipAdType['desktop']['placementName'] =
|
|
22
22
|
'reuters_sponsorlogo';
|
|
23
23
|
</script>
|
|
24
24
|
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
interface Props {
|
|
3
|
+
data: {
|
|
4
|
+
index: number;
|
|
5
|
+
embed: string;
|
|
6
|
+
title: string;
|
|
7
|
+
}[];
|
|
8
|
+
selected: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
let { data = [], selected = $bindable() }: Props = $props();
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<form>
|
|
15
|
+
<label for="embed-options">Select an embed</label>
|
|
16
|
+
<select id="embed-options" bind:value={selected}>
|
|
17
|
+
{#each data as d (d.index)}
|
|
18
|
+
<option value={d.embed}>{d.title}</option>
|
|
19
|
+
{/each}
|
|
20
|
+
</select>
|
|
21
|
+
</form>
|
|
22
|
+
|
|
23
|
+
<style>/* Generated from
|
|
24
|
+
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
|
|
25
|
+
*/
|
|
26
|
+
/* Generated from
|
|
27
|
+
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
|
|
28
|
+
*/
|
|
29
|
+
/* Scales by 1.125 */
|
|
30
|
+
label {
|
|
31
|
+
margin-bottom: 0.25rem;
|
|
32
|
+
display: inline-flex;
|
|
33
|
+
font-size: 0.75rem;
|
|
34
|
+
color: #aaa;
|
|
35
|
+
font-family: var(--theme-font-family-sans-serif);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
select {
|
|
39
|
+
width: 100%;
|
|
40
|
+
padding: 0.5rem 0.75rem;
|
|
41
|
+
background: none;
|
|
42
|
+
font-size: 1rem;
|
|
43
|
+
border: 0;
|
|
44
|
+
border-radius: 0 !important;
|
|
45
|
+
background-color: #fff;
|
|
46
|
+
border: 1px solid #ddd;
|
|
47
|
+
font-family: var(--theme-font-family-sans-serif);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
select:focus {
|
|
51
|
+
outline: none;
|
|
52
|
+
border: 1px solid #ccc;
|
|
53
|
+
}</style>
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
import { width } from './stores';
|
|
8
8
|
import getUniqNames from './uniqNames';
|
|
9
9
|
import Typeahead from './Typeahead/index.svelte';
|
|
10
|
+
import Dropdown from './Dropdown/index.svelte';
|
|
10
11
|
import ReutersGraphicsLogo from '../ReutersGraphicsLogo/ReutersGraphicsLogo.svelte';
|
|
11
12
|
|
|
12
13
|
interface Props {
|
|
@@ -14,6 +15,7 @@
|
|
|
14
15
|
breakpoints?: number[];
|
|
15
16
|
minFrameWidth?: number;
|
|
16
17
|
maxFrameWidth?: number;
|
|
18
|
+
searchType?: 'dropdown' | 'typeahead';
|
|
17
19
|
}
|
|
18
20
|
|
|
19
21
|
let {
|
|
@@ -21,6 +23,7 @@
|
|
|
21
23
|
breakpoints = [330, 510, 660, 930, 1200],
|
|
22
24
|
minFrameWidth = 320,
|
|
23
25
|
maxFrameWidth = 1200,
|
|
26
|
+
searchType = 'dropdown',
|
|
24
27
|
}: Props = $props();
|
|
25
28
|
|
|
26
29
|
const getDefaultEmbed = (embeds: Props['embeds']) => {
|
|
@@ -71,37 +74,62 @@
|
|
|
71
74
|
<p>No embeds to show.</p>
|
|
72
75
|
</div>
|
|
73
76
|
{:else}
|
|
74
|
-
|
|
75
|
-
<div
|
|
76
|
-
<
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
77
|
+
{#if searchType === 'typeahead'}
|
|
78
|
+
<div id="typeahead-container">
|
|
79
|
+
<div class="embed-link">
|
|
80
|
+
<a
|
|
81
|
+
rel="external"
|
|
82
|
+
target="_blank"
|
|
83
|
+
href={activeEmbed}
|
|
84
|
+
title={activeEmbed}
|
|
85
|
+
>
|
|
86
|
+
Live link <Fa icon={faLink} />
|
|
87
|
+
</a>
|
|
88
|
+
</div>
|
|
89
|
+
<Typeahead
|
|
90
|
+
label="Select an embed"
|
|
91
|
+
value={embedTitles[embeds.indexOf(activeEmbed)] ||
|
|
92
|
+
embedTitles[activeEmbedIndex] ||
|
|
93
|
+
embedTitles[0]}
|
|
94
|
+
extract={(d) => embedTitles[d.index]}
|
|
95
|
+
data={embeds.map((embed, index) => ({ index, embed }))}
|
|
96
|
+
showDropdownOnFocus={true}
|
|
97
|
+
onselect={(detail) => {
|
|
98
|
+
if (typeof window !== 'undefined') {
|
|
99
|
+
window.localStorage.setItem(
|
|
100
|
+
'framer-active-embed',
|
|
101
|
+
detail.original.embed
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
activeEmbed = detail.original.embed;
|
|
105
|
+
// activeEmbedIndex = detail.original.index;
|
|
106
|
+
}}
|
|
107
|
+
/>
|
|
84
108
|
</div>
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
109
|
+
{:else}
|
|
110
|
+
<div id="dropdown-container">
|
|
111
|
+
<div>
|
|
112
|
+
<div class="embed-link">
|
|
113
|
+
<a
|
|
114
|
+
rel="external"
|
|
115
|
+
target="_blank"
|
|
116
|
+
href={activeEmbed}
|
|
117
|
+
title={activeEmbed}
|
|
118
|
+
>
|
|
119
|
+
Live link <Fa icon={faLink} />
|
|
120
|
+
</a>
|
|
121
|
+
</div>
|
|
122
|
+
</div>
|
|
123
|
+
<Dropdown
|
|
124
|
+
data={embeds.map((embed, index) => ({
|
|
125
|
+
index,
|
|
126
|
+
embed,
|
|
127
|
+
title: embedTitles[index],
|
|
128
|
+
}))}
|
|
129
|
+
bind:selected={activeEmbed}
|
|
130
|
+
/>
|
|
131
|
+
</div>
|
|
132
|
+
{/if}
|
|
105
133
|
|
|
106
134
|
<div id="preview-label" style="width:{$width}px;">
|
|
107
135
|
<p>Preview</p>
|
|
@@ -143,28 +171,29 @@ header {
|
|
|
143
171
|
font-family: var(--theme-font-family-note);
|
|
144
172
|
}
|
|
145
173
|
|
|
146
|
-
div#typeahead-container
|
|
174
|
+
div#typeahead-container,
|
|
175
|
+
div#dropdown-container {
|
|
147
176
|
max-width: 660px;
|
|
148
177
|
margin: 0 auto 15px;
|
|
149
178
|
position: relative;
|
|
150
179
|
}
|
|
151
|
-
|
|
152
|
-
div#
|
|
180
|
+
div#typeahead-container div.embed-link,
|
|
181
|
+
div#dropdown-container div.embed-link {
|
|
153
182
|
position: absolute;
|
|
154
183
|
top: 0;
|
|
155
184
|
right: 0;
|
|
156
185
|
display: inline-block;
|
|
157
186
|
z-index: 2;
|
|
158
187
|
}
|
|
159
|
-
|
|
160
|
-
div#
|
|
188
|
+
div#typeahead-container div.embed-link a,
|
|
189
|
+
div#dropdown-container div.embed-link a {
|
|
161
190
|
font-family: "Knowledge", "Source Sans Pro", Arial, sans-serif;
|
|
162
191
|
color: #bbb;
|
|
163
192
|
font-size: 12px;
|
|
164
193
|
text-decoration: none !important;
|
|
165
194
|
}
|
|
166
|
-
|
|
167
|
-
div#
|
|
195
|
+
div#typeahead-container div.embed-link a:hover,
|
|
196
|
+
div#dropdown-container div.embed-link a:hover {
|
|
168
197
|
color: #666;
|
|
169
198
|
}
|
|
170
199
|
|
|
@@ -27,8 +27,7 @@
|
|
|
27
27
|
if ($width > maxWidth) width.set(maxWidth);
|
|
28
28
|
});
|
|
29
29
|
|
|
30
|
-
|
|
31
|
-
let offset = $state(($width - minWidth) / pixelRange);
|
|
30
|
+
let offset = $derived(($width - minWidth) / pixelRange);
|
|
32
31
|
|
|
33
32
|
let sliding = $state(false);
|
|
34
33
|
let isFocused = $state(false);
|
|
@@ -55,7 +54,7 @@
|
|
|
55
54
|
} else if (keyCode === 37) {
|
|
56
55
|
offset = Math.max(0, offset - pixelWidth / sliderWidth);
|
|
57
56
|
}
|
|
58
|
-
width
|
|
57
|
+
$width = getPx();
|
|
59
58
|
};
|
|
60
59
|
const start = (e: MouseEvent) => {
|
|
61
60
|
sliding = true;
|
|
@@ -77,17 +76,17 @@
|
|
|
77
76
|
.filter((b) => b <= maxWidth)
|
|
78
77
|
.filter((b) => b > $width);
|
|
79
78
|
if (availableBreakpoints.length === 0) {
|
|
80
|
-
width
|
|
79
|
+
$width = maxWidth;
|
|
81
80
|
} else {
|
|
82
|
-
width
|
|
81
|
+
$width = availableBreakpoints[0];
|
|
83
82
|
}
|
|
84
83
|
};
|
|
85
84
|
const decrement = () => {
|
|
86
85
|
const availableBreakpoints = breakpoints.filter((b) => b < $width);
|
|
87
86
|
if (availableBreakpoints.length === 0) {
|
|
88
|
-
width
|
|
87
|
+
$width = minWidth;
|
|
89
88
|
} else {
|
|
90
|
-
width
|
|
89
|
+
$width = availableBreakpoints.slice(-1)[0];
|
|
91
90
|
}
|
|
92
91
|
};
|
|
93
92
|
</script>
|
|
@@ -67,6 +67,9 @@
|
|
|
67
67
|
let referrals: Article[] = $state([]);
|
|
68
68
|
|
|
69
69
|
const getReferrals = async () => {
|
|
70
|
+
if (typeof window === 'undefined') return;
|
|
71
|
+
// fetch only reliably works on prod sites
|
|
72
|
+
if (window?.location?.hostname !== 'www.reuters.com') return;
|
|
70
73
|
const isCollection = Boolean(collection);
|
|
71
74
|
const API = isCollection ? COLLECTION_API : SECTION_API;
|
|
72
75
|
try {
|
|
@@ -185,9 +185,11 @@
|
|
|
185
185
|
<meta property="fb:admins" content="625796953" />
|
|
186
186
|
<meta property="fb:admins" content="571759798" />
|
|
187
187
|
|
|
188
|
+
<!-- svelte-ignore hydration_html_changed -->
|
|
188
189
|
{@html `<${'script'} type="application/ld+json">${JSON.stringify(
|
|
189
190
|
orgLdJson
|
|
190
191
|
)}</script>`}
|
|
192
|
+
<!-- svelte-ignore hydration_html_changed -->
|
|
191
193
|
{@html `<${'script'} type="application/ld+json">${JSON.stringify(
|
|
192
194
|
articleLdJson
|
|
193
195
|
)}</script>`}
|
|
@@ -25,6 +25,11 @@
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
let { links = {} }: Props = $props();
|
|
28
|
+
|
|
29
|
+
const normaliseSocialName = (name: string) => {
|
|
30
|
+
if (name === 'twitter') return 'X';
|
|
31
|
+
return name;
|
|
32
|
+
};
|
|
28
33
|
</script>
|
|
29
34
|
|
|
30
35
|
{#if links.social_links}
|
|
@@ -42,7 +47,10 @@
|
|
|
42
47
|
{@const SvelteComponent =
|
|
43
48
|
symbols[link.type as keyof typeof symbols]}
|
|
44
49
|
<li class="social-links symbol">
|
|
45
|
-
<a
|
|
50
|
+
<a
|
|
51
|
+
href={normalizeUrl(link.url)}
|
|
52
|
+
aria-label="Visit Reuters on {normaliseSocialName(link.type)}"
|
|
53
|
+
>
|
|
46
54
|
<div class="button">
|
|
47
55
|
<div class="social">
|
|
48
56
|
<SvelteComponent />
|
|
@@ -37,7 +37,11 @@
|
|
|
37
37
|
textColour="var(--nav-primary)"
|
|
38
38
|
/>
|
|
39
39
|
</div>
|
|
40
|
-
<button
|
|
40
|
+
<button
|
|
41
|
+
class="button close-button"
|
|
42
|
+
aria-label="Close menu"
|
|
43
|
+
onclick={releaseMobileMenu}
|
|
44
|
+
>
|
|
41
45
|
<div class="button-container">
|
|
42
46
|
<CloseIcon />
|
|
43
47
|
</div>
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
};
|
|
70
70
|
</script>
|
|
71
71
|
|
|
72
|
-
<div class="dropdown">
|
|
72
|
+
<div class="dropdown" data-chromatic="ignore">
|
|
73
73
|
<div class="dropdown-container">
|
|
74
74
|
<div class="inner">
|
|
75
75
|
<div class="submenu">
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
</div>
|
|
79
79
|
</div>
|
|
80
80
|
<div class="stories-container">
|
|
81
|
-
<div class="inner"
|
|
81
|
+
<div class="inner">
|
|
82
82
|
{#if stories.length > 0}
|
|
83
83
|
<span class="latest">{headingText}</span>
|
|
84
84
|
<ul class="story-list">
|
package/package.json
CHANGED