@reuters-graphics/graphics-components 0.0.29 → 0.0.31
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/@types/components/@types/global.d.ts +1 -0
- package/dist/@types/components/DocumentCloud/DocumentCloud.svelte.d.ts +30 -0
- package/dist/@types/components/Scroller/Scroller.svelte.d.ts +2 -1
- package/dist/@types/components/Scroller/docProps.d.ts +2 -0
- package/dist/@types/index.d.ts +1 -0
- package/dist/components/DocumentCloud/DocumentCloud.svelte +33 -0
- package/dist/components/Scroller/Embedded/Background.svelte +2 -2
- package/dist/components/Scroller/Embedded/Foreground.svelte +26 -0
- package/dist/components/Scroller/Foreground.svelte +104 -1
- package/dist/components/Scroller/Scroller.svelte +3 -1
- package/dist/components/Scroller/docProps.js +1 -0
- package/dist/index.js +1 -0
- package/package.json +2 -1
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
import type { ContainerWidth } from '../@types/global';
|
|
3
|
+
declare const __propDef: {
|
|
4
|
+
props: {
|
|
5
|
+
/**
|
|
6
|
+
* Width of the container, one of: normal, wide, wider, widest or fluid
|
|
7
|
+
*/ width?: ContainerWidth;
|
|
8
|
+
/**
|
|
9
|
+
* The unique identifier for the document.
|
|
10
|
+
* @required
|
|
11
|
+
*/ slug: string;
|
|
12
|
+
/**
|
|
13
|
+
* Alt text for the document.
|
|
14
|
+
* @required
|
|
15
|
+
*/ altText: string;
|
|
16
|
+
/** Add an ID to target with SCSS. */ id?: string;
|
|
17
|
+
/** Add a class to target with SCSS. */ cls?: string;
|
|
18
|
+
};
|
|
19
|
+
events: {
|
|
20
|
+
[evt: string]: CustomEvent<any>;
|
|
21
|
+
};
|
|
22
|
+
slots: {};
|
|
23
|
+
};
|
|
24
|
+
export declare type DocumentCloudProps = typeof __propDef.props;
|
|
25
|
+
export declare type DocumentCloudEvents = typeof __propDef.events;
|
|
26
|
+
export declare type DocumentCloudSlots = typeof __propDef.slots;
|
|
27
|
+
/** `DocumentCloud` [Read the docs.](https://reuters-graphics.github.io/graphics-components/?path=/docs/components-DocumentCloud--default) */
|
|
28
|
+
export default class DocumentCloud extends SvelteComponentTyped<DocumentCloudProps, DocumentCloudEvents, DocumentCloudSlots> {
|
|
29
|
+
}
|
|
30
|
+
export {};
|
|
@@ -11,9 +11,10 @@ declare const __propDef: {
|
|
|
11
11
|
*
|
|
12
12
|
* Each step object in the array can have:
|
|
13
13
|
*
|
|
14
|
-
* - `background` A background component **REQUIRED**
|
|
14
|
+
* - `background` A background component. **REQUIRED**
|
|
15
15
|
* - `backgroundProps` An object of props given to the background component
|
|
16
16
|
* - `foreground` Either a markdown-formatted string or a foreground component **REQUIRED**
|
|
17
|
+
* - `altText` A string describing the background graphic, which is read aloud after the foreground blurb. You can add it to each step or, if you want to add just one alt text to describe all graphics in the scroll section, add it to just the first step. **RECOMMENDED**
|
|
17
18
|
* - `foregroundProps` An object of props given to the foreground component
|
|
18
19
|
*
|
|
19
20
|
* @required
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ComponentType } from 'svelte';
|
|
2
2
|
interface BlockStep {
|
|
3
|
+
AltText?: string;
|
|
3
4
|
Background: string;
|
|
4
5
|
Text: string;
|
|
5
6
|
}
|
|
@@ -27,6 +28,7 @@ export declare const getScrollerPropsFromDoc: (docBlock: Block, aiCharts: AiChar
|
|
|
27
28
|
assetsPath: string;
|
|
28
29
|
};
|
|
29
30
|
foreground: string;
|
|
31
|
+
altText: string;
|
|
30
32
|
}[];
|
|
31
33
|
};
|
|
32
34
|
export {};
|
package/dist/@types/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export { default as BeforeAfter } from "./components/BeforeAfter/BeforeAfter.sve
|
|
|
3
3
|
export { default as Block } from "./components/Block/Block.svelte";
|
|
4
4
|
export { default as BodyText } from "./components/BodyText/BodyText.svelte";
|
|
5
5
|
export { default as DatawrapperChart } from "./components/DatawrapperChart/DatawrapperChart.svelte";
|
|
6
|
+
export { default as DocumentCloud } from "./components/DocumentCloud/DocumentCloud.svelte";
|
|
6
7
|
export { default as EmbedPreviewerLink } from "./components/EmbedPreviewerLink/EmbedPreviewerLink.svelte";
|
|
7
8
|
export { default as FeaturePhoto } from "./components/FeaturePhoto/FeaturePhoto.svelte";
|
|
8
9
|
export { default as Framer } from "./components/Framer/Framer.svelte";
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
<!-- @component `DocumentCloud` [Read the docs.](https://reuters-graphics.github.io/graphics-components/?path=/docs/components-DocumentCloud--default) -->
|
|
2
|
+
<script>/** ✏️ DOCUMENT your chart's props using TypeScript and JSDoc comments like below! */
|
|
3
|
+
/**
|
|
4
|
+
* Width of the container, one of: normal, wide, wider, widest or fluid
|
|
5
|
+
*/
|
|
6
|
+
export let width = 'normal';
|
|
7
|
+
/**
|
|
8
|
+
* The unique identifier for the document.
|
|
9
|
+
* @required
|
|
10
|
+
*/
|
|
11
|
+
export let slug;
|
|
12
|
+
/**
|
|
13
|
+
* Alt text for the document.
|
|
14
|
+
* @required
|
|
15
|
+
*/
|
|
16
|
+
export let altText;
|
|
17
|
+
/** Add an ID to target with SCSS. */
|
|
18
|
+
export let id = '';
|
|
19
|
+
/** Add a class to target with SCSS. */
|
|
20
|
+
export let cls = '';
|
|
21
|
+
import Block from '../Block/Block.svelte';
|
|
22
|
+
</script>
|
|
23
|
+
|
|
24
|
+
<Block width="{width}" id="{id}" cls="photo {cls}">
|
|
25
|
+
<iframe
|
|
26
|
+
src="https://embed.documentcloud.org/documents/{slug}/?embed=1&responsive=1&title=1"
|
|
27
|
+
title="{altText}"
|
|
28
|
+
width="700"
|
|
29
|
+
height="540"
|
|
30
|
+
style="border: 1px solid #aaa; width: 100%; height: 800px; height: calc(100vh - 100px);"
|
|
31
|
+
sandbox="allow-scripts allow-same-origin allow-popups allow-forms allow-popups-to-escape-sandbox"
|
|
32
|
+
></iframe>
|
|
33
|
+
</Block>
|
|
@@ -4,8 +4,8 @@ export let index;
|
|
|
4
4
|
import Block from '../../Block/Block.svelte';
|
|
5
5
|
</script>
|
|
6
6
|
|
|
7
|
-
<Block width={backgroundWidth} cls="background-container step-{index + 1}">
|
|
8
|
-
<div class="embedded-background step-{index + 1}">
|
|
7
|
+
<Block width="{backgroundWidth}" cls="background-container step-{index + 1}">
|
|
8
|
+
<div class="embedded-background step-{index + 1}" aria-hidden="true">
|
|
9
9
|
<svelte:component
|
|
10
10
|
this="{step.background}"
|
|
11
11
|
{...step.backgroundProps || {}}
|
|
@@ -7,11 +7,23 @@ import Block from '../../Block/Block.svelte';
|
|
|
7
7
|
{#if step.foreground === '' || !step.foreground}
|
|
8
8
|
<!-- Empty foreground -->
|
|
9
9
|
<div class="empty-step-foreground step-{index + 1}"></div>
|
|
10
|
+
|
|
11
|
+
{#if typeof step.altText === 'string'}
|
|
12
|
+
<div class="background-alt-text visually-hidden">
|
|
13
|
+
{@html marked.parse(step.altText)}
|
|
14
|
+
</div>
|
|
15
|
+
{/if}
|
|
10
16
|
{:else if typeof step.foreground === 'string'}
|
|
11
17
|
<Block cls="body-text step-{index + 1}">
|
|
12
18
|
<div class="embedded-foreground step-{index + 1}">
|
|
13
19
|
{@html marked.parse(step.foreground)}
|
|
14
20
|
</div>
|
|
21
|
+
|
|
22
|
+
{#if typeof step.altText === 'string'}
|
|
23
|
+
<div class="background-alt-text visually-hidden">
|
|
24
|
+
{@html marked.parse(step.altText)}
|
|
25
|
+
</div>
|
|
26
|
+
{/if}
|
|
15
27
|
</Block>
|
|
16
28
|
{:else}
|
|
17
29
|
<div class="embedded-foreground step-{index + 1}">
|
|
@@ -200,4 +212,18 @@ div.embedded-foreground :global(.font-sans) {
|
|
|
200
212
|
}
|
|
201
213
|
div.embedded-foreground :global(p:last-child) {
|
|
202
214
|
margin-bottom: 0;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
.visually-hidden {
|
|
218
|
+
position: absolute !important;
|
|
219
|
+
width: 1px !important;
|
|
220
|
+
height: 1px !important;
|
|
221
|
+
padding: 0 !important;
|
|
222
|
+
margin: -1px !important;
|
|
223
|
+
overflow: hidden !important;
|
|
224
|
+
clip: rect(0, 0, 0, 0) !important;
|
|
225
|
+
-webkit-clip-path: polygon(0px 0px, 0px 0px, 0px 0px);
|
|
226
|
+
clip-path: polygon(0px 0px, 0px 0px, 0px 0px);
|
|
227
|
+
white-space: nowrap !important;
|
|
228
|
+
border: 0 !important;
|
|
203
229
|
}</style>
|
|
@@ -7,6 +7,11 @@ import { marked } from 'marked';
|
|
|
7
7
|
{#if step.foreground === '' || !step.foreground}
|
|
8
8
|
<!-- Empty foreground -->
|
|
9
9
|
<div class="empty-step-foreground"></div>
|
|
10
|
+
{#if typeof step.altText === 'string'}
|
|
11
|
+
<div class="background-alt-text visually-hidden">
|
|
12
|
+
{@html marked.parse(step.altText)}
|
|
13
|
+
</div>
|
|
14
|
+
{/if}
|
|
10
15
|
{:else}
|
|
11
16
|
<div class="step-foreground">
|
|
12
17
|
{#if typeof step.foreground === 'string'}
|
|
@@ -18,11 +23,95 @@ import { marked } from 'marked';
|
|
|
18
23
|
/>
|
|
19
24
|
{/if}
|
|
20
25
|
</div>
|
|
26
|
+
{#if typeof step.altText === 'string'}
|
|
27
|
+
<div class="background-alt-text visually-hidden">
|
|
28
|
+
{@html marked.parse(step.altText)}
|
|
29
|
+
</div>
|
|
30
|
+
{/if}
|
|
21
31
|
{/if}
|
|
22
32
|
</div>
|
|
23
33
|
{/each}
|
|
24
34
|
|
|
25
|
-
<style
|
|
35
|
+
<style>.paragraph-size {
|
|
36
|
+
font-size: 1.3rem;
|
|
37
|
+
line-height: 2.1rem;
|
|
38
|
+
}
|
|
39
|
+
.paragraph-size.font-sans {
|
|
40
|
+
font-size: 1.1rem;
|
|
41
|
+
line-height: 1.75rem;
|
|
42
|
+
}
|
|
43
|
+
@media (max-width: 540px) {
|
|
44
|
+
.paragraph-size {
|
|
45
|
+
font-size: 1.1rem;
|
|
46
|
+
line-height: 1.8rem;
|
|
47
|
+
}
|
|
48
|
+
.paragraph-size.font-sans {
|
|
49
|
+
font-size: 1rem;
|
|
50
|
+
line-height: 1.6rem;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
.paragraph-size.important {
|
|
54
|
+
font-size: 1.3rem !important;
|
|
55
|
+
line-height: 2.1rem !important;
|
|
56
|
+
}
|
|
57
|
+
.paragraph-size.important.font-sans {
|
|
58
|
+
font-size: 1.1rem !important;
|
|
59
|
+
line-height: 1.8rem !important;
|
|
60
|
+
}
|
|
61
|
+
@media (max-width: 540px) {
|
|
62
|
+
.paragraph-size.important {
|
|
63
|
+
font-size: 1.1rem !important;
|
|
64
|
+
line-height: 1.8rem !important;
|
|
65
|
+
}
|
|
66
|
+
.paragraph-size.important.font-sans {
|
|
67
|
+
font-size: 1rem !important;
|
|
68
|
+
line-height: 1.6rem !important;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.small-size {
|
|
73
|
+
font-size: 0.9rem;
|
|
74
|
+
line-height: 1.2rem;
|
|
75
|
+
}
|
|
76
|
+
@media (max-width: 540px) {
|
|
77
|
+
.small-size {
|
|
78
|
+
font-size: 0.8rem;
|
|
79
|
+
line-height: 1.1rem;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
.small-size.important {
|
|
83
|
+
font-size: 0.9rem !important;
|
|
84
|
+
line-height: 1.2rem !important;
|
|
85
|
+
}
|
|
86
|
+
@media (max-width: 540px) {
|
|
87
|
+
.small-size.important {
|
|
88
|
+
font-size: 0.8rem !important;
|
|
89
|
+
line-height: 1.1rem !important;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.blockquote-size {
|
|
94
|
+
font-size: 1.6rem;
|
|
95
|
+
line-height: 2.1rem;
|
|
96
|
+
}
|
|
97
|
+
@media (max-width: 540px) {
|
|
98
|
+
.blockquote-size {
|
|
99
|
+
font-size: 1.3rem;
|
|
100
|
+
line-height: 1.9rem;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
.blockquote-size.important {
|
|
104
|
+
font-size: 1.6rem !important;
|
|
105
|
+
line-height: 2rem !important;
|
|
106
|
+
}
|
|
107
|
+
@media (max-width: 540px) {
|
|
108
|
+
.blockquote-size.important {
|
|
109
|
+
font-size: 1.3rem !important;
|
|
110
|
+
line-height: 1.8rem !important;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
div.step-foreground-container {
|
|
26
115
|
height: 100vh;
|
|
27
116
|
width: initial;
|
|
28
117
|
max-width: initial;
|
|
@@ -39,4 +128,18 @@ div.step-foreground-container .step-foreground {
|
|
|
39
128
|
}
|
|
40
129
|
div.step-foreground-container .step-foreground :global(p:last-child) {
|
|
41
130
|
margin-bottom: 0;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.visually-hidden {
|
|
134
|
+
position: absolute !important;
|
|
135
|
+
width: 1px !important;
|
|
136
|
+
height: 1px !important;
|
|
137
|
+
padding: 0 !important;
|
|
138
|
+
margin: -1px !important;
|
|
139
|
+
overflow: hidden !important;
|
|
140
|
+
clip: rect(0, 0, 0, 0) !important;
|
|
141
|
+
-webkit-clip-path: polygon(0px 0px, 0px 0px, 0px 0px);
|
|
142
|
+
clip-path: polygon(0px 0px, 0px 0px, 0px 0px);
|
|
143
|
+
white-space: nowrap !important;
|
|
144
|
+
border: 0 !important;
|
|
42
145
|
}</style>
|
|
@@ -9,9 +9,10 @@ export let id = '';
|
|
|
9
9
|
*
|
|
10
10
|
* Each step object in the array can have:
|
|
11
11
|
*
|
|
12
|
-
* - `background` A background component **REQUIRED**
|
|
12
|
+
* - `background` A background component. **REQUIRED**
|
|
13
13
|
* - `backgroundProps` An object of props given to the background component
|
|
14
14
|
* - `foreground` Either a markdown-formatted string or a foreground component **REQUIRED**
|
|
15
|
+
* - `altText` A string describing the background graphic, which is read aloud after the foreground blurb. You can add it to each step or, if you want to add just one alt text to describe all graphics in the scroll section, add it to just the first step. **RECOMMENDED**
|
|
15
16
|
* - `foregroundProps` An object of props given to the foreground component
|
|
16
17
|
*
|
|
17
18
|
* @required
|
|
@@ -99,6 +100,7 @@ let progress;
|
|
|
99
100
|
class="background"
|
|
100
101
|
class:right="{foregroundPosition === 'left opposite'}"
|
|
101
102
|
class:left="{foregroundPosition === 'right opposite'}"
|
|
103
|
+
aria-hidden="true"
|
|
102
104
|
>
|
|
103
105
|
<div class="scroller-graphic-well">
|
|
104
106
|
<Block
|
package/dist/index.js
CHANGED
|
@@ -4,6 +4,7 @@ export { default as BeforeAfter } from './components/BeforeAfter/BeforeAfter.sve
|
|
|
4
4
|
export { default as Block } from './components/Block/Block.svelte';
|
|
5
5
|
export { default as BodyText } from './components/BodyText/BodyText.svelte';
|
|
6
6
|
export { default as DatawrapperChart } from './components/DatawrapperChart/DatawrapperChart.svelte';
|
|
7
|
+
export { default as DocumentCloud } from './components/DocumentCloud/DocumentCloud.svelte';
|
|
7
8
|
export { default as EmbedPreviewerLink } from './components/EmbedPreviewerLink/EmbedPreviewerLink.svelte';
|
|
8
9
|
export { default as FeaturePhoto } from './components/FeaturePhoto/FeaturePhoto.svelte';
|
|
9
10
|
export { default as Framer } from './components/Framer/Framer.svelte';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reuters-graphics/graphics-components",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.31",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"private": false,
|
|
6
6
|
"homepage": "https://reuters-graphics.github.io/graphics-components",
|
|
@@ -105,6 +105,7 @@
|
|
|
105
105
|
"./components/Block/Block.svelte": "./dist/components/Block/Block.svelte",
|
|
106
106
|
"./components/BodyText/BodyText.svelte": "./dist/components/BodyText/BodyText.svelte",
|
|
107
107
|
"./components/DatawrapperChart/DatawrapperChart.svelte": "./dist/components/DatawrapperChart/DatawrapperChart.svelte",
|
|
108
|
+
"./components/DocumentCloud/DocumentCloud.svelte": "./dist/components/DocumentCloud/DocumentCloud.svelte",
|
|
108
109
|
"./components/EmbedPreviewerLink/EmbedPreviewerLink.svelte": "./dist/components/EmbedPreviewerLink/EmbedPreviewerLink.svelte",
|
|
109
110
|
"./components/FeaturePhoto/FeaturePhoto.svelte": "./dist/components/FeaturePhoto/FeaturePhoto.svelte",
|
|
110
111
|
"./components/Framer/Framer.svelte": "./dist/components/Framer/Framer.svelte",
|