@reuters-graphics/graphics-components 3.0.3 → 3.0.5
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/Article/Article.mdx +1 -1
- package/dist/components/Article/Article.stories.svelte +4 -4
- package/dist/components/BeforeAfter/BeforeAfter.stories.svelte +2 -2
- package/dist/components/BeforeAfter/BeforeAfter.svelte +13 -12
- package/dist/components/Block/Block.stories.svelte +3 -3
- package/dist/components/Byline/Byline.stories.svelte +1 -1
- package/dist/components/Byline/Byline.svelte +3 -3
- package/dist/components/Byline/Byline.svelte.d.ts +1 -1
- package/dist/components/EndNotes/EndNotes.svelte +7 -7
- package/dist/components/Framer/Resizer/index.svelte +3 -3
- package/dist/components/Framer/Typeahead/index.svelte +1 -1
- package/dist/components/GraphicBlock/GraphicBlock.svelte +6 -6
- package/dist/components/Headline/Headline.svelte +2 -2
- package/dist/components/HeroHeadline/HeroHeadline.mdx +2 -2
- package/dist/components/HeroHeadline/HeroHeadline.stories.svelte +2 -2
- package/dist/components/HeroHeadline/HeroHeadline.svelte +5 -5
- package/dist/components/InfoBox/InfoBox.svelte +17 -17
- package/dist/components/PhotoPack/PhotoPack.svelte +3 -3
- package/dist/components/ReferralBlock/ReferralBlock.svelte +4 -4
- package/dist/components/Scroller/Background.svelte +15 -6
- package/dist/components/Scroller/Embedded/Foreground.svelte +1 -1
- package/dist/components/Scroller/Foreground.svelte +2 -2
- package/dist/components/Scroller/Scroller.mdx +1 -1
- package/dist/components/Scroller/Scroller.svelte +1 -1
- package/dist/components/ScrollerBase/ScrollerBase.mdx +82 -0
- package/dist/components/ScrollerBase/ScrollerBase.stories.svelte +12 -0
- package/dist/components/ScrollerBase/ScrollerBase.stories.svelte.d.ts +19 -0
- package/dist/components/{Scroller/ScrollerBase/index.svelte → ScrollerBase/ScrollerBase.svelte} +1 -1
- package/dist/components/{Scroller/ScrollerBase/index.svelte.d.ts → ScrollerBase/ScrollerBase.svelte.d.ts} +3 -3
- package/dist/components/ScrollerBase/demo/DraggableLabel.svelte +96 -0
- package/dist/components/ScrollerBase/demo/DraggableLabel.svelte.d.ts +21 -0
- package/dist/components/ScrollerBase/demo/ScrollerDemo.svelte +82 -0
- package/dist/components/ScrollerBase/demo/ScrollerDemo.svelte.d.ts +3 -0
- package/dist/components/SearchInput/SearchInput.svelte +4 -4
- package/dist/components/SimpleTimeline/SimpleTimeline.svelte +9 -9
- package/dist/components/SiteFooter/CompanyLinks.svelte +11 -11
- package/dist/components/SiteFooter/LegalLinks.svelte +9 -9
- package/dist/components/SiteFooter/QuickLinks.svelte +11 -11
- package/dist/components/SiteFooter/SiteFooter.stories.svelte +1 -1
- package/dist/components/SiteFooter/SiteFooter.svelte +1 -1
- package/dist/components/SiteHeader/MobileMenu/index.svelte +16 -16
- package/dist/components/SiteHeader/NavBar/DownArrow.svelte +1 -1
- package/dist/components/SiteHeader/NavBar/NavDropdown/MoreDropdown.svelte +3 -3
- package/dist/components/SiteHeader/NavBar/NavDropdown/SectionDropdown.svelte +3 -3
- package/dist/components/SiteHeader/NavBar/NavDropdown/Spinner/index.svelte +1 -1
- package/dist/components/SiteHeader/NavBar/NavDropdown/StoryCard/index.svelte +2 -2
- package/dist/components/SiteHeader/NavBar/NavDropdown/index.svelte +13 -13
- package/dist/components/SiteHeader/NavBar/index.svelte +1 -1
- package/dist/components/SiteHeader/SiteHeader.stories.svelte +1 -1
- package/dist/components/SiteHeader/SiteHeader.svelte +9 -9
- package/dist/components/Spinner/Spinner.svelte +1 -1
- package/dist/components/Table/Table.svelte +8 -7
- package/dist/components/Table/components/{RightArrow.svelte → NextArrow.svelte} +3 -0
- package/dist/components/Table/components/{LeftArrow.svelte.d.ts → NextArrow.svelte.d.ts} +3 -3
- package/dist/components/Table/components/Pagination.svelte +5 -4
- package/dist/components/Table/components/{LeftArrow.svelte → PrevArrow.svelte} +3 -0
- package/dist/components/Table/components/{RightArrow.svelte.d.ts → PrevArrow.svelte.d.ts} +3 -3
- package/dist/components/Table/components/Select.svelte +20 -6
- package/dist/components/Theme/@types/component.d.ts +1 -0
- package/dist/components/Theme/Theme.svelte +2 -2
- package/dist/components/Theme/Theme.svelte.d.ts +4 -4
- package/dist/components/ToolsHeader/ToolsHeader.stories.svelte +1 -1
- package/dist/components/Video/Video.stories.svelte +2 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/scss/tokens/borders/_border-radius.scss +108 -108
- package/dist/scss/tokens/borders/_border-width.scss +40 -40
- package/dist/scss/tokens/sizing/_width.scss +2 -2
- package/dist/scss/tokens/spacers/_fluid-margin.scss +16 -16
- package/dist/scss/tokens/spacers/_fluid-padding.scss +16 -16
- package/dist/scss/tokens/spacers/_margin.scss +24 -24
- package/dist/scss/tokens/spacers/_padding.scss +16 -16
- package/dist/scss/tokens/spacers/mixins/_fluid-margin.scss +168 -168
- package/dist/scss/tokens/spacers/mixins/_fluid-padding.scss +88 -88
- package/package.json +2 -1
|
@@ -66,13 +66,13 @@
|
|
|
66
66
|
|
|
67
67
|
:global(#article-story-basic, #article-column-widths-demo) {
|
|
68
68
|
width: calc(100% + 30px);
|
|
69
|
-
margin-
|
|
69
|
+
margin-inline-start: -15px;
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
:global(#article-column-widths-demo) {
|
|
73
73
|
background-color: #ddd;
|
|
74
74
|
position: relative;
|
|
75
|
-
margin-
|
|
75
|
+
margin-block-end: 10px;
|
|
76
76
|
}
|
|
77
77
|
|
|
78
78
|
:global(#article-column-widths-demo .article-boundaries) {
|
|
@@ -89,9 +89,9 @@
|
|
|
89
89
|
:global(#article-column-widths-demo div.article-block) {
|
|
90
90
|
height: 300px;
|
|
91
91
|
background: #81a1c1;
|
|
92
|
-
margin-
|
|
92
|
+
margin-block-end: 2px;
|
|
93
93
|
height: 50px;
|
|
94
|
-
padding-
|
|
94
|
+
padding-inline-start: 3px;
|
|
95
95
|
color: white;
|
|
96
96
|
font-size: 1rem;
|
|
97
97
|
}
|
|
@@ -40,13 +40,13 @@
|
|
|
40
40
|
afterAlt="Satellite image of Russian base at Myrne taken on Oct. 20, 2020."
|
|
41
41
|
>
|
|
42
42
|
{#snippet beforeOverlay()}
|
|
43
|
-
<div class="overlay p-3 before
|
|
43
|
+
<div class="overlay p-3 before">
|
|
44
44
|
<p class="h4 font-bold">July 7, 2020</p>
|
|
45
45
|
<p class="body-note">Initially, this site was far smaller.</p>
|
|
46
46
|
</div>
|
|
47
47
|
{/snippet}
|
|
48
48
|
{#snippet afterOverlay()}
|
|
49
|
-
<div class="overlay p-3 after
|
|
49
|
+
<div class="overlay p-3 after">
|
|
50
50
|
<p class="h4 font-bold">Oct. 20, 2020</p>
|
|
51
51
|
<p class="body-note">But then forces built up.</p>
|
|
52
52
|
</div>
|
|
@@ -284,6 +284,7 @@ https://utopia.fyi/space/calculator/?c=320,18,1.125,1280,21,1.25,7,3,&s=0.75|0.5
|
|
|
284
284
|
/* Scales by 1.125 */
|
|
285
285
|
button.before-after-container {
|
|
286
286
|
box-sizing: content-box;
|
|
287
|
+
text-align: inherit;
|
|
287
288
|
}
|
|
288
289
|
button.before-after-container img {
|
|
289
290
|
top: 0;
|
|
@@ -301,10 +302,10 @@ button.before-after-container .overlay-container {
|
|
|
301
302
|
top: 0;
|
|
302
303
|
}
|
|
303
304
|
button.before-after-container .overlay-container :global(:first-child) {
|
|
304
|
-
margin-
|
|
305
|
+
margin-block-start: 0;
|
|
305
306
|
}
|
|
306
307
|
button.before-after-container .overlay-container :global(:last-child) {
|
|
307
|
-
margin-
|
|
308
|
+
margin-block-end: 0;
|
|
308
309
|
}
|
|
309
310
|
button.before-after-container .overlay-container.before {
|
|
310
311
|
left: 0;
|
|
@@ -352,18 +353,18 @@ button.before-after-container .overlay-container.after {
|
|
|
352
353
|
height: 0;
|
|
353
354
|
user-select: none;
|
|
354
355
|
position: relative;
|
|
355
|
-
border-
|
|
356
|
-
border-
|
|
356
|
+
border-block-start: 10px solid transparent;
|
|
357
|
+
border-block-end: 10px solid transparent;
|
|
357
358
|
}
|
|
358
359
|
.handle .arrow-right {
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
border-
|
|
360
|
+
inset-inline-start: 19px;
|
|
361
|
+
inset-block-end: 14px;
|
|
362
|
+
border-inline-start: 10px solid var(--before-after-handle-colour);
|
|
362
363
|
}
|
|
363
364
|
.handle .arrow-left {
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
border-
|
|
365
|
+
inset-inline-start: 3px;
|
|
366
|
+
inset-block-start: 6px;
|
|
367
|
+
border-inline-end: 10px solid var(--before-after-handle-colour);
|
|
367
368
|
}
|
|
368
369
|
|
|
369
370
|
.before-after-caption :global(p) {
|
|
@@ -372,6 +373,6 @@ button.before-after-container .overlay-container.after {
|
|
|
372
373
|
font-size: var(--theme-font-size-xs);
|
|
373
374
|
line-height: 1.3;
|
|
374
375
|
font-weight: 400;
|
|
375
|
-
margin-
|
|
376
|
-
margin-
|
|
376
|
+
margin-block-start: clamp(0.31rem, 0.31rem + 0vw, 0.31rem);
|
|
377
|
+
margin-block-end: clamp(0.56rem, 0.52rem + 0.21vw, 0.69rem);
|
|
377
378
|
}</style>
|
|
@@ -129,7 +129,7 @@
|
|
|
129
129
|
background-color: #ddd;
|
|
130
130
|
position: relative;
|
|
131
131
|
width: calc(100% + 30px);
|
|
132
|
-
margin-
|
|
132
|
+
margin-inline-start: -15px;
|
|
133
133
|
}
|
|
134
134
|
|
|
135
135
|
:global(#block-demo-article .article-boundaries) {
|
|
@@ -145,7 +145,7 @@
|
|
|
145
145
|
}
|
|
146
146
|
|
|
147
147
|
:global(#block-demo-article div.article-block.block-snap-widths-demo) {
|
|
148
|
-
margin-
|
|
148
|
+
margin-block-end: 2px;
|
|
149
149
|
height: 40px;
|
|
150
150
|
font-size: 11px;
|
|
151
151
|
}
|
|
@@ -156,7 +156,7 @@
|
|
|
156
156
|
|
|
157
157
|
:global(#block-demo-article .label,
|
|
158
158
|
#block-demo-article div.article-block.block-snap-widths-demo) {
|
|
159
|
-
padding-
|
|
159
|
+
padding-inline-start: 3px;
|
|
160
160
|
color: white;
|
|
161
161
|
font-weight: 500;
|
|
162
162
|
}
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
/**
|
|
22
22
|
* Alignment of the byline.
|
|
23
23
|
*/
|
|
24
|
-
align?: '
|
|
24
|
+
align?: 'auto' | 'center';
|
|
25
25
|
/**
|
|
26
26
|
* Add an id to to target with custom CSS.
|
|
27
27
|
* @type {string}
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
authors = [],
|
|
55
55
|
publishTime,
|
|
56
56
|
updateTime,
|
|
57
|
-
align = '
|
|
57
|
+
align = 'auto',
|
|
58
58
|
id = '',
|
|
59
59
|
cls = '',
|
|
60
60
|
getAuthorPage = getAuthorPageUrl,
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
updated,
|
|
64
64
|
}: Props = $props();
|
|
65
65
|
|
|
66
|
-
let alignmentClass = $derived(align === '
|
|
66
|
+
let alignmentClass = $derived(align === 'center' ? 'text-center' : '');
|
|
67
67
|
|
|
68
68
|
/**
|
|
69
69
|
/* Date validation and formatter functions
|
|
@@ -47,13 +47,13 @@ https://utopia.fyi/space/calculator/?c=320,18,1.125,1280,21,1.25,7,3,&s=0.75|0.5
|
|
|
47
47
|
font-size: var(--theme-font-size-xs);
|
|
48
48
|
line-height: 1.3;
|
|
49
49
|
font-weight: 400;
|
|
50
|
-
margin-
|
|
51
|
-
margin-
|
|
50
|
+
margin-block-start: clamp(0.31rem, 0.31rem + 0vw, 0.31rem);
|
|
51
|
+
margin-block-end: clamp(0.56rem, 0.52rem + 0.21vw, 0.69rem);
|
|
52
52
|
color: var(--theme-colour-text-primary);
|
|
53
53
|
font-weight: 500;
|
|
54
54
|
letter-spacing: 0em;
|
|
55
|
-
margin-
|
|
56
|
-
margin-
|
|
55
|
+
margin-block-start: clamp(0.88rem, 0.83rem + 0.21vw, 1rem);
|
|
56
|
+
margin-block-end: 0.125rem;
|
|
57
57
|
text-transform: none;
|
|
58
58
|
}
|
|
59
59
|
|
|
@@ -63,7 +63,7 @@ https://utopia.fyi/space/calculator/?c=320,18,1.125,1280,21,1.25,7,3,&s=0.75|0.5
|
|
|
63
63
|
font-size: var(--theme-font-size-xs);
|
|
64
64
|
line-height: 1.3;
|
|
65
65
|
font-weight: 400;
|
|
66
|
-
margin-
|
|
67
|
-
margin-
|
|
68
|
-
margin-
|
|
66
|
+
margin-block-start: clamp(0.31rem, 0.31rem + 0vw, 0.31rem);
|
|
67
|
+
margin-block-end: clamp(0.56rem, 0.52rem + 0.21vw, 0.69rem);
|
|
68
|
+
margin-block-start: 0;
|
|
69
69
|
}</style>
|
|
@@ -165,7 +165,7 @@
|
|
|
165
165
|
background-color: rgba(255, 255, 255, 0.8);
|
|
166
166
|
padding: 4px 8px;
|
|
167
167
|
border-radius: 4px;
|
|
168
|
-
margin-
|
|
168
|
+
margin-inline-end: 5px;
|
|
169
169
|
}
|
|
170
170
|
#resizer button.icon {
|
|
171
171
|
font-size: 14px;
|
|
@@ -196,10 +196,10 @@
|
|
|
196
196
|
}
|
|
197
197
|
#resizer button.icon.left {
|
|
198
198
|
text-align: right;
|
|
199
|
-
padding-
|
|
199
|
+
padding-inline-end: 3px;
|
|
200
200
|
}
|
|
201
201
|
#resizer button.icon.right {
|
|
202
|
-
padding-
|
|
202
|
+
padding-inline-start: 6px;
|
|
203
203
|
text-align: left;
|
|
204
204
|
}
|
|
205
205
|
#resizer div.slider-container {
|
|
@@ -138,8 +138,8 @@ div.container {
|
|
|
138
138
|
display: contents;
|
|
139
139
|
}
|
|
140
140
|
div.container :global(.article-block.graphic p) {
|
|
141
|
-
margin-
|
|
142
|
-
margin-
|
|
141
|
+
margin-block-start: 0;
|
|
142
|
+
margin-block-end: clamp(0.56rem, 0.52rem + 0.21vw, 0.69rem);
|
|
143
143
|
font-family: var(--theme-font-family-note);
|
|
144
144
|
font-size: calc(0.9 * var(--theme-font-size-base));
|
|
145
145
|
color: var(--theme-colour-text-primary);
|
|
@@ -152,8 +152,8 @@ div.container :global(.article-block.graphic aside p) {
|
|
|
152
152
|
font-size: var(--theme-font-size-xs);
|
|
153
153
|
line-height: 1.3;
|
|
154
154
|
font-weight: 400;
|
|
155
|
-
margin-
|
|
156
|
-
margin-
|
|
157
|
-
margin-
|
|
158
|
-
margin-
|
|
155
|
+
margin-block-start: clamp(0.31rem, 0.31rem + 0vw, 0.31rem);
|
|
156
|
+
margin-block-end: clamp(0.56rem, 0.52rem + 0.21vw, 0.69rem);
|
|
157
|
+
margin-block-start: clamp(0.31rem, 0.31rem + 0vw, 0.31rem);
|
|
158
|
+
margin-block-end: clamp(0.31rem, 0.31rem + 0vw, 0.31rem);
|
|
159
159
|
}</style>
|
|
@@ -155,9 +155,9 @@ https://utopia.fyi/space/calculator/?c=320,18,1.125,1280,21,1.25,7,3,&s=0.75|0.5
|
|
|
155
155
|
max-width: 660px;
|
|
156
156
|
}
|
|
157
157
|
.headline-wrapper :global(.dek p) {
|
|
158
|
-
margin-
|
|
158
|
+
margin-block-start: 0;
|
|
159
159
|
font-family: var(--theme-font-family-note);
|
|
160
160
|
line-height: 1.3;
|
|
161
161
|
font-weight: 300;
|
|
162
|
-
margin-
|
|
162
|
+
margin-block-end: clamp(0.88rem, 0.83rem + 0.21vw, 1rem);
|
|
163
163
|
}</style>
|
|
@@ -51,7 +51,7 @@ In the graphics kit, set styles in `global.scss` to make the Reuters site header
|
|
|
51
51
|
border: none !important;
|
|
52
52
|
}
|
|
53
53
|
.hero-wrapper {
|
|
54
|
-
margin-
|
|
54
|
+
margin-block-start: -64px;
|
|
55
55
|
}
|
|
56
56
|
```
|
|
57
57
|
|
|
@@ -316,7 +316,7 @@ Add styles in `global.scss`:
|
|
|
316
316
|
}
|
|
317
317
|
|
|
318
318
|
.dek {
|
|
319
|
-
margin-
|
|
319
|
+
margin-block-start: 1rem;
|
|
320
320
|
p {
|
|
321
321
|
color: #ffffff;
|
|
322
322
|
text-shadow: 1px 1px 8px #ff7c88;
|
|
@@ -243,7 +243,7 @@
|
|
|
243
243
|
filter: drop-shadow(0px 0px 12px #ff7c88);
|
|
244
244
|
}
|
|
245
245
|
.custom-hed .dek {
|
|
246
|
-
margin-
|
|
246
|
+
margin-block-start: 1rem;
|
|
247
247
|
}
|
|
248
248
|
.custom-hed .dek p {
|
|
249
249
|
color: #ffffff;
|
|
@@ -260,5 +260,5 @@
|
|
|
260
260
|
border: none !important;
|
|
261
261
|
}
|
|
262
262
|
.transparent-header :global(.hero-wrapper) {
|
|
263
|
-
margin-
|
|
263
|
+
margin-block-start: -64px;
|
|
264
264
|
}</style>
|
|
@@ -200,7 +200,7 @@
|
|
|
200
200
|
{getAuthorPage}
|
|
201
201
|
{published}
|
|
202
202
|
{updated}
|
|
203
|
-
align="
|
|
203
|
+
align="auto"
|
|
204
204
|
/>
|
|
205
205
|
{/if}
|
|
206
206
|
</div>
|
|
@@ -230,7 +230,7 @@ https://utopia.fyi/space/calculator/?c=320,18,1.125,1280,21,1.25,7,3,&s=0.75|0.5
|
|
|
230
230
|
height: var(--heroHeight, 100svh);
|
|
231
231
|
max-height: 1800px;
|
|
232
232
|
transform: translateX(-50%);
|
|
233
|
-
margin-
|
|
233
|
+
margin-block-start: 0;
|
|
234
234
|
}
|
|
235
235
|
@media (max-width: 690px) {
|
|
236
236
|
.hero-wrapper :global(.background-hero .headline) {
|
|
@@ -243,8 +243,8 @@ https://utopia.fyi/space/calculator/?c=320,18,1.125,1280,21,1.25,7,3,&s=0.75|0.5
|
|
|
243
243
|
font-size: var(--theme-font-size-xs);
|
|
244
244
|
line-height: 1.3;
|
|
245
245
|
font-weight: 400;
|
|
246
|
-
margin-
|
|
247
|
-
margin-
|
|
246
|
+
margin-block-start: clamp(0.31rem, 0.31rem + 0vw, 0.31rem);
|
|
247
|
+
margin-block-end: clamp(0.56rem, 0.52rem + 0.21vw, 0.69rem);
|
|
248
248
|
}
|
|
249
249
|
.hero-wrapper :global(.background-hero video) {
|
|
250
250
|
position: relative;
|
|
@@ -257,7 +257,7 @@ https://utopia.fyi/space/calculator/?c=320,18,1.125,1280,21,1.25,7,3,&s=0.75|0.5
|
|
|
257
257
|
.hero-wrapper :global(.graphic-container .article-block.notes) {
|
|
258
258
|
width: 100%;
|
|
259
259
|
padding: 0 15px;
|
|
260
|
-
margin-
|
|
260
|
+
margin-inline-start: 0;
|
|
261
261
|
}
|
|
262
262
|
}
|
|
263
263
|
|
|
@@ -124,14 +124,14 @@ https://utopia.fyi/space/calculator/?c=320,18,1.125,1280,21,1.25,7,3,&s=0.75|0.5
|
|
|
124
124
|
font-weight: 600;
|
|
125
125
|
letter-spacing: 0.03em;
|
|
126
126
|
text-transform: uppercase;
|
|
127
|
-
margin-
|
|
128
|
-
margin-
|
|
129
|
-
margin-
|
|
130
|
-
margin-
|
|
127
|
+
margin-block-start: clamp(1.13rem, 1.06rem + 0.31vw, 1.31rem);
|
|
128
|
+
margin-block-end: clamp(0.31rem, 0.31rem + 0vw, 0.31rem);
|
|
129
|
+
margin-block-start: 0;
|
|
130
|
+
margin-block-end: 0;
|
|
131
131
|
}
|
|
132
132
|
.infobox :global(.body p) {
|
|
133
|
-
margin-
|
|
134
|
-
margin-
|
|
133
|
+
margin-block-start: 0;
|
|
134
|
+
margin-block-end: clamp(0.56rem, 0.52rem + 0.21vw, 0.69rem);
|
|
135
135
|
font-family: var(--theme-font-family-note);
|
|
136
136
|
font-size: calc(0.9 * var(--theme-font-size-base));
|
|
137
137
|
color: var(--theme-colour-text-primary);
|
|
@@ -140,29 +140,29 @@ https://utopia.fyi/space/calculator/?c=320,18,1.125,1280,21,1.25,7,3,&s=0.75|0.5
|
|
|
140
140
|
font-weight: 300;
|
|
141
141
|
}
|
|
142
142
|
.infobox :global(.body p):last-child {
|
|
143
|
-
margin-
|
|
143
|
+
margin-block-end: 0;
|
|
144
144
|
}
|
|
145
145
|
.infobox :global(.body ul),
|
|
146
146
|
.infobox :global(.body ol) {
|
|
147
|
-
margin-
|
|
148
|
-
margin-
|
|
147
|
+
margin-block-start: 0;
|
|
148
|
+
margin-block-end: clamp(0.56rem, 0.52rem + 0.21vw, 0.69rem);
|
|
149
149
|
font-family: var(--theme-font-family-note);
|
|
150
150
|
font-size: calc(0.9 * var(--theme-font-size-base));
|
|
151
151
|
color: var(--theme-colour-text-primary);
|
|
152
152
|
line-height: 1.3;
|
|
153
153
|
font-size: var(--theme-font-size-sm);
|
|
154
154
|
font-weight: 300;
|
|
155
|
-
margin-
|
|
155
|
+
margin-block-end: 0;
|
|
156
156
|
}
|
|
157
157
|
.infobox :global(.body ul li),
|
|
158
158
|
.infobox :global(.body ol li) {
|
|
159
|
-
margin-
|
|
160
|
-
margin-
|
|
161
|
-
margin-
|
|
159
|
+
margin-block-start: 0;
|
|
160
|
+
margin-block-start: clamp(0.56rem, 0.52rem + 0.21vw, 0.69rem);
|
|
161
|
+
margin-block-end: clamp(0.56rem, 0.52rem + 0.21vw, 0.69rem);
|
|
162
162
|
}
|
|
163
163
|
.infobox :global(.body ul li):last-child,
|
|
164
164
|
.infobox :global(.body ol li):last-child {
|
|
165
|
-
margin-
|
|
165
|
+
margin-block-end: 0;
|
|
166
166
|
}
|
|
167
167
|
.infobox :global(.footer p) {
|
|
168
168
|
font-family: var(--theme-font-family-note);
|
|
@@ -170,9 +170,9 @@ https://utopia.fyi/space/calculator/?c=320,18,1.125,1280,21,1.25,7,3,&s=0.75|0.5
|
|
|
170
170
|
font-size: var(--theme-font-size-xs);
|
|
171
171
|
line-height: 1.3;
|
|
172
172
|
font-weight: 400;
|
|
173
|
-
margin-
|
|
174
|
-
margin-
|
|
173
|
+
margin-block-start: clamp(0.31rem, 0.31rem + 0vw, 0.31rem);
|
|
174
|
+
margin-block-end: clamp(0.56rem, 0.52rem + 0.21vw, 0.69rem);
|
|
175
175
|
}
|
|
176
176
|
.infobox :global(.footer p):last-child {
|
|
177
|
-
margin-
|
|
177
|
+
margin-block-end: 0;
|
|
178
178
|
}</style>
|
|
@@ -85,7 +85,7 @@
|
|
|
85
85
|
<div
|
|
86
86
|
class="photopack-row flex justify-between"
|
|
87
87
|
style:gap="0 {gap}px"
|
|
88
|
-
style:margin-
|
|
88
|
+
style:margin-block-end={ri < rows.length - 1 ? gap + 'px' : ''}
|
|
89
89
|
>
|
|
90
90
|
{#each row as img, i}
|
|
91
91
|
<figure
|
|
@@ -143,6 +143,6 @@ div.photopack-container div.photopack-row figure div.alt-warning {
|
|
|
143
143
|
font-size: var(--theme-font-size-xs);
|
|
144
144
|
line-height: 1.3;
|
|
145
145
|
font-weight: 400;
|
|
146
|
-
margin-
|
|
147
|
-
margin-
|
|
146
|
+
margin-block-start: clamp(0.31rem, 0.31rem + 0vw, 0.31rem);
|
|
147
|
+
margin-block-end: clamp(0.56rem, 0.52rem + 0.21vw, 0.69rem);
|
|
148
148
|
}</style>
|
|
@@ -189,7 +189,7 @@ div.block-container.stacked {
|
|
|
189
189
|
}
|
|
190
190
|
|
|
191
191
|
div.heading {
|
|
192
|
-
margin-
|
|
192
|
+
margin-block-start: 0;
|
|
193
193
|
font-family: Knowledge, sans-serif;
|
|
194
194
|
}
|
|
195
195
|
div.heading.stacked {
|
|
@@ -212,8 +212,8 @@ div.heading.stacked {
|
|
|
212
212
|
display: block;
|
|
213
213
|
width: calc(50% - 30px);
|
|
214
214
|
max-width: 450px;
|
|
215
|
-
margin-
|
|
216
|
-
margin-
|
|
215
|
+
margin-block-start: clamp(0.31rem, 0.31rem + 0vw, 0.31rem);
|
|
216
|
+
margin-block-end: clamp(0.31rem, 0.31rem + 0vw, 0.31rem);
|
|
217
217
|
}
|
|
218
218
|
.referral-container .referral:hover .title {
|
|
219
219
|
text-decoration: underline;
|
|
@@ -224,7 +224,7 @@ div.heading.stacked {
|
|
|
224
224
|
.referral-container .referral .headline {
|
|
225
225
|
display: inline-block;
|
|
226
226
|
width: calc(100% - 9rem);
|
|
227
|
-
padding-
|
|
227
|
+
padding-inline-end: clamp(0.56rem, 0.52rem + 0.21vw, 0.69rem);
|
|
228
228
|
}
|
|
229
229
|
.referral-container .referral .headline .kicker {
|
|
230
230
|
font-size: var(--theme-font-size-xxs);
|
|
@@ -9,16 +9,25 @@
|
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
let { index, steps, preload = 1, stackBackground = true }: Props = $props();
|
|
12
|
+
|
|
13
|
+
function showStep(i: number) {
|
|
14
|
+
if (preload === 0) return true;
|
|
15
|
+
if (stackBackground) return i >= 0;
|
|
16
|
+
return i >= index - preload && i <= index + preload;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function isVisible(i: number) {
|
|
20
|
+
if (stackBackground) return i <= index;
|
|
21
|
+
return i === index;
|
|
22
|
+
}
|
|
12
23
|
</script>
|
|
13
24
|
|
|
14
25
|
{#each steps as step, i}
|
|
15
|
-
|
|
16
|
-
<!-- Unless stackBackground is true. If so, keep all steps before the current one loaded. -->
|
|
17
|
-
{#if preload === 0 || (i >= (stackBackground ? 0 : index - preload) && i <= index + preload)}
|
|
26
|
+
{#if showStep(i)}
|
|
18
27
|
<div
|
|
19
|
-
class=
|
|
20
|
-
class:visible={
|
|
21
|
-
class:invisible={
|
|
28
|
+
class={`step step-${i + 1} w-full absolute`}
|
|
29
|
+
class:visible={isVisible(i)}
|
|
30
|
+
class:invisible={!isVisible(i)}
|
|
22
31
|
>
|
|
23
32
|
<step.background {...step.backgroundProps || {}}></step.background>
|
|
24
33
|
</div>
|
|
@@ -59,8 +59,8 @@ div.step-foreground-container .step-foreground {
|
|
|
59
59
|
background: rgba(255, 255, 255, 0.9);
|
|
60
60
|
}
|
|
61
61
|
div.step-foreground-container .step-foreground :global(p:last-child) {
|
|
62
|
-
margin-
|
|
62
|
+
margin-block-end: 0;
|
|
63
63
|
}
|
|
64
64
|
div.step-foreground-container .step-foreground :global(*:first-child) {
|
|
65
|
-
margin-
|
|
65
|
+
margin-block-start: 0;
|
|
66
66
|
}</style>
|
|
@@ -8,7 +8,7 @@ import * as ScrollerStories from './Scroller.stories.svelte';
|
|
|
8
8
|
|
|
9
9
|
The `Scroller` component creates a basic scrollytelling graphic with layout options.
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
This component is designed to handle most common layouts for scrollytelling. To make something more complex, customise [ScrollerBase](?path=/story/components-graphics-scrollerbase--docs), which is a Svelte 5 version of the [svelte-scroller](https://github.com/sveltejs/svelte-scroller).
|
|
12
12
|
|
|
13
13
|
[Demo](?path=/story/components-graphics-scroller--demo)
|
|
14
14
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<!-- @component `Scroller` [Read the docs.](https://reuters-graphics.github.io/graphics-components/?path=/docs/components-graphics-scroller--docs) -->
|
|
2
2
|
<script lang="ts">
|
|
3
|
-
import ScrollerBase from '
|
|
3
|
+
import ScrollerBase from '../ScrollerBase/ScrollerBase.svelte';
|
|
4
4
|
import Background from './Background.svelte';
|
|
5
5
|
import Foreground from './Foreground.svelte';
|
|
6
6
|
import Embedded from './Embedded/index.svelte';
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { Meta } from '@storybook/blocks';
|
|
2
|
+
|
|
3
|
+
import * as ScrollerBaseStories from './ScrollerBase.stories.svelte';
|
|
4
|
+
|
|
5
|
+
<Meta of={ScrollerBaseStories} />
|
|
6
|
+
|
|
7
|
+
# ScrollerBase
|
|
8
|
+
|
|
9
|
+
The `ScrollerBase` component powers the [`Scroller` component](?path=/story/components-graphics-scroller--docs), which creates a basic storytelling graphic with preset layout options. `ScrollerBase` contains the bare minimum code necessary for a scrollytelling section, and allows for customisation beyond what the [`Scroller` component](?path=/story/components-graphics-scroller--docs) allows.
|
|
10
|
+
|
|
11
|
+
`ScrollerBase` is a Svelte 5 version of the [svelte-scroller](https://github.com/sveltejs/svelte-scroller).
|
|
12
|
+
|
|
13
|
+
> **Important❗:** Make sure the HTML element containing each foreground is a div with the class `step-foreground-container`. If you're modifying this to something else, pass the appropriate selector to the `query` prop.
|
|
14
|
+
|
|
15
|
+
[Demo](?path=/story/components-graphics-scrollerbase--demo)
|
|
16
|
+
|
|
17
|
+
```svelte
|
|
18
|
+
<script lang="ts">
|
|
19
|
+
import { ScrollerBase } from '@reuters-graphics/graphics-components';
|
|
20
|
+
|
|
21
|
+
// Optional: Bind your own variables to use them in your code.
|
|
22
|
+
let count = $state(1);
|
|
23
|
+
let index = $state(0);
|
|
24
|
+
let offset = $state(0);
|
|
25
|
+
let progress = $state(0);
|
|
26
|
+
let top = $state(0.1);
|
|
27
|
+
let threshold = $state(0.5);
|
|
28
|
+
let bottom = $state(0.9);
|
|
29
|
+
</script>
|
|
30
|
+
|
|
31
|
+
<ScrollerBase
|
|
32
|
+
{top}
|
|
33
|
+
{threshold}
|
|
34
|
+
{bottom}
|
|
35
|
+
bind:count
|
|
36
|
+
bind:index
|
|
37
|
+
bind:offset
|
|
38
|
+
bind:progress
|
|
39
|
+
query="div.step-foreground-container"
|
|
40
|
+
>
|
|
41
|
+
{#snippet backgroundSnippet()}
|
|
42
|
+
<!-- Add custom background HTML or component -->
|
|
43
|
+
<p class="mb-0">
|
|
44
|
+
Current step: <strong>{index + 1}/{count}</strong>
|
|
45
|
+
</p>
|
|
46
|
+
<progress class="mb-4" value={(index + 1) / count}></progress>
|
|
47
|
+
|
|
48
|
+
<p class="mb-0">Offset in current step</p>
|
|
49
|
+
<progress class="mb-4" value={offset}></progress>
|
|
50
|
+
|
|
51
|
+
<p class="mb-0">Total progress</p>
|
|
52
|
+
<progress class="mb-4" value={progress}></progress>
|
|
53
|
+
{/snippet}
|
|
54
|
+
{#snippet foregroundSnippet()}
|
|
55
|
+
<!-- Add custom foreground HTML or component -->
|
|
56
|
+
<div class="step-foreground-container">Step 1</div>
|
|
57
|
+
<div class="step-foreground-container">Step 2</div>
|
|
58
|
+
<div class="step-foreground-container">Step 3</div>
|
|
59
|
+
<div class="step-foreground-container">Step 4</div>
|
|
60
|
+
<div class="step-foreground-container">Step 5</div>
|
|
61
|
+
{/snippet}
|
|
62
|
+
</ScrollerBase>
|
|
63
|
+
|
|
64
|
+
<style lang="scss">
|
|
65
|
+
@use '@reuters-graphics/graphics-components/dist/scss/mixins' as mixins;
|
|
66
|
+
|
|
67
|
+
.scroller-demo-container {
|
|
68
|
+
width: mixins.$column-width-normal;
|
|
69
|
+
margin: auto;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.step-foreground-container {
|
|
73
|
+
height: 100vh;
|
|
74
|
+
width: 50%;
|
|
75
|
+
background-color: rgba(0, 0, 0, 0.2);
|
|
76
|
+
padding: 1em;
|
|
77
|
+
margin: 0 0 2em 0;
|
|
78
|
+
position: relative;
|
|
79
|
+
left: 50%;
|
|
80
|
+
}
|
|
81
|
+
</style>
|
|
82
|
+
```
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<script module lang="ts">
|
|
2
|
+
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
+
import ScrollerBase from './ScrollerBase.svelte';
|
|
4
|
+
import ScrollerDemo from './demo/ScrollerDemo.svelte';
|
|
5
|
+
|
|
6
|
+
const { Story } = defineMeta({
|
|
7
|
+
title: 'Components/Graphics/ScrollerBase',
|
|
8
|
+
component: ScrollerBase,
|
|
9
|
+
});
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<Story name="Demo"><ScrollerDemo /></Story>
|