@reuters-graphics/graphics-components 3.10.1 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Analytics/GTM.svelte.d.ts +3 -3
- package/dist/components/BlogPost/BlogPost.svelte +6 -5
- package/dist/components/BlogPost/BlogPost.svelte.d.ts +3 -2
- package/dist/components/BlogPost/CopyLink.svelte +7 -4
- package/dist/components/BlogPost/CopyLink.svelte.d.ts +5 -2
- package/dist/components/BlogPost/PostHeadline.svelte +7 -4
- package/dist/components/BlogPost/PostHeadline.svelte.d.ts +5 -2
- package/dist/components/BlogPost/utils.d.ts +2 -1
- package/dist/components/BlogPost/utils.js +8 -2
- package/dist/components/BlogTOC/BlogTOC.svelte +7 -4
- package/dist/components/BlogTOC/BlogTOC.svelte.d.ts +8 -5
- package/dist/components/BlogTOC/TOCList.svelte.d.ts +3 -3
- package/dist/components/Headpile/Headpile.svelte +2 -2
- package/dist/components/Headpile/Headpile.svelte.d.ts +2 -2
- package/dist/components/LanguageButton/LanguageButton.svelte +10 -7
- package/dist/components/LanguageButton/LanguageButton.svelte.d.ts +5 -2
- package/dist/components/SEO/SEO.svelte.d.ts +3 -3
- package/dist/components/Video/Video.svelte +2 -2
- package/dist/llm-docs/components/BeforeAfter.md +5 -5
- package/dist/llm-docs/components/BlogPost.md +2 -4
- package/dist/llm-docs/components/BlogTOC.md +4 -6
- package/dist/llm-docs/components/EmbedPreviewerLink.md +1 -1
- package/dist/llm-docs/components/FeaturePhoto.md +4 -4
- package/dist/llm-docs/components/GraphicBlock.md +4 -4
- package/dist/llm-docs/components/Headline.md +3 -3
- package/dist/llm-docs/components/Headpile.md +4 -4
- package/dist/llm-docs/components/HeroHeadline.md +9 -9
- package/dist/llm-docs/components/HorizontalScroller.md +4 -4
- package/dist/llm-docs/components/LanguageButton.md +12 -13
- package/dist/llm-docs/components/Lottie.md +14 -14
- package/dist/llm-docs/components/PhotoPack.md +10 -9
- package/dist/llm-docs/components/SEO.md +2 -2
- package/dist/llm-docs/components/Scroller.md +7 -7
- package/dist/llm-docs/components/ScrollerVideo.md +6 -6
- package/dist/llm-docs/components/Video.md +2 -2
- package/dist/llm-docs/guides/archieml.md +9 -9
- package/dist/llm-docs/guides/graphics-kit.md +5 -5
- package/package.json +18 -24
|
@@ -11,8 +11,8 @@ interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> =
|
|
|
11
11
|
};
|
|
12
12
|
z_$$bindings?: Bindings;
|
|
13
13
|
}
|
|
14
|
-
declare const
|
|
14
|
+
declare const GTM: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
|
|
15
15
|
[evt: string]: CustomEvent<any>;
|
|
16
16
|
}, {}, {}, string>;
|
|
17
|
-
type
|
|
18
|
-
export default
|
|
17
|
+
type GTM = InstanceType<typeof GTM>;
|
|
18
|
+
export default GTM;
|
|
@@ -10,9 +10,10 @@
|
|
|
10
10
|
*/
|
|
11
11
|
slugTitle: string;
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
13
|
+
* SvelteKit's `resolve` function from `$app/paths`, used to build the post's
|
|
14
|
+
* canonical URL against your project's base path. Defaults to an identity function.
|
|
14
15
|
*/
|
|
15
|
-
|
|
16
|
+
resolve?(pathname: string): string;
|
|
16
17
|
/** Array of author names, which will be slugified to create links to Reuters author pages */
|
|
17
18
|
authors: string[];
|
|
18
19
|
/** Publish time as a datetime string. */
|
|
@@ -33,7 +34,7 @@
|
|
|
33
34
|
let {
|
|
34
35
|
title = 'Reuters Graphics blog post',
|
|
35
36
|
slugTitle = 'Reuters Graphics blog post',
|
|
36
|
-
|
|
37
|
+
resolve = (pathname: string) => pathname,
|
|
37
38
|
authors = [],
|
|
38
39
|
publishTime = '',
|
|
39
40
|
updateTime = '',
|
|
@@ -54,14 +55,14 @@
|
|
|
54
55
|
<PostHeadline
|
|
55
56
|
hed={title}
|
|
56
57
|
sluggableHed={slugTitle}
|
|
57
|
-
{
|
|
58
|
+
{resolve}
|
|
58
59
|
{authors}
|
|
59
60
|
{publishTime}
|
|
60
61
|
{updateTime}
|
|
61
62
|
{id}
|
|
62
63
|
{cls}
|
|
63
64
|
/>
|
|
64
|
-
<a href=
|
|
65
|
+
<a href={resolve(`/${shortPubDate}/${slugify(slugTitle)}/`)} hidden>
|
|
65
66
|
{title}
|
|
66
67
|
</a>
|
|
67
68
|
{@render children?.()}
|
|
@@ -9,9 +9,10 @@ interface Props {
|
|
|
9
9
|
*/
|
|
10
10
|
slugTitle: string;
|
|
11
11
|
/**
|
|
12
|
-
*
|
|
12
|
+
* SvelteKit's `resolve` function from `$app/paths`, used to build the post's
|
|
13
|
+
* canonical URL against your project's base path. Defaults to an identity function.
|
|
13
14
|
*/
|
|
14
|
-
|
|
15
|
+
resolve?(pathname: string): string;
|
|
15
16
|
/** Array of author names, which will be slugified to create links to Reuters author pages */
|
|
16
17
|
authors: string[];
|
|
17
18
|
/** Publish time as a datetime string. */
|
|
@@ -9,8 +9,11 @@
|
|
|
9
9
|
publishedDate?: string;
|
|
10
10
|
/** The heading of the post. */
|
|
11
11
|
hed?: string;
|
|
12
|
-
/**
|
|
13
|
-
|
|
12
|
+
/**
|
|
13
|
+
* SvelteKit's `resolve` function from `$app/paths`, used to build the copied URL
|
|
14
|
+
* against your project's base path. Defaults to an identity function.
|
|
15
|
+
*/
|
|
16
|
+
resolve?(pathname: string): string;
|
|
14
17
|
/** The ARIA label for the copy link button. */
|
|
15
18
|
ariaLabel?: string;
|
|
16
19
|
/** The message to display before copying the link. */
|
|
@@ -22,7 +25,7 @@
|
|
|
22
25
|
let {
|
|
23
26
|
publishedDate = '',
|
|
24
27
|
hed = '',
|
|
25
|
-
|
|
28
|
+
resolve = (pathname: string) => pathname,
|
|
26
29
|
ariaLabel = 'Copy link to this post',
|
|
27
30
|
copyMessageBefore = 'Copy link',
|
|
28
31
|
copyMessageAfter = 'Copied',
|
|
@@ -44,7 +47,7 @@
|
|
|
44
47
|
e.preventDefault();
|
|
45
48
|
clicked = true;
|
|
46
49
|
navigator.clipboard.writeText(
|
|
47
|
-
`${window.location.origin}${
|
|
50
|
+
`${window.location.origin}${resolve(`/${publishDate}/${slugify(hed)}/`)}`
|
|
48
51
|
);
|
|
49
52
|
setTimeout(() => {
|
|
50
53
|
clicked = false;
|
|
@@ -3,8 +3,11 @@ interface Props {
|
|
|
3
3
|
publishedDate?: string;
|
|
4
4
|
/** The heading of the post. */
|
|
5
5
|
hed?: string;
|
|
6
|
-
/**
|
|
7
|
-
|
|
6
|
+
/**
|
|
7
|
+
* SvelteKit's `resolve` function from `$app/paths`, used to build the copied URL
|
|
8
|
+
* against your project's base path. Defaults to an identity function.
|
|
9
|
+
*/
|
|
10
|
+
resolve?(pathname: string): string;
|
|
8
11
|
/** The ARIA label for the copy link button. */
|
|
9
12
|
ariaLabel?: string;
|
|
10
13
|
/** The message to display before copying the link. */
|
|
@@ -16,8 +16,11 @@
|
|
|
16
16
|
* published links to the post.
|
|
17
17
|
*/
|
|
18
18
|
sluggableHed: string;
|
|
19
|
-
/**
|
|
20
|
-
|
|
19
|
+
/**
|
|
20
|
+
* SvelteKit's `resolve` function from `$app/paths`, used to build the copied URL
|
|
21
|
+
* against your project's base path. Defaults to an identity function.
|
|
22
|
+
*/
|
|
23
|
+
resolve?(pathname: string): string;
|
|
21
24
|
/** Array of author names, which will be slugified to create links to Reuters author pages */
|
|
22
25
|
authors: string[];
|
|
23
26
|
/** Publish time as a datetime string. */
|
|
@@ -33,7 +36,7 @@
|
|
|
33
36
|
let {
|
|
34
37
|
hed = 'Reuters Graphics blog post',
|
|
35
38
|
sluggableHed = 'Reuters Graphics blog post',
|
|
36
|
-
|
|
39
|
+
resolve = (pathname: string) => pathname,
|
|
37
40
|
authors = [],
|
|
38
41
|
publishTime = '',
|
|
39
42
|
updateTime = '',
|
|
@@ -105,7 +108,7 @@
|
|
|
105
108
|
<CopyLink
|
|
106
109
|
hed={sluggableHed}
|
|
107
110
|
publishedDate={publishTime}
|
|
108
|
-
{
|
|
111
|
+
{resolve}
|
|
109
112
|
/></span
|
|
110
113
|
>
|
|
111
114
|
</a>
|
|
@@ -8,8 +8,11 @@ interface Props {
|
|
|
8
8
|
* published links to the post.
|
|
9
9
|
*/
|
|
10
10
|
sluggableHed: string;
|
|
11
|
-
/**
|
|
12
|
-
|
|
11
|
+
/**
|
|
12
|
+
* SvelteKit's `resolve` function from `$app/paths`, used to build the copied URL
|
|
13
|
+
* against your project's base path. Defaults to an identity function.
|
|
14
|
+
*/
|
|
15
|
+
resolve?(pathname: string): string;
|
|
13
16
|
/** Array of author names, which will be slugified to create links to Reuters author pages */
|
|
14
17
|
authors: string[];
|
|
15
18
|
/** Publish time as a datetime string. */
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Converts a date string to a short date format.
|
|
3
3
|
* @param d - The date string to be converted.
|
|
4
|
-
* @returns The short date format string
|
|
4
|
+
* @returns The short date format string (`YYYY-MM-DD`), or an empty string if
|
|
5
|
+
* `d` is missing or not a valid date.
|
|
5
6
|
*/
|
|
6
7
|
export declare const getShortDate: (d: string) => string;
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Converts a date string to a short date format.
|
|
3
3
|
* @param d - The date string to be converted.
|
|
4
|
-
* @returns The short date format string
|
|
4
|
+
* @returns The short date format string (`YYYY-MM-DD`), or an empty string if
|
|
5
|
+
* `d` is missing or not a valid date.
|
|
5
6
|
*/
|
|
6
|
-
export const getShortDate = (d) =>
|
|
7
|
+
export const getShortDate = (d) => {
|
|
8
|
+
const date = new Date(d);
|
|
9
|
+
if (Number.isNaN(date.getTime()))
|
|
10
|
+
return '';
|
|
11
|
+
return date.toISOString().split('T')[0];
|
|
12
|
+
};
|
|
@@ -19,8 +19,11 @@
|
|
|
19
19
|
|
|
20
20
|
interface Props {
|
|
21
21
|
posts: Post[];
|
|
22
|
-
/**
|
|
23
|
-
|
|
22
|
+
/**
|
|
23
|
+
* SvelteKit's `resolve` function from `$app/paths`, used to build post links
|
|
24
|
+
* against your project's base path. Defaults to an identity function.
|
|
25
|
+
*/
|
|
26
|
+
resolve?(pathname: string): string;
|
|
24
27
|
/** The label for the table of contents toggle button. */
|
|
25
28
|
label?: string;
|
|
26
29
|
/** The maximum height of the table of contents list in pixels. */
|
|
@@ -29,7 +32,7 @@
|
|
|
29
32
|
|
|
30
33
|
let {
|
|
31
34
|
posts,
|
|
32
|
-
|
|
35
|
+
resolve = (pathname: string) => pathname,
|
|
33
36
|
label = 'Show all articles',
|
|
34
37
|
maxHeight = 300,
|
|
35
38
|
}: Props = $props();
|
|
@@ -51,7 +54,7 @@
|
|
|
51
54
|
const existing = acc.find((entry) => entry.dateKey === dateKey);
|
|
52
55
|
const event = {
|
|
53
56
|
title: post.title,
|
|
54
|
-
titleLink: `${
|
|
57
|
+
titleLink: `${resolve('/')}#${slugify(post.slugTitle)}`,
|
|
55
58
|
};
|
|
56
59
|
if (existing) {
|
|
57
60
|
existing.events.push(event);
|
|
@@ -5,13 +5,16 @@ interface Post {
|
|
|
5
5
|
}
|
|
6
6
|
interface Props {
|
|
7
7
|
posts: Post[];
|
|
8
|
-
/**
|
|
9
|
-
|
|
8
|
+
/**
|
|
9
|
+
* SvelteKit's `resolve` function from `$app/paths`, used to build post links
|
|
10
|
+
* against your project's base path. Defaults to an identity function.
|
|
11
|
+
*/
|
|
12
|
+
resolve?(pathname: string): string;
|
|
10
13
|
/** The label for the table of contents toggle button. */
|
|
11
14
|
label?: string;
|
|
12
15
|
/** The maximum height of the table of contents list in pixels. */
|
|
13
16
|
maxHeight?: number;
|
|
14
17
|
}
|
|
15
|
-
declare const
|
|
16
|
-
type
|
|
17
|
-
export default
|
|
18
|
+
declare const BlogTOC: import("svelte").Component<Props, {}, "">;
|
|
19
|
+
type BlogTOC = ReturnType<typeof BlogTOC>;
|
|
20
|
+
export default BlogTOC;
|
|
@@ -17,6 +17,6 @@ interface Props {
|
|
|
17
17
|
id?: string;
|
|
18
18
|
class?: string;
|
|
19
19
|
}
|
|
20
|
-
declare const
|
|
21
|
-
type
|
|
22
|
-
export default
|
|
20
|
+
declare const TOCList: import("svelte").Component<Props, {}, "listHeight">;
|
|
21
|
+
type TOCList = ReturnType<typeof TOCList>;
|
|
22
|
+
export default TOCList;
|
|
@@ -28,9 +28,9 @@
|
|
|
28
28
|
* Headshot image src. Be sure to prefix the image
|
|
29
29
|
*
|
|
30
30
|
* ```typescript
|
|
31
|
-
* import {
|
|
31
|
+
* import { asset } from '$app/paths';
|
|
32
32
|
*
|
|
33
|
-
* const imgSrc =
|
|
33
|
+
* const imgSrc = asset('/images/my-image.jpg');
|
|
34
34
|
* ```
|
|
35
35
|
*/
|
|
36
36
|
img: string;
|
|
@@ -24,9 +24,9 @@ interface Props {
|
|
|
24
24
|
* Headshot image src. Be sure to prefix the image
|
|
25
25
|
*
|
|
26
26
|
* ```typescript
|
|
27
|
-
* import {
|
|
27
|
+
* import { asset } from '$app/paths';
|
|
28
28
|
*
|
|
29
|
-
* const imgSrc =
|
|
29
|
+
* const imgSrc = asset('/images/my-image.jpg');
|
|
30
30
|
* ```
|
|
31
31
|
*/
|
|
32
32
|
img: string;
|
|
@@ -5,8 +5,11 @@
|
|
|
5
5
|
locale: string | undefined;
|
|
6
6
|
/** Whether the article is embedded */
|
|
7
7
|
embedded?: boolean;
|
|
8
|
-
/**
|
|
9
|
-
|
|
8
|
+
/**
|
|
9
|
+
* SvelteKit's `resolve` function from `$app/paths`, used to build locale links
|
|
10
|
+
* against your project's base path. Defaults to an identity function.
|
|
11
|
+
*/
|
|
12
|
+
resolve?(pathname: string): string;
|
|
10
13
|
/** Options for the language toggle button */
|
|
11
14
|
buttonOptions?: {
|
|
12
15
|
locale: string;
|
|
@@ -19,7 +22,7 @@
|
|
|
19
22
|
let {
|
|
20
23
|
locale = 'en',
|
|
21
24
|
embedded = false,
|
|
22
|
-
|
|
25
|
+
resolve = (pathname: string) => pathname,
|
|
23
26
|
buttonOptions = {
|
|
24
27
|
locale: 'es',
|
|
25
28
|
label: 'Leer en español',
|
|
@@ -37,16 +40,16 @@
|
|
|
37
40
|
if (embedded) {
|
|
38
41
|
if (locale === translationLocale) {
|
|
39
42
|
// If we're in the non-English article, link to the English article
|
|
40
|
-
return
|
|
43
|
+
return resolve('/embeds/en/page/');
|
|
41
44
|
} else {
|
|
42
|
-
return
|
|
45
|
+
return resolve(`/embeds/${translationLocale}/page/`);
|
|
43
46
|
}
|
|
44
47
|
} else {
|
|
45
48
|
if (locale === translationLocale) {
|
|
46
49
|
// If we're in the non-English article, link to the English article
|
|
47
|
-
return
|
|
50
|
+
return resolve('/');
|
|
48
51
|
} else {
|
|
49
|
-
return
|
|
52
|
+
return resolve(`/${translationLocale}/`);
|
|
50
53
|
}
|
|
51
54
|
}
|
|
52
55
|
};
|
|
@@ -3,8 +3,11 @@ interface Props {
|
|
|
3
3
|
locale: string | undefined;
|
|
4
4
|
/** Whether the article is embedded */
|
|
5
5
|
embedded?: boolean;
|
|
6
|
-
/**
|
|
7
|
-
|
|
6
|
+
/**
|
|
7
|
+
* SvelteKit's `resolve` function from `$app/paths`, used to build locale links
|
|
8
|
+
* against your project's base path. Defaults to an identity function.
|
|
9
|
+
*/
|
|
10
|
+
resolve?(pathname: string): string;
|
|
8
11
|
/** Options for the language toggle button */
|
|
9
12
|
buttonOptions?: {
|
|
10
13
|
locale: string;
|
|
@@ -49,6 +49,6 @@ interface Props {
|
|
|
49
49
|
authors?: GraphicAuthor[];
|
|
50
50
|
}
|
|
51
51
|
/** `SEO` [Read the docs.](https://reuters-graphics.github.io/graphics-components/?path=/docs/components-ads-analytic-seo--docs) */
|
|
52
|
-
declare const
|
|
53
|
-
type
|
|
54
|
-
export default
|
|
52
|
+
declare const SEO: import("svelte").Component<Props, {}, "">;
|
|
53
|
+
type SEO = ReturnType<typeof SEO>;
|
|
54
|
+
export default SEO;
|
|
@@ -76,13 +76,13 @@ The `BeforeAfter` component shows a before-and-after comparison of an image.
|
|
|
76
76
|
```svelte
|
|
77
77
|
<script>
|
|
78
78
|
import { BeforeAfter } from '@reuters-graphics/graphics-components';
|
|
79
|
-
import {
|
|
79
|
+
import { asset } from '$app/paths'; // 👈 If using in the graphics kit...
|
|
80
80
|
</script>
|
|
81
81
|
|
|
82
82
|
<BeforeAfter
|
|
83
|
-
beforeSrc={
|
|
83
|
+
beforeSrc={asset('/images/before-after/myrne-before.jpg')}
|
|
84
84
|
beforeAlt="Satellite image of Russian base at Myrne taken on July 7, 2020."
|
|
85
|
-
afterSrc={
|
|
85
|
+
afterSrc={asset('/images/before-after/myrne-after.jpg')}
|
|
86
86
|
afterAlt="Satellite image of Russian base at Myrne taken on Oct. 20, 2020."
|
|
87
87
|
/>
|
|
88
88
|
```
|
|
@@ -111,9 +111,9 @@ afterAlt: Satellite image of Russian base at Myrne taken on Oct. 20, 2020.
|
|
|
111
111
|
{#each content.blocks as block}
|
|
112
112
|
{#if block.type === 'before-after'}
|
|
113
113
|
<BeforeAfter
|
|
114
|
-
beforeSrc={
|
|
114
|
+
beforeSrc={asset(`/${block.beforeSrc}`)}
|
|
115
115
|
beforeAlt={block.beforeAlt}
|
|
116
|
-
afterSrc={
|
|
116
|
+
afterSrc={asset(`/${block.afterSrc}`)}
|
|
117
117
|
afterAlt={block.afterAlt}
|
|
118
118
|
/>
|
|
119
119
|
{/if}
|
|
@@ -10,7 +10,6 @@
|
|
|
10
10
|
|------|------|---------|:--------:|-------------|
|
|
11
11
|
| `title` | `string` | `'Reuters Graphics blog post'` | | Title of the blog post |
|
|
12
12
|
| `slugTitle` | `string` | `'Reuters Graphics blog post'` | | A sluggable title of the blog post. **Important:** Do not change this title after publishing the post. Changes will break published links to the post. |
|
|
13
|
-
| `base` | `string` | `''` | | Base path prepended to the copied URL, e.g. "/graphics", usually gotten from base store in SvelteKit. |
|
|
14
13
|
| `authors` | `string[]` | `[]` | | Array of author names, which will be slugified to create links to Reuters author pages |
|
|
15
14
|
| `publishTime` | `string` | `''` | | Publish time as a datetime string. |
|
|
16
15
|
| `updateTime` | `string` | `''` | | Update time as a datetime string. |
|
|
@@ -30,7 +29,6 @@
|
|
|
30
29
|
authors={['John Smith', 'Jane Doe']}
|
|
31
30
|
publishTime="2024-10-01T18:30:00Z"
|
|
32
31
|
updateTime="2024-10-01T21:45:00Z"
|
|
33
|
-
base=""
|
|
34
32
|
>
|
|
35
33
|
<BodyText
|
|
36
34
|
text="Iran launched a barrage of ballistic missiles at Israel on Tuesday in its first direct attack on Israeli territory, marking a significant escalation in the conflict gripping the Middle East."
|
|
@@ -50,7 +48,7 @@ The `BlogPost` component renders a single entry in a graphics blog page, includi
|
|
|
50
48
|
```svelte
|
|
51
49
|
<script>
|
|
52
50
|
import { BlogPost } from '@reuters-graphics/graphics-components';
|
|
53
|
-
import {
|
|
51
|
+
import { resolve } from '$app/paths';
|
|
54
52
|
</script>
|
|
55
53
|
|
|
56
54
|
<BlogPost
|
|
@@ -59,7 +57,7 @@ The `BlogPost` component renders a single entry in a graphics blog page, includi
|
|
|
59
57
|
authors={['John Smith', 'Jane Doe']}
|
|
60
58
|
publishTime="2024-10-01T18:30:00Z"
|
|
61
59
|
updateTime="2024-10-01T21:45:00Z"
|
|
62
|
-
{
|
|
60
|
+
{resolve}
|
|
63
61
|
>
|
|
64
62
|
<!-- Post body content goes here -->
|
|
65
63
|
</BlogPost>
|
|
@@ -9,7 +9,6 @@
|
|
|
9
9
|
| Prop | Type | Default | Required | Description |
|
|
10
10
|
|------|------|---------|:--------:|-------------|
|
|
11
11
|
| `posts` | `Post[]` | — | ✓ | — |
|
|
12
|
-
| `base` | `string` | `''` | | Base path prepended to post links, e.g. "/graphics". |
|
|
13
12
|
| `label` | `string` | `'Show all articles'` | | The label for the table of contents toggle button. |
|
|
14
13
|
| `maxHeight` | `number` | `300` | | The maximum height of the table of contents list in pixels. |
|
|
15
14
|
|
|
@@ -34,7 +33,7 @@
|
|
|
34
33
|
]}
|
|
35
34
|
/>
|
|
36
35
|
|
|
37
|
-
<BlogTOC {posts}
|
|
36
|
+
<BlogTOC {posts} />
|
|
38
37
|
|
|
39
38
|
<BlogPost
|
|
40
39
|
title="Iran fires ballistic missiles at Israel in major escalation"
|
|
@@ -42,7 +41,6 @@
|
|
|
42
41
|
authors={['John Smith', 'Jane Doe']}
|
|
43
42
|
publishTime="2024-10-01T18:30:00Z"
|
|
44
43
|
updateTime="2024-10-01T21:45:00Z"
|
|
45
|
-
base=""
|
|
46
44
|
>
|
|
47
45
|
<BodyText
|
|
48
46
|
text="Iran launched a barrage of ballistic missiles at Israel on Tuesday in its first direct attack on Israeli territory, marking a significant escalation in the conflict gripping the Middle East."
|
|
@@ -62,7 +60,7 @@ The `BlogTOC` component renders a collapsible table of contents for a graphics b
|
|
|
62
60
|
```svelte
|
|
63
61
|
<script>
|
|
64
62
|
import { BlogTOC } from '@reuters-graphics/graphics-components';
|
|
65
|
-
import {
|
|
63
|
+
import { resolve } from '$app/paths';
|
|
66
64
|
</script>
|
|
67
65
|
|
|
68
66
|
<BlogTOC
|
|
@@ -78,11 +76,11 @@ The `BlogTOC` component renders a collapsible table of contents for a graphics b
|
|
|
78
76
|
publishTime: '2024-10-02T09:15:00Z',
|
|
79
77
|
},
|
|
80
78
|
]}
|
|
81
|
-
{
|
|
79
|
+
{resolve}
|
|
82
80
|
/>
|
|
83
81
|
```
|
|
84
82
|
|
|
85
|
-
|
|
83
|
+
Pass SvelteKit's `resolve` function (from `$app/paths`) so that post links resolve correctly against your project's base path.
|
|
86
84
|
|
|
87
85
|
Each post in the `posts` array must have:
|
|
88
86
|
|
|
@@ -28,7 +28,7 @@ The `EmbedPreviewerLink` component is a tool for previewing the embeds in develo
|
|
|
28
28
|
<script>
|
|
29
29
|
import { EmbedPreviewerLink } from '@reuters-graphics/graphics-components';
|
|
30
30
|
|
|
31
|
-
import { dev } from '$app/
|
|
31
|
+
import { dev } from '$app/environment';
|
|
32
32
|
</script>
|
|
33
33
|
|
|
34
34
|
<EmbedPreviewerLink {dev} />
|
|
@@ -45,11 +45,11 @@ The `FeaturePhoto` component adds a full-width photo.
|
|
|
45
45
|
```svelte
|
|
46
46
|
<script>
|
|
47
47
|
import { FeaturePhoto } from '@reuters-graphics/graphics-components';
|
|
48
|
-
import {
|
|
48
|
+
import { asset } from '$app/paths'; // 👈 If using in the graphics kit...
|
|
49
49
|
</script>
|
|
50
50
|
|
|
51
51
|
<FeaturePhoto
|
|
52
|
-
src={
|
|
52
|
+
src={asset('/images/myImage.jpg')}
|
|
53
53
|
altText="Some alt text"
|
|
54
54
|
caption="A caption"
|
|
55
55
|
/>
|
|
@@ -80,7 +80,7 @@ caption: Carcharodon carcharias - REUTERS
|
|
|
80
80
|
import { FeaturePhoto } from '@reuters-graphics/graphics-components';
|
|
81
81
|
|
|
82
82
|
import content from '$locales/en/content.json';
|
|
83
|
-
import {
|
|
83
|
+
import { asset } from '$app/paths';
|
|
84
84
|
</script>
|
|
85
85
|
|
|
86
86
|
{#each content.blocks as block}
|
|
@@ -89,7 +89,7 @@ caption: Carcharodon carcharias - REUTERS
|
|
|
89
89
|
{:else if block.type === 'photo'}
|
|
90
90
|
<FeaturePhoto
|
|
91
91
|
width={block.width}
|
|
92
|
-
src={
|
|
92
|
+
src={asset(`/${block.src}`)}
|
|
93
93
|
altText={block.altText}
|
|
94
94
|
caption={block.caption}
|
|
95
95
|
/>
|
|
@@ -177,7 +177,7 @@ To pass your ai2svelte graphic into `GraphicBlock` component, import your ai2sve
|
|
|
177
177
|
import LogBlock from './components/dev/LogBlock.svelte';
|
|
178
178
|
|
|
179
179
|
// If using with the graphics kit
|
|
180
|
-
import {
|
|
180
|
+
import { asset } from '$app/paths';
|
|
181
181
|
|
|
182
182
|
// A built-in helper function in Graphis Kit for validating container width
|
|
183
183
|
import { containerWidth } from '$utils/propValidators';
|
|
@@ -207,7 +207,7 @@ To pass your ai2svelte graphic into `GraphicBlock` component, import your ai2sve
|
|
|
207
207
|
ariaDescription={block.altText}
|
|
208
208
|
>
|
|
209
209
|
<!-- In graphics kit, pass the `assetsPath` prop -->
|
|
210
|
-
<AiChart assetsPath={
|
|
210
|
+
<AiChart assetsPath={asset('/').replace(/\/$/, '')} />
|
|
211
211
|
</GraphicBlock>
|
|
212
212
|
{/if}
|
|
213
213
|
{/if}
|
|
@@ -253,7 +253,7 @@ The `ariaDescription` string will be processed as markdown, so you can add multi
|
|
|
253
253
|
ariaDescription="A map showing the shake intensity produced by the earthquake."
|
|
254
254
|
>
|
|
255
255
|
<!-- In graphics kit, pass the `assetsPath` prop -->
|
|
256
|
-
<AiChart assetsPath={
|
|
256
|
+
<AiChart assetsPath={asset('/').replace(/\/$/, '')} />
|
|
257
257
|
</GraphicBlock>
|
|
258
258
|
```
|
|
259
259
|
|
|
@@ -272,7 +272,7 @@ Sometimes, instead of a simple sentence, we want to provide a data table or some
|
|
|
272
272
|
notes="Note: A shakemap represents the ground shaking produced by an earthquake."
|
|
273
273
|
>
|
|
274
274
|
<!-- In graphics kit, pass the `assetsPath` prop -->
|
|
275
|
-
<AiChart assetsPath={
|
|
275
|
+
<AiChart assetsPath={asset('/').replace(/\/$/, '')} />
|
|
276
276
|
|
|
277
277
|
<!-- Custom ARIA description snippet -->
|
|
278
278
|
{#snippet ariaDescription()}
|
|
@@ -198,7 +198,7 @@ To add a crown image, use the `crown` [snippet](https://svelte.dev/docs/svelte/s
|
|
|
198
198
|
```svelte
|
|
199
199
|
<script>
|
|
200
200
|
import { Headline } from '@reuters-graphics/graphics-components';
|
|
201
|
-
import {
|
|
201
|
+
import { asset } from '$app/paths';
|
|
202
202
|
</script>
|
|
203
203
|
|
|
204
204
|
<Headline
|
|
@@ -225,7 +225,7 @@ Add a full graphic or any other component in the crown.
|
|
|
225
225
|
```svelte
|
|
226
226
|
<script>
|
|
227
227
|
import { Headline } from '@reuters-graphics/graphics-components';
|
|
228
|
-
import {
|
|
228
|
+
import { asset } from '$app/paths'; // If in Graphis Kit
|
|
229
229
|
|
|
230
230
|
import Map from './ai2svelte/graphic.svelte'; // Import the crown graphic component
|
|
231
231
|
</script>
|
|
@@ -242,7 +242,7 @@ Add a full graphic or any other component in the crown.
|
|
|
242
242
|
<!-- Add a crown graphic -->
|
|
243
243
|
{#snippet crown()}
|
|
244
244
|
<!-- Pass `assetsPath` if in graphics kit -->
|
|
245
|
-
<Map assetsPath={
|
|
245
|
+
<Map assetsPath={asset('/').replace(/\/$/, '')} />
|
|
246
246
|
{/snippet}
|
|
247
247
|
</Headline>
|
|
248
248
|
```
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
| `id` | `string` | — | ✓ | Add an id to target with custom CSS. |
|
|
13
13
|
| `width` | `Extract<ContainerWidth, 'normal' \| 'wide'>` | `'normal'` | | Width of the container. |
|
|
14
14
|
| `colour` | `string` | `'#cccccc'` | | Default background colour to be used as a mount behind the headshot. |
|
|
15
|
-
| `figures` | `{ /** * Headshot image src. Be sure to prefix the image * * ```typescript * import {
|
|
15
|
+
| `figures` | `{ /** * Headshot image src. Be sure to prefix the image * * ```typescript * import { asset } from '$app/paths'; * * const imgSrc = asset('/images/my-image.jpg'); * ``` */ img: string; /** * Figure name. */ name: string; /** * Figure role or title. */ role?: string; /** * Text describing the person. */ text: string; /** * Background colour to be used as a mount behind the headshot. */ colour?: string; }[]` | — | ✓ | Individual figures -- i.e., people -- for the headpile. |
|
|
16
16
|
|
|
17
17
|
## Examples
|
|
18
18
|
|
|
@@ -33,19 +33,19 @@ It's designed to be used with headshots that have had their background removed,
|
|
|
33
33
|
```svelte
|
|
34
34
|
<script>
|
|
35
35
|
import { Headpile } from '@reuters-graphics/graphics-components';
|
|
36
|
-
import {
|
|
36
|
+
import { asset } from '$app/paths'; // 👈 If using in the graphics kit...
|
|
37
37
|
</script>
|
|
38
38
|
|
|
39
39
|
<Headpile
|
|
40
40
|
figures={[
|
|
41
41
|
{
|
|
42
|
-
img:
|
|
42
|
+
img: asset('/images/person-A.jpg'),
|
|
43
43
|
name: 'General Abdel Fattah al-Burhan',
|
|
44
44
|
role: "Sudan's Sovereign Council Chief and military commander",
|
|
45
45
|
text: 'Burhan was little known in public life until taking part in the coup ...',
|
|
46
46
|
},
|
|
47
47
|
{
|
|
48
|
-
img:
|
|
48
|
+
img: asset('/images/person-B.jpg'),
|
|
49
49
|
name: 'General Mohamed Hamdan Dagalo',
|
|
50
50
|
role: 'Leader of the Sudanese paramilitary Rapid Support Forces (RSF)',
|
|
51
51
|
text: 'Popularly known as Hemedti, Dagalo rose from lowly beginnings ...',
|