@reuters-graphics/graphics-components 0.0.1-beta.1
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/README.md +7 -0
- package/dist/@types/actions/cssVariables/index.d.ts +4 -0
- package/dist/@types/actions/resizeObserver/index.d.ts +4 -0
- package/dist/@types/components/@types/global.d.ts +28 -0
- package/dist/@types/components/Article/Article.svelte.d.ts +32 -0
- package/dist/@types/components/BeforeAfter/BeforeAfter.svelte.d.ts +57 -0
- package/dist/@types/components/Block/Block.svelte.d.ts +24 -0
- package/dist/@types/components/BodyText/BodyText.svelte.d.ts +20 -0
- package/dist/@types/components/DatawrapperChart/DatawrapperChart.svelte.d.ts +52 -0
- package/dist/@types/components/EmbedPreviewerLink/EmbedPreviewerLink.svelte.d.ts +16 -0
- package/dist/@types/components/FeaturePhoto/FeaturePhoto.svelte.d.ts +43 -0
- package/dist/@types/components/Framer/Framer.svelte.d.ts +29 -0
- package/dist/@types/components/Framer/Resizer/index.svelte.d.ts +27 -0
- package/dist/@types/components/Framer/stores.d.ts +1 -0
- package/dist/@types/components/Framer/uniqNames.d.ts +2 -0
- package/dist/@types/components/GraphicBlock/AriaHidden.svelte.d.ts +20 -0
- package/dist/@types/components/GraphicBlock/GraphicBlock.svelte.d.ts +64 -0
- package/dist/@types/components/GraphicBlock/TextBlock.svelte.d.ts +19 -0
- package/dist/@types/components/Headline/Headline.svelte.d.ts +29 -0
- package/dist/@types/components/Hero/Hero.svelte.d.ts +41 -0
- package/dist/@types/components/NoteText/NoteText.svelte.d.ts +20 -0
- package/dist/@types/components/PaddingReset/index.svelte.d.ts +27 -0
- package/dist/@types/components/PhotoPack/PhotoPack.svelte.d.ts +50 -0
- package/dist/@types/components/PhotoPack/docProps.d.ts +38 -0
- package/dist/@types/components/PymChild/PymChild.svelte.d.ts +16 -0
- package/dist/@types/components/ReutersLogo/ReutersLogo.svelte.d.ts +18 -0
- package/dist/@types/components/SEO/SEO.svelte.d.ts +66 -0
- package/dist/@types/components/SEO/analytics.d.ts +2 -0
- package/dist/@types/components/SEO/publisherTags.d.ts +2 -0
- package/dist/@types/components/Scroller/Background.svelte.d.ts +20 -0
- package/dist/@types/components/Scroller/Embedded/Background.svelte.d.ts +19 -0
- package/dist/@types/components/Scroller/Embedded/Foreground.svelte.d.ts +18 -0
- package/dist/@types/components/Scroller/Embedded/index.svelte.d.ts +19 -0
- package/dist/@types/components/Scroller/Foreground.svelte.d.ts +17 -0
- package/dist/@types/components/Scroller/Scroller.svelte.d.ts +76 -0
- package/dist/@types/components/Sharer/Sharer.svelte.d.ts +19 -0
- package/dist/@types/components/Sharer/utils/copyToClipboard.d.ts +2 -0
- package/dist/@types/components/Sharer/utils/facebook.d.ts +2 -0
- package/dist/@types/components/Sharer/utils/meta.d.ts +2 -0
- package/dist/@types/components/Sharer/utils/twitter.d.ts +2 -0
- package/dist/@types/components/SiteFooter/CompanyLinks.svelte.d.ts +23 -0
- package/dist/@types/components/SiteFooter/LegalLinks.svelte.d.ts +23 -0
- package/dist/@types/components/SiteFooter/QuickLinks.svelte.d.ts +23 -0
- package/dist/@types/components/SiteFooter/Referrals/IntersectionObserver.svelte.d.ts +39 -0
- package/dist/@types/components/SiteFooter/Referrals/Link.svelte.d.ts +29 -0
- package/dist/@types/components/SiteFooter/Referrals/Referrals.svelte.d.ts +23 -0
- package/dist/@types/components/SiteFooter/Referrals/index.svelte.d.ts +23 -0
- package/dist/@types/components/SiteFooter/SiteFooter.svelte.d.ts +23 -0
- package/dist/@types/components/SiteFooter/svgs/Facebook.svelte.d.ts +23 -0
- package/dist/@types/components/SiteFooter/svgs/Graphics.svelte.d.ts +19 -0
- package/dist/@types/components/SiteFooter/svgs/Instagram.svelte.d.ts +23 -0
- package/dist/@types/components/SiteFooter/svgs/LinkedIn.svelte.d.ts +23 -0
- package/dist/@types/components/SiteFooter/svgs/Pictures.svelte.d.ts +19 -0
- package/dist/@types/components/SiteFooter/svgs/Twitter.svelte.d.ts +23 -0
- package/dist/@types/components/SiteFooter/svgs/Videos.svelte.d.ts +19 -0
- package/dist/@types/components/SiteFooter/svgs/YouTube.svelte.d.ts +23 -0
- package/dist/@types/components/SiteHeader/MobileMenu/index.svelte.d.ts +27 -0
- package/dist/@types/components/SiteHeader/NavBar/DownArrow.svelte.d.ts +23 -0
- package/dist/@types/components/SiteHeader/NavBar/NavDropdown/MoreDropdown.svelte.d.ts +23 -0
- package/dist/@types/components/SiteHeader/NavBar/NavDropdown/SectionDropdown.svelte.d.ts +25 -0
- package/dist/@types/components/SiteHeader/NavBar/NavDropdown/Spinner/index.svelte.d.ts +19 -0
- package/dist/@types/components/SiteHeader/NavBar/NavDropdown/StoryCard/index.svelte.d.ts +25 -0
- package/dist/@types/components/SiteHeader/NavBar/NavDropdown/StoryCard/time.d.ts +1 -0
- package/dist/@types/components/SiteHeader/NavBar/NavDropdown/index.svelte.d.ts +27 -0
- package/dist/@types/components/SiteHeader/NavBar/index.svelte.d.ts +23 -0
- package/dist/@types/components/SiteHeader/NavBar/utils/index.d.ts +1 -0
- package/dist/@types/components/SiteHeader/SiteHeader.svelte.d.ts +14 -0
- package/dist/@types/components/SiteHeader/svgs/Close.svelte.d.ts +19 -0
- package/dist/@types/components/SiteHeader/svgs/Menu.svelte.d.ts +23 -0
- package/dist/@types/components/Spinner/Spinner.svelte.d.ts +28 -0
- package/dist/@types/components/Theme/@types/component.d.ts +28 -0
- package/dist/@types/components/Theme/Theme.svelte.d.ts +54 -0
- package/dist/@types/components/Theme/themes/dark.d.ts +2 -0
- package/dist/@types/components/Theme/themes/light.d.ts +22 -0
- package/dist/@types/components/Theme/utils/flatten.d.ts +1 -0
- package/dist/@types/components/Theme/utils/merge.d.ts +4 -0
- package/dist/@types/components/Video/Controls.svelte.d.ts +45 -0
- package/dist/@types/components/Video/Video.svelte.d.ts +46 -0
- package/dist/@types/components/Visible/Visible.svelte.d.ts +29 -0
- package/dist/@types/index.d.ts +24 -0
- package/dist/actions/cssVariables/index.js +20 -0
- package/dist/actions/resizeObserver/index.js +25 -0
- package/dist/components/@types/global.js +1 -0
- package/dist/components/Article/Article.svelte +47 -0
- package/dist/components/BeforeAfter/BeforeAfter.svelte +341 -0
- package/dist/components/Block/Block.svelte +177 -0
- package/dist/components/BodyText/BodyText.svelte +193 -0
- package/dist/components/DatawrapperChart/DatawrapperChart.svelte +105 -0
- package/dist/components/EmbedPreviewerLink/EmbedPreviewerLink.svelte +26 -0
- package/dist/components/FeaturePhoto/FeaturePhoto.svelte +113 -0
- package/dist/components/Framer/Framer.svelte +136 -0
- package/dist/components/Framer/Resizer/index.svelte +223 -0
- package/dist/components/Framer/stores.js +3 -0
- package/dist/components/Framer/uniqNames.js +54 -0
- package/dist/components/GraphicBlock/AriaHidden.svelte +13 -0
- package/dist/components/GraphicBlock/GraphicBlock.svelte +269 -0
- package/dist/components/GraphicBlock/TextBlock.svelte +12 -0
- package/dist/components/Headline/Headline.svelte +109 -0
- package/dist/components/Hero/Hero.svelte +78 -0
- package/dist/components/NoteText/NoteText.svelte +124 -0
- package/dist/components/PaddingReset/index.svelte +17 -0
- package/dist/components/PhotoPack/PhotoPack.svelte +156 -0
- package/dist/components/PhotoPack/docProps.js +20 -0
- package/dist/components/PymChild/PymChild.svelte +10 -0
- package/dist/components/ReutersLogo/ReutersLogo.svelte +21 -0
- package/dist/components/SEO/SEO.svelte +179 -0
- package/dist/components/SEO/analytics.js +332 -0
- package/dist/components/SEO/publisherTags.js +26 -0
- package/dist/components/Scroller/Background.svelte +30 -0
- package/dist/components/Scroller/Embedded/Background.svelte +14 -0
- package/dist/components/Scroller/Embedded/Foreground.svelte +203 -0
- package/dist/components/Scroller/Embedded/index.svelte +18 -0
- package/dist/components/Scroller/Foreground.svelte +42 -0
- package/dist/components/Scroller/Scroller.svelte +210 -0
- package/dist/components/Sharer/Sharer.svelte +157 -0
- package/dist/components/Sharer/utils/copyToClipboard.js +10 -0
- package/dist/components/Sharer/utils/facebook.js +22 -0
- package/dist/components/Sharer/utils/meta.js +7 -0
- package/dist/components/Sharer/utils/twitter.js +22 -0
- package/dist/components/SiteFooter/CompanyLinks.svelte +173 -0
- package/dist/components/SiteFooter/LegalLinks.svelte +202 -0
- package/dist/components/SiteFooter/QuickLinks.svelte +259 -0
- package/dist/components/SiteFooter/Referrals/IntersectionObserver.svelte +45 -0
- package/dist/components/SiteFooter/Referrals/Link.svelte +73 -0
- package/dist/components/SiteFooter/Referrals/Referrals.svelte +56 -0
- package/dist/components/SiteFooter/Referrals/index.svelte +53 -0
- package/dist/components/SiteFooter/SiteFooter.svelte +41 -0
- package/dist/components/SiteFooter/data.json +210 -0
- package/dist/components/SiteFooter/svgs/Facebook.svelte +18 -0
- package/dist/components/SiteFooter/svgs/Graphics.svelte +18 -0
- package/dist/components/SiteFooter/svgs/Instagram.svelte +20 -0
- package/dist/components/SiteFooter/svgs/LinkedIn.svelte +18 -0
- package/dist/components/SiteFooter/svgs/Pictures.svelte +14 -0
- package/dist/components/SiteFooter/svgs/Twitter.svelte +18 -0
- package/dist/components/SiteFooter/svgs/Videos.svelte +14 -0
- package/dist/components/SiteFooter/svgs/YouTube.svelte +18 -0
- package/dist/components/SiteHeader/MobileMenu/index.svelte +199 -0
- package/dist/components/SiteHeader/NavBar/DownArrow.svelte +26 -0
- package/dist/components/SiteHeader/NavBar/NavDropdown/MoreDropdown.svelte +112 -0
- package/dist/components/SiteHeader/NavBar/NavDropdown/SectionDropdown.svelte +118 -0
- package/dist/components/SiteHeader/NavBar/NavDropdown/Spinner/index.svelte +49 -0
- package/dist/components/SiteHeader/NavBar/NavDropdown/StoryCard/index.svelte +99 -0
- package/dist/components/SiteHeader/NavBar/NavDropdown/StoryCard/time.js +70 -0
- package/dist/components/SiteHeader/NavBar/NavDropdown/index.svelte +277 -0
- package/dist/components/SiteHeader/NavBar/index.svelte +234 -0
- package/dist/components/SiteHeader/NavBar/utils/index.js +2 -0
- package/dist/components/SiteHeader/SiteHeader.svelte +235 -0
- package/dist/components/SiteHeader/data.json +1 -0
- package/dist/components/SiteHeader/scss/_breakpoints.scss +59 -0
- package/dist/components/SiteHeader/scss/_colors.scss +25 -0
- package/dist/components/SiteHeader/scss/_eases.scss +9 -0
- package/dist/components/SiteHeader/scss/_grids.scss +126 -0
- package/dist/components/SiteHeader/scss/_z-indexes.scss +15 -0
- package/dist/components/SiteHeader/svgs/Close.svelte +14 -0
- package/dist/components/SiteHeader/svgs/Menu.svelte +19 -0
- package/dist/components/Spinner/Spinner.svelte +91 -0
- package/dist/components/Theme/@types/component.js +3 -0
- package/dist/components/Theme/Theme.svelte +37 -0
- package/dist/components/Theme/themes/dark.js +23 -0
- package/dist/components/Theme/themes/light.js +22 -0
- package/dist/components/Theme/utils/flatten.js +39 -0
- package/dist/components/Theme/utils/merge.js +23 -0
- package/dist/components/Video/Controls.svelte +68 -0
- package/dist/components/Video/Video.svelte +278 -0
- package/dist/components/Visible/Visible.svelte +54 -0
- package/dist/index.js +31 -0
- package/dist/scss/_mixins.scss +6 -0
- package/dist/scss/_variables.scss +2 -0
- package/dist/scss/bootstrap/_main.scss +34 -0
- package/dist/scss/bootstrap/_variables.scss +10 -0
- package/dist/scss/colours/thematic/_nord.scss +40 -0
- package/dist/scss/colours/thematic/_tr.scss +27 -0
- package/dist/scss/components/_hero-title.scss +118 -0
- package/dist/scss/fonts/_font-faces.scss +129 -0
- package/dist/scss/fonts/_mixins.scss +25 -0
- package/dist/scss/fonts/_rules.scss +19 -0
- package/dist/scss/fonts/_variables.scss +26 -0
- package/dist/scss/main.scss +16 -0
- package/dist/scss/mixins/_block.scss +62 -0
- package/dist/scss/mixins/_body-text.scss +113 -0
- package/dist/scss/mixins/_graphic.scss +66 -0
- package/dist/scss/mixins/_note-text.scss +34 -0
- package/dist/scss/mixins/_visually-hidden.scss +12 -0
- package/dist/scss/spacers/_rules.scss +65 -0
- package/dist/scss/spacers/_variables.scss +19 -0
- package/dist/scss/typography/_box-shadow.scss +11 -0
- package/dist/scss/typography/_font-size.scss +81 -0
- package/dist/scss/typography/_letter-spacing.scss +15 -0
- package/dist/scss/typography/_main.scss +5 -0
- package/dist/scss/typography/_mixins.scss +26 -0
- package/dist/scss/typography/_rules.scss +83 -0
- package/dist/scss/typography/_text-shadow.scss +13 -0
- package/dist/scss/typography/_transform.scss +7 -0
- package/dist/scss/typography/_variables.scss +39 -0
- package/package.json +210 -0
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import { faDesktop, faMobileAlt } from '@fortawesome/free-solid-svg-icons';
|
|
3
|
+
import Fa from 'svelte-fa/src/fa.svelte';
|
|
4
|
+
import { width } from './../stores.js';
|
|
5
|
+
|
|
6
|
+
export let breakpoints = [330, 510, 660, 930, 1200];
|
|
7
|
+
export let maxFrameWidth = 1200;
|
|
8
|
+
export let minFrameWidth = 320;
|
|
9
|
+
|
|
10
|
+
let container;
|
|
11
|
+
|
|
12
|
+
const sliderWidth = 90;
|
|
13
|
+
let windowInnerWidth = 1200;
|
|
14
|
+
$: minWidth = minFrameWidth;
|
|
15
|
+
$: maxWidth = Math.min(windowInnerWidth - 70, maxFrameWidth);
|
|
16
|
+
$: pixelRange = maxWidth - minWidth;
|
|
17
|
+
$: if ($width > maxWidth) width.set(maxWidth);
|
|
18
|
+
$: offset = ($width - minWidth) / pixelRange;
|
|
19
|
+
|
|
20
|
+
let sliding = false;
|
|
21
|
+
let isFocused = false;
|
|
22
|
+
|
|
23
|
+
const roundToNearestFive = (d) => Math.ceil(d / 5) * 5;
|
|
24
|
+
const getPx = () => Math.round(pixelRange * offset + minWidth);
|
|
25
|
+
|
|
26
|
+
let pixelLabel = null;
|
|
27
|
+
|
|
28
|
+
const move = (e) => {
|
|
29
|
+
if (!sliding || !container) return;
|
|
30
|
+
const { left } = container.getBoundingClientRect();
|
|
31
|
+
offset = Math.min(Math.max(0, e.pageX - left), sliderWidth) / sliderWidth;
|
|
32
|
+
pixelLabel = roundToNearestFive(getPx());
|
|
33
|
+
};
|
|
34
|
+
const handleKeyDown = (e) => {
|
|
35
|
+
if (!isFocused) return;
|
|
36
|
+
const { keyCode } = e;
|
|
37
|
+
const pixelWidth = sliderWidth / pixelRange;
|
|
38
|
+
// right
|
|
39
|
+
if (keyCode === 39) {
|
|
40
|
+
offset = Math.min(1, offset + pixelWidth / sliderWidth);
|
|
41
|
+
// left
|
|
42
|
+
} else if (keyCode === 37) {
|
|
43
|
+
offset = Math.max(0, offset - pixelWidth / sliderWidth);
|
|
44
|
+
}
|
|
45
|
+
width.set(getPx());
|
|
46
|
+
};
|
|
47
|
+
const start = (e) => {
|
|
48
|
+
sliding = true;
|
|
49
|
+
move(e);
|
|
50
|
+
};
|
|
51
|
+
const end = () => {
|
|
52
|
+
sliding = false;
|
|
53
|
+
pixelLabel = null;
|
|
54
|
+
width.set(roundToNearestFive(getPx()));
|
|
55
|
+
};
|
|
56
|
+
const onFocus = () => {
|
|
57
|
+
isFocused = true;
|
|
58
|
+
};
|
|
59
|
+
const onBlur = () => {
|
|
60
|
+
isFocused = false;
|
|
61
|
+
};
|
|
62
|
+
const increment = () => {
|
|
63
|
+
const availableBreakpoints = breakpoints
|
|
64
|
+
.filter((b) => b <= maxWidth)
|
|
65
|
+
.filter((b) => b > $width);
|
|
66
|
+
if (availableBreakpoints.length === 0) {
|
|
67
|
+
width.set(maxWidth);
|
|
68
|
+
} else {
|
|
69
|
+
width.set(availableBreakpoints[0]);
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
const decrement = () => {
|
|
73
|
+
const availableBreakpoints = breakpoints.filter((b) => b < $width);
|
|
74
|
+
if (availableBreakpoints.length === 0) {
|
|
75
|
+
width.set(minWidth);
|
|
76
|
+
} else {
|
|
77
|
+
width.set(availableBreakpoints.slice(-1)[0]);
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
</script>
|
|
81
|
+
|
|
82
|
+
<svelte:window
|
|
83
|
+
on:mousemove="{move}"
|
|
84
|
+
on:mouseup="{end}"
|
|
85
|
+
on:keydown="{handleKeyDown}"
|
|
86
|
+
bind:innerWidth="{windowInnerWidth}"
|
|
87
|
+
/>
|
|
88
|
+
|
|
89
|
+
<div id="resizer">
|
|
90
|
+
<div class="slider">
|
|
91
|
+
<div class="label" style="{`opacity: ${sliding || isFocused ? 1 : 0};`}">
|
|
92
|
+
{pixelLabel || $width}px
|
|
93
|
+
</div>
|
|
94
|
+
<button
|
|
95
|
+
class="icon left"
|
|
96
|
+
disabled="{$width === minWidth}"
|
|
97
|
+
on:click="{decrement}"
|
|
98
|
+
on:focus="{onFocus}"
|
|
99
|
+
on:mouseover="{onFocus}"
|
|
100
|
+
on:mouseleave="{onBlur}"
|
|
101
|
+
>
|
|
102
|
+
<Fa icon="{faMobileAlt}" fw />
|
|
103
|
+
</button>
|
|
104
|
+
<div class="slider-container" bind:this="{container}">
|
|
105
|
+
<div class="track"></div>
|
|
106
|
+
<div
|
|
107
|
+
class="handle"
|
|
108
|
+
tabindex="0"
|
|
109
|
+
style="left: calc({offset * 100}% - 5px);"
|
|
110
|
+
on:mousedown="{start}"
|
|
111
|
+
on:focus="{onFocus}"
|
|
112
|
+
on:blur="{onBlur}"
|
|
113
|
+
></div>
|
|
114
|
+
</div>
|
|
115
|
+
<button
|
|
116
|
+
class="icon right"
|
|
117
|
+
disabled="{$width === maxWidth}"
|
|
118
|
+
on:click="{increment}"
|
|
119
|
+
on:focus="{onFocus}"
|
|
120
|
+
on:mouseover="{onFocus}"
|
|
121
|
+
on:mouseleave="{onBlur}"
|
|
122
|
+
>
|
|
123
|
+
<Fa icon="{faDesktop}" fw />
|
|
124
|
+
</button>
|
|
125
|
+
</div>
|
|
126
|
+
</div>
|
|
127
|
+
|
|
128
|
+
<style>#resizer {
|
|
129
|
+
width: 250px;
|
|
130
|
+
position: fixed;
|
|
131
|
+
bottom: 0px;
|
|
132
|
+
right: 0px;
|
|
133
|
+
padding: 15px;
|
|
134
|
+
}
|
|
135
|
+
#resizer .slider {
|
|
136
|
+
width: 100%;
|
|
137
|
+
display: flex;
|
|
138
|
+
justify-content: flex-end;
|
|
139
|
+
align-items: center;
|
|
140
|
+
}
|
|
141
|
+
#resizer .slider > div,
|
|
142
|
+
#resizer .slider button {
|
|
143
|
+
display: inline-block;
|
|
144
|
+
}
|
|
145
|
+
#resizer div.label {
|
|
146
|
+
font-family: monospace;
|
|
147
|
+
font-size: 13px;
|
|
148
|
+
line-height: 13px;
|
|
149
|
+
text-align: center;
|
|
150
|
+
transition: opacity 0.2s;
|
|
151
|
+
color: grey;
|
|
152
|
+
background-color: rgba(255, 255, 255, 0.8);
|
|
153
|
+
padding: 4px 8px;
|
|
154
|
+
border-radius: 4px;
|
|
155
|
+
margin-right: 5px;
|
|
156
|
+
}
|
|
157
|
+
#resizer button.icon {
|
|
158
|
+
font-size: 14px;
|
|
159
|
+
line-height: 14px;
|
|
160
|
+
color: #bbb;
|
|
161
|
+
cursor: pointer;
|
|
162
|
+
background-color: transparent;
|
|
163
|
+
border: 0;
|
|
164
|
+
}
|
|
165
|
+
#resizer button.icon:active, #resizer button.icon:focus {
|
|
166
|
+
outline: none;
|
|
167
|
+
}
|
|
168
|
+
#resizer button.icon:hover {
|
|
169
|
+
color: #999;
|
|
170
|
+
}
|
|
171
|
+
#resizer button.icon:active {
|
|
172
|
+
transform: translate(1px, 1px);
|
|
173
|
+
}
|
|
174
|
+
#resizer button.icon[disabled] {
|
|
175
|
+
color: #ccc;
|
|
176
|
+
cursor: default;
|
|
177
|
+
}
|
|
178
|
+
#resizer button.icon[disabled]:hover {
|
|
179
|
+
color: #ccc;
|
|
180
|
+
}
|
|
181
|
+
#resizer button.icon[disabled]:active {
|
|
182
|
+
transform: translate(0px, 0px);
|
|
183
|
+
}
|
|
184
|
+
#resizer button.icon.left {
|
|
185
|
+
text-align: right;
|
|
186
|
+
padding-right: 3px;
|
|
187
|
+
}
|
|
188
|
+
#resizer button.icon.right {
|
|
189
|
+
padding-left: 6px;
|
|
190
|
+
text-align: left;
|
|
191
|
+
}
|
|
192
|
+
#resizer div.slider-container {
|
|
193
|
+
width: 90px;
|
|
194
|
+
height: 20px;
|
|
195
|
+
position: relative;
|
|
196
|
+
}
|
|
197
|
+
#resizer div.slider-container div.track {
|
|
198
|
+
height: 4px;
|
|
199
|
+
width: 100%;
|
|
200
|
+
position: absolute;
|
|
201
|
+
border-radius: 2px;
|
|
202
|
+
top: calc(50% - 2px);
|
|
203
|
+
background-color: lightgrey;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
.handle {
|
|
207
|
+
z-index: 30;
|
|
208
|
+
width: 10px;
|
|
209
|
+
height: 20px;
|
|
210
|
+
cursor: ew-resize;
|
|
211
|
+
background: #bbb;
|
|
212
|
+
-webkit-user-select: none;
|
|
213
|
+
-moz-user-select: none;
|
|
214
|
+
user-select: none;
|
|
215
|
+
position: absolute;
|
|
216
|
+
border-radius: 4px;
|
|
217
|
+
border: 1px solid grey;
|
|
218
|
+
top: calc(50% - 10px);
|
|
219
|
+
box-shadow: 0 10px 20px rgba(0, 0, 0, 0.19), 0 6px 6px rgba(0, 0, 0, 0.23);
|
|
220
|
+
}
|
|
221
|
+
.handle:active, .handle:focus {
|
|
222
|
+
outline: none;
|
|
223
|
+
}</style>
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
export default (embeds) => {
|
|
2
|
+
const nakedEmbeds = embeds
|
|
3
|
+
.map((e) => e.replace(/\?.+$/, ''))
|
|
4
|
+
.map((e) => e.replace(/index\.html$/, ''))
|
|
5
|
+
.map((e) => e.replace(/^http[s]*:\/\/[\w.]+\.com/, ''));
|
|
6
|
+
|
|
7
|
+
// If just one, get the last path part
|
|
8
|
+
if (nakedEmbeds.length === 1) {
|
|
9
|
+
return [
|
|
10
|
+
nakedEmbeds[0]
|
|
11
|
+
.split('/')
|
|
12
|
+
.filter((d) => d)
|
|
13
|
+
.slice(-1)[0],
|
|
14
|
+
];
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// If many, test each path part for unique-ness
|
|
18
|
+
const test = nakedEmbeds[0];
|
|
19
|
+
let replacementForward = 0;
|
|
20
|
+
for (const i in test.split('/')) {
|
|
21
|
+
const pathPart = test.split('/')[i];
|
|
22
|
+
const notUniq = nakedEmbeds.every((e) => e.split('/')[i] === pathPart);
|
|
23
|
+
if (notUniq) {
|
|
24
|
+
replacementForward += 1;
|
|
25
|
+
} else {
|
|
26
|
+
break;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
if (replacementForward === test.split('/').length) return nakedEmbeds;
|
|
31
|
+
|
|
32
|
+
let replacementBackward = 0;
|
|
33
|
+
for (const i in test.split('/').reverse()) {
|
|
34
|
+
const pathPart = test.split('/').reverse()[i];
|
|
35
|
+
const notUniq = nakedEmbeds.every(
|
|
36
|
+
(e) => e.split('/').reverse()[i] === pathPart
|
|
37
|
+
);
|
|
38
|
+
if (notUniq) {
|
|
39
|
+
replacementBackward += 1;
|
|
40
|
+
} else {
|
|
41
|
+
break;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
return nakedEmbeds.map((e) => {
|
|
46
|
+
if (replacementBackward > 0) {
|
|
47
|
+
return e
|
|
48
|
+
.split('/')
|
|
49
|
+
.slice(replacementForward, replacementBackward * -1)
|
|
50
|
+
.join('/');
|
|
51
|
+
}
|
|
52
|
+
return e.split('/').slice(replacementForward).join('/');
|
|
53
|
+
});
|
|
54
|
+
};
|
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
<script>/**
|
|
2
|
+
* Width of the component within the text well.
|
|
3
|
+
* @type {string}
|
|
4
|
+
*/
|
|
5
|
+
export let width = 'normal';
|
|
6
|
+
/**
|
|
7
|
+
* Add an id to the block tag to target it with custom CSS.
|
|
8
|
+
* @type {string}
|
|
9
|
+
*/
|
|
10
|
+
export let id = '';
|
|
11
|
+
/**
|
|
12
|
+
* Add extra classes to the block tag to target it with custom CSS.
|
|
13
|
+
* @type {string}
|
|
14
|
+
*/
|
|
15
|
+
export let cls = '';
|
|
16
|
+
/** Snap block to column widths, rather than fluidly resizing them. */
|
|
17
|
+
export let snap = false;
|
|
18
|
+
/**
|
|
19
|
+
* ARIA [role](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles) for the block
|
|
20
|
+
* @type {string}
|
|
21
|
+
*/
|
|
22
|
+
export let role = null;
|
|
23
|
+
/**
|
|
24
|
+
* Notes to the graphic, passed in as a markdown string.
|
|
25
|
+
* @type {string}
|
|
26
|
+
*/
|
|
27
|
+
export let notes = null;
|
|
28
|
+
/**
|
|
29
|
+
* Set a different width for the text within the text well, for example,
|
|
30
|
+
* "normal" to keep the title, description and notes inline with the rest
|
|
31
|
+
* of the text well. Can't ever be wider than `width`.
|
|
32
|
+
* @type {string}
|
|
33
|
+
*/
|
|
34
|
+
export let textWidth = null;
|
|
35
|
+
/**
|
|
36
|
+
* Title of the graphic
|
|
37
|
+
* @type {string}
|
|
38
|
+
*/
|
|
39
|
+
export let title = null;
|
|
40
|
+
/**
|
|
41
|
+
* Description of the graphic, passed in as a markdown string.
|
|
42
|
+
* @type {string}
|
|
43
|
+
*/
|
|
44
|
+
export let description = null;
|
|
45
|
+
/**
|
|
46
|
+
* ARIA [label](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-label) for the block
|
|
47
|
+
* @type {string}
|
|
48
|
+
*/
|
|
49
|
+
export let ariaLabel = 'chart';
|
|
50
|
+
/**
|
|
51
|
+
* ARIA description, passed in as a markdown string.
|
|
52
|
+
* @type {string}
|
|
53
|
+
*/
|
|
54
|
+
export let ariaDescription = null;
|
|
55
|
+
import AriaHidden from './AriaHidden.svelte';
|
|
56
|
+
import TextBlock from './TextBlock.svelte';
|
|
57
|
+
import Block from '../Block/Block.svelte';
|
|
58
|
+
import PaddingReset from '../PaddingReset/index.svelte';
|
|
59
|
+
import { marked } from 'marked';
|
|
60
|
+
</script>
|
|
61
|
+
|
|
62
|
+
<Block
|
|
63
|
+
id="{id}"
|
|
64
|
+
snap="{snap}"
|
|
65
|
+
role="{role}"
|
|
66
|
+
width="{width}"
|
|
67
|
+
ariaLabel="{ariaLabel}"
|
|
68
|
+
cls="graphic {cls}"
|
|
69
|
+
>
|
|
70
|
+
<div>
|
|
71
|
+
{#if $$slots.title}
|
|
72
|
+
<PaddingReset width="{width}">
|
|
73
|
+
<TextBlock width="{textWidth}">
|
|
74
|
+
<!-- Custom title content -->
|
|
75
|
+
<slot name="title" />
|
|
76
|
+
</TextBlock>
|
|
77
|
+
</PaddingReset>
|
|
78
|
+
{:else if title}
|
|
79
|
+
<PaddingReset width="{width}">
|
|
80
|
+
<TextBlock width="{textWidth}">
|
|
81
|
+
<h3>{title}</h3>
|
|
82
|
+
{#if description}
|
|
83
|
+
{@html marked(description)}
|
|
84
|
+
{/if}
|
|
85
|
+
</TextBlock>
|
|
86
|
+
</PaddingReset>
|
|
87
|
+
{/if}
|
|
88
|
+
<AriaHidden hidden="{!!$$slots.aria || !!ariaDescription}">
|
|
89
|
+
<!-- Graphic content -->
|
|
90
|
+
<slot />
|
|
91
|
+
</AriaHidden>
|
|
92
|
+
{#if $$slots.aria || ariaDescription}
|
|
93
|
+
<div class="visually-hidden">
|
|
94
|
+
{#if $$slots.aria}
|
|
95
|
+
<!-- Custom ARIA markup -->
|
|
96
|
+
<slot name="aria" />
|
|
97
|
+
{:else}
|
|
98
|
+
{@html marked(ariaDescription)}
|
|
99
|
+
{/if}
|
|
100
|
+
</div>
|
|
101
|
+
{/if}
|
|
102
|
+
{#if $$slots.notes}
|
|
103
|
+
<PaddingReset width="{width}">
|
|
104
|
+
<TextBlock width="{textWidth}">
|
|
105
|
+
<!-- Custom notes content -->
|
|
106
|
+
<slot name="notes" />
|
|
107
|
+
</TextBlock>
|
|
108
|
+
</PaddingReset>
|
|
109
|
+
{:else if notes}
|
|
110
|
+
<PaddingReset width="{width}">
|
|
111
|
+
<TextBlock width="{textWidth}">
|
|
112
|
+
<aside>
|
|
113
|
+
{@html marked(notes)}
|
|
114
|
+
</aside>
|
|
115
|
+
</TextBlock>
|
|
116
|
+
</PaddingReset>
|
|
117
|
+
{/if}
|
|
118
|
+
</div>
|
|
119
|
+
</Block>
|
|
120
|
+
|
|
121
|
+
<!-- svelte-ignore css-unused-selector -->
|
|
122
|
+
<style>.paragraph-size {
|
|
123
|
+
font-size: 1.3rem;
|
|
124
|
+
line-height: 2.1rem;
|
|
125
|
+
}
|
|
126
|
+
.paragraph-size.font-sans {
|
|
127
|
+
font-size: 1.1rem;
|
|
128
|
+
line-height: 1.75rem;
|
|
129
|
+
}
|
|
130
|
+
@media (max-width: 540px) {
|
|
131
|
+
.paragraph-size {
|
|
132
|
+
font-size: 1.1rem;
|
|
133
|
+
line-height: 1.8rem;
|
|
134
|
+
}
|
|
135
|
+
.paragraph-size.font-sans {
|
|
136
|
+
font-size: 1rem;
|
|
137
|
+
line-height: 1.6rem;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
.paragraph-size.important {
|
|
141
|
+
font-size: 1.3rem !important;
|
|
142
|
+
line-height: 2.1rem !important;
|
|
143
|
+
}
|
|
144
|
+
.paragraph-size.important.font-sans {
|
|
145
|
+
font-size: 1.1rem !important;
|
|
146
|
+
line-height: 1.8rem !important;
|
|
147
|
+
}
|
|
148
|
+
@media (max-width: 540px) {
|
|
149
|
+
.paragraph-size.important {
|
|
150
|
+
font-size: 1.1rem !important;
|
|
151
|
+
line-height: 1.8rem !important;
|
|
152
|
+
}
|
|
153
|
+
.paragraph-size.important.font-sans {
|
|
154
|
+
font-size: 1rem !important;
|
|
155
|
+
line-height: 1.6rem !important;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
.small-size {
|
|
160
|
+
font-size: 0.9rem;
|
|
161
|
+
line-height: 1.2rem;
|
|
162
|
+
}
|
|
163
|
+
@media (max-width: 540px) {
|
|
164
|
+
.small-size {
|
|
165
|
+
font-size: 0.8rem;
|
|
166
|
+
line-height: 1.1rem;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
.small-size.important {
|
|
170
|
+
font-size: 0.9rem !important;
|
|
171
|
+
line-height: 1.2rem !important;
|
|
172
|
+
}
|
|
173
|
+
@media (max-width: 540px) {
|
|
174
|
+
.small-size.important {
|
|
175
|
+
font-size: 0.8rem !important;
|
|
176
|
+
line-height: 1.1rem !important;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
.blockquote-size {
|
|
181
|
+
font-size: 1.6rem;
|
|
182
|
+
line-height: 2.1rem;
|
|
183
|
+
}
|
|
184
|
+
@media (max-width: 540px) {
|
|
185
|
+
.blockquote-size {
|
|
186
|
+
font-size: 1.3rem;
|
|
187
|
+
line-height: 1.9rem;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
.blockquote-size.important {
|
|
191
|
+
font-size: 1.6rem !important;
|
|
192
|
+
line-height: 2rem !important;
|
|
193
|
+
}
|
|
194
|
+
@media (max-width: 540px) {
|
|
195
|
+
.blockquote-size.important {
|
|
196
|
+
font-size: 1.3rem !important;
|
|
197
|
+
line-height: 1.8rem !important;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
div :global(h3) {
|
|
202
|
+
margin-bottom: 0.5rem;
|
|
203
|
+
color: var(--theme-colour-text-primary, #404040);
|
|
204
|
+
}
|
|
205
|
+
div :global(p) {
|
|
206
|
+
-webkit-font-smoothing: antialiased;
|
|
207
|
+
font-family: "Knowledge", "Source Sans Pro", Arial, sans-serif;
|
|
208
|
+
font-size: 1.1rem;
|
|
209
|
+
line-height: 1.5rem;
|
|
210
|
+
color: var(--theme-colour-text-primary, #404040);
|
|
211
|
+
margin-bottom: 1rem;
|
|
212
|
+
}
|
|
213
|
+
div :global(p:last-of-type) {
|
|
214
|
+
margin-bottom: 1rem;
|
|
215
|
+
}
|
|
216
|
+
@media (max-width: 540px) {
|
|
217
|
+
div :global(p) {
|
|
218
|
+
font-size: 1rem;
|
|
219
|
+
line-height: 1.35rem;
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
div :global(p) :global(a) {
|
|
223
|
+
color: currentColor;
|
|
224
|
+
background-size: 1px 1px;
|
|
225
|
+
background-image: url('data:image/svg+xml;utf8,<svg preserveAspectRatio="none" viewBox="0 0 1 1" xmlns="http://www.w3.org/2000/svg"><line x1="0" y1="0" x2="2" y2="2" stroke="rgba(0, 0, 0, 0.8)" /></svg>');
|
|
226
|
+
background-position: 0 1.1rem;
|
|
227
|
+
background-repeat: repeat-x;
|
|
228
|
+
text-decoration: none;
|
|
229
|
+
}
|
|
230
|
+
div :global(p) :global(a:hover) {
|
|
231
|
+
text-decoration: none;
|
|
232
|
+
}
|
|
233
|
+
div :global(aside) :global(p) {
|
|
234
|
+
font-family: "Knowledge", "Source Sans Pro", Arial, sans-serif;
|
|
235
|
+
margin-bottom: 0;
|
|
236
|
+
color: var(--theme-colour-text-secondary, #666666);
|
|
237
|
+
font-size: 0.9rem;
|
|
238
|
+
line-height: 1.2rem;
|
|
239
|
+
}
|
|
240
|
+
div :global(aside) :global(p:last-of-type) {
|
|
241
|
+
margin-bottom: 0;
|
|
242
|
+
}
|
|
243
|
+
@media (max-width: 540px) {
|
|
244
|
+
div :global(aside) :global(p) {
|
|
245
|
+
font-size: 0.8rem;
|
|
246
|
+
line-height: 1.1rem;
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
div :global(aside) :global(p) :global(a) {
|
|
250
|
+
color: currentColor;
|
|
251
|
+
text-decoration: underline;
|
|
252
|
+
}
|
|
253
|
+
div :global(aside) :global(p) :global(a:hover) {
|
|
254
|
+
text-decoration: underline;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
.visually-hidden {
|
|
258
|
+
position: absolute !important;
|
|
259
|
+
width: 1px !important;
|
|
260
|
+
height: 1px !important;
|
|
261
|
+
padding: 0 !important;
|
|
262
|
+
margin: -1px !important;
|
|
263
|
+
overflow: hidden !important;
|
|
264
|
+
clip: rect(0, 0, 0, 0) !important;
|
|
265
|
+
-webkit-clip-path: polygon(0px 0px, 0px 0px, 0px 0px);
|
|
266
|
+
clip-path: polygon(0px 0px, 0px 0px, 0px 0px);
|
|
267
|
+
white-space: nowrap !important;
|
|
268
|
+
border: 0 !important;
|
|
269
|
+
}</style>
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
<script>/**
|
|
2
|
+
* Headline
|
|
3
|
+
*/
|
|
4
|
+
export let hed = 'Reuters Graphics Interactive';
|
|
5
|
+
/**
|
|
6
|
+
* Dek
|
|
7
|
+
*/
|
|
8
|
+
export let dek = null;
|
|
9
|
+
/**
|
|
10
|
+
* Section title
|
|
11
|
+
*/
|
|
12
|
+
export let section = null;
|
|
13
|
+
import Block from '../Block/Block.svelte';
|
|
14
|
+
</script>
|
|
15
|
+
|
|
16
|
+
<Block cls="mb-1">
|
|
17
|
+
<header class="headline">
|
|
18
|
+
{#if $$slots.crown}
|
|
19
|
+
<div class="crown-container">
|
|
20
|
+
<!-- Crown named slot -->
|
|
21
|
+
<slot name="crown" />
|
|
22
|
+
</div>
|
|
23
|
+
{/if}
|
|
24
|
+
<div class="title">
|
|
25
|
+
{#if section}
|
|
26
|
+
<p class="{'section-title'}">{section}</p>
|
|
27
|
+
{/if}
|
|
28
|
+
{#if $$slots.hed}
|
|
29
|
+
<!-- Headline override named slot -->
|
|
30
|
+
<slot name="hed" />
|
|
31
|
+
{:else}
|
|
32
|
+
<h1>{hed}</h1>
|
|
33
|
+
{/if}
|
|
34
|
+
{#if dek}
|
|
35
|
+
<p>{dek}</p>
|
|
36
|
+
{/if}
|
|
37
|
+
</div>
|
|
38
|
+
{#if $$slots.byline || $$slots.dateline}
|
|
39
|
+
<aside class="article-metadata" class:pt-1="{!dek}">
|
|
40
|
+
{#if $$slots.byline}
|
|
41
|
+
<div class="byline-container">
|
|
42
|
+
<div class="byline">
|
|
43
|
+
<!-- Byline named slot -->
|
|
44
|
+
<slot name="byline" />
|
|
45
|
+
</div>
|
|
46
|
+
</div>
|
|
47
|
+
{/if}
|
|
48
|
+
{#if $$slots.dateline}
|
|
49
|
+
<div class="dateline-container">
|
|
50
|
+
<div class="published">
|
|
51
|
+
<!-- Dateline named slot -->
|
|
52
|
+
<slot name="dateline" />
|
|
53
|
+
</div>
|
|
54
|
+
</div>
|
|
55
|
+
{/if}
|
|
56
|
+
</aside>
|
|
57
|
+
{/if}
|
|
58
|
+
</header>
|
|
59
|
+
</Block>
|
|
60
|
+
|
|
61
|
+
<style>header.headline {
|
|
62
|
+
text-align: center;
|
|
63
|
+
margin-top: 4rem;
|
|
64
|
+
margin-bottom: 0;
|
|
65
|
+
color: var(--theme-colour-text-primary, #404040);
|
|
66
|
+
}
|
|
67
|
+
header.headline :global(h1) {
|
|
68
|
+
font-size: 4rem;
|
|
69
|
+
margin: 5px 0;
|
|
70
|
+
line-height: 1.1;
|
|
71
|
+
font-family: var(--theme-font-family-hed, "Knowledge", "Source Sans Pro", Arial, sans-serif);
|
|
72
|
+
color: var(--theme-colour-text-primary, #404040);
|
|
73
|
+
}
|
|
74
|
+
header.headline :global(p) {
|
|
75
|
+
font-family: var(--theme-font-family-subhed, "Knowledge", "Source Sans Pro", Arial, sans-serif);
|
|
76
|
+
color: var(--theme-colour-text-primary, #404040);
|
|
77
|
+
margin: 0;
|
|
78
|
+
font-weight: 200;
|
|
79
|
+
}
|
|
80
|
+
header.headline :global(p.section-title) {
|
|
81
|
+
font-size: 1rem;
|
|
82
|
+
font-weight: 800;
|
|
83
|
+
color: var(--theme-colour-accent, #a00000);
|
|
84
|
+
}
|
|
85
|
+
header.headline .article-metadata {
|
|
86
|
+
padding: 40px 0;
|
|
87
|
+
font-family: var(--theme-font-family-note, "Knowledge", "Source Sans Pro", Arial, sans-serif);
|
|
88
|
+
color: var(--theme-colour-text-primary, #404040);
|
|
89
|
+
text-align: center;
|
|
90
|
+
}
|
|
91
|
+
header.headline .article-metadata .byline-container {
|
|
92
|
+
margin-bottom: 2px;
|
|
93
|
+
}
|
|
94
|
+
header.headline .article-metadata .byline :global(a) {
|
|
95
|
+
color: var(--theme-colour-text-primary, #404040);
|
|
96
|
+
text-decoration: none;
|
|
97
|
+
}
|
|
98
|
+
header.headline .article-metadata .dateline-container {
|
|
99
|
+
text-transform: uppercase;
|
|
100
|
+
color: var(--theme-colour-text-secondary, #666666);
|
|
101
|
+
font-size: 0.8rem;
|
|
102
|
+
line-height: 1.2rem;
|
|
103
|
+
letter-spacing: 0.2px;
|
|
104
|
+
}
|
|
105
|
+
header.headline div.crown-container {
|
|
106
|
+
display: flex;
|
|
107
|
+
justify-content: center;
|
|
108
|
+
align-items: center;
|
|
109
|
+
}</style>
|