@reuters-graphics/graphics-components 0.0.1-beta.1 → 0.0.1-beta.4
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 +2 -0
- package/dist/@types/components/Article/Article.svelte.d.ts +1 -1
- package/dist/@types/components/PaddingReset/PaddingReset.svelte.d.ts +27 -0
- package/dist/@types/index.d.ts +3 -1
- package/dist/components/Article/Article.svelte +1 -1
- package/dist/components/BeforeAfter/BeforeAfter.svelte +7 -4
- package/dist/components/FeaturePhoto/FeaturePhoto.svelte +5 -9
- package/dist/components/GraphicBlock/GraphicBlock.svelte +5 -5
- package/dist/components/PaddingReset/PaddingReset.svelte +22 -0
- package/dist/components/PhotoPack/PhotoPack.svelte +2 -2
- package/dist/index.js +3 -1
- package/package.json +4 -3
- package/dist/@types/components/PaddingReset/index.svelte.d.ts +0 -27
- package/dist/components/PaddingReset/index.svelte +0 -17
package/README.md
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
# ⚙️ graphics-components
|
|
4
4
|
|
|
5
|
+
[](https://badge.fury.io/js/@reuters-graphics%2Fgraphics-components)
|
|
6
|
+
|
|
5
7
|
Svelte components, SCSS and more for Reuters Graphics pages.
|
|
6
8
|
|
|
7
9
|
[Read the docs.](https://reuters-graphics.github.io/graphics-components/)
|
|
@@ -3,7 +3,7 @@ declare const __propDef: {
|
|
|
3
3
|
props: {
|
|
4
4
|
/** Set to true for embeddables. */ embedded?: boolean;
|
|
5
5
|
/** Add an id to the article tag to target it with custom CSS. */ id?: string | null;
|
|
6
|
-
/** ARIA role of the article
|
|
6
|
+
/** ARIA role of the article */ role?: string | null;
|
|
7
7
|
/** Set custom widths for the normal, wide and wider column dimensions */ columnWidths?: {
|
|
8
8
|
/** Narrower column width */
|
|
9
9
|
narrower: number;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/** @typedef {typeof __propDef.props} PaddingResetProps */
|
|
2
|
+
/** @typedef {typeof __propDef.events} PaddingResetEvents */
|
|
3
|
+
/** @typedef {typeof __propDef.slots} PaddingResetSlots */
|
|
4
|
+
export default class PaddingReset extends SvelteComponentTyped<{
|
|
5
|
+
containerIsFluid?: boolean;
|
|
6
|
+
}, {
|
|
7
|
+
[evt: string]: CustomEvent<any>;
|
|
8
|
+
}, {
|
|
9
|
+
default: {};
|
|
10
|
+
}> {
|
|
11
|
+
}
|
|
12
|
+
export type PaddingResetProps = typeof __propDef.props;
|
|
13
|
+
export type PaddingResetEvents = typeof __propDef.events;
|
|
14
|
+
export type PaddingResetSlots = typeof __propDef.slots;
|
|
15
|
+
import { SvelteComponentTyped } from "svelte";
|
|
16
|
+
declare const __propDef: {
|
|
17
|
+
props: {
|
|
18
|
+
containerIsFluid?: boolean;
|
|
19
|
+
};
|
|
20
|
+
events: {
|
|
21
|
+
[evt: string]: CustomEvent<any>;
|
|
22
|
+
};
|
|
23
|
+
slots: {
|
|
24
|
+
default: {};
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
export {};
|
package/dist/@types/index.d.ts
CHANGED
|
@@ -10,6 +10,8 @@ export { default as GraphicBlock } from "./components/GraphicBlock/GraphicBlock.
|
|
|
10
10
|
export { default as Headline } from "./components/Headline/Headline.svelte";
|
|
11
11
|
export { default as Hero } from "./components/Hero/Hero.svelte";
|
|
12
12
|
export { default as NoteText } from "./components/NoteText/NoteText.svelte";
|
|
13
|
+
export { default as PaddingReset } from "./components/PaddingReset/PaddingReset.svelte";
|
|
14
|
+
export { default as PhotoPack } from "./components/PhotoPack/PhotoPack.svelte";
|
|
13
15
|
export { default as PymChild } from "./components/PymChild/PymChild.svelte";
|
|
14
16
|
export { default as ReutersLogo } from "./components/ReutersLogo/ReutersLogo.svelte";
|
|
15
17
|
export { default as Scroller } from "./components/Scroller/Scroller.svelte";
|
|
@@ -20,5 +22,5 @@ export { default as SiteHeader } from "./components/SiteHeader/SiteHeader.svelte
|
|
|
20
22
|
export { default as Spinner } from "./components/Spinner/Spinner.svelte";
|
|
21
23
|
export { default as Video } from "./components/Video/Video.svelte";
|
|
22
24
|
export { default as Visible } from "./components/Visible/Visible.svelte";
|
|
23
|
-
export { getPhotoPackPropsFromDoc } from "./components/PhotoPack/docProps";
|
|
25
|
+
export { getPhotoPackPropsFromDoc } from "./components/PhotoPack/docProps.js";
|
|
24
26
|
export { default as Theme, themes } from "./components/Theme/Theme.svelte";
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
export let embedded = false;
|
|
3
3
|
/** Add an id to the article tag to target it with custom CSS. */
|
|
4
4
|
export let id = null;
|
|
5
|
-
/** ARIA role of the article
|
|
5
|
+
/** ARIA role of the article */
|
|
6
6
|
export let role = null;
|
|
7
7
|
/** Set custom widths for the normal, wide and wider column dimensions */
|
|
8
8
|
export let columnWidths = {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<script>import { throttle } from 'lodash-es';
|
|
2
2
|
import { onMount } from 'svelte';
|
|
3
3
|
import Block from '../Block/Block.svelte';
|
|
4
|
+
import PaddingReset from '../PaddingReset/PaddingReset.svelte';
|
|
4
5
|
/** Width of the chart within the text well. */
|
|
5
6
|
export let width = 'normal'; // options: wide, wider, widest, fluid
|
|
6
7
|
/** Height of the component */
|
|
@@ -205,10 +206,12 @@ onMount(() => {
|
|
|
205
206
|
</figure>
|
|
206
207
|
</div>
|
|
207
208
|
{#if $$slots.caption}
|
|
208
|
-
<
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
209
|
+
<PaddingReset containerIsFluid="{width === 'fluid'}">
|
|
210
|
+
<aside class="before-after-caption" id="{`${id}-caption`}">
|
|
211
|
+
<!-- Caption for image credits -->
|
|
212
|
+
<slot name="caption" />
|
|
213
|
+
</aside>
|
|
214
|
+
</PaddingReset>
|
|
212
215
|
{/if}
|
|
213
216
|
</Block>
|
|
214
217
|
{/if}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<script>import { onMount } from 'svelte';
|
|
2
2
|
import Block from '../Block/Block.svelte';
|
|
3
|
+
import PaddingReset from '../PaddingReset/PaddingReset.svelte';
|
|
3
4
|
/**
|
|
4
5
|
* Photo src
|
|
5
6
|
* @type {string}
|
|
@@ -60,18 +61,16 @@ onMount(() => {
|
|
|
60
61
|
</script>
|
|
61
62
|
|
|
62
63
|
<Block width="{width}" cls="photo">
|
|
63
|
-
<figure
|
|
64
|
-
bind:this="{container}"
|
|
65
|
-
aria-label="media"
|
|
66
|
-
class:fluid="{width === 'fluid'}"
|
|
67
|
-
>
|
|
64
|
+
<figure bind:this="{container}" aria-label="media">
|
|
68
65
|
{#if !lazy || (intersectable && intersecting)}
|
|
69
66
|
<img src="{src}" alt="{altText}" />
|
|
70
67
|
{:else}
|
|
71
68
|
<div class="placeholder" height="{`${height}px`}"></div>
|
|
72
69
|
{/if}
|
|
73
70
|
{#if caption}
|
|
74
|
-
<
|
|
71
|
+
<PaddingReset containerIsFluid="{width === 'fluid'}">
|
|
72
|
+
<figcaption>{caption}</figcaption>
|
|
73
|
+
</PaddingReset>
|
|
75
74
|
{/if}
|
|
76
75
|
{#if !altText}
|
|
77
76
|
<div class="alt-warning">altText</div>
|
|
@@ -107,7 +106,4 @@ figure figcaption {
|
|
|
107
106
|
font-size: 0.8rem;
|
|
108
107
|
font-family: var(--theme-font-family-note, "Knowledge", "Source Sans Pro", Arial, sans-serif);
|
|
109
108
|
color: var(--theme-colour-text-secondary, #666666);
|
|
110
|
-
}
|
|
111
|
-
figure.fluid figcaption {
|
|
112
|
-
padding-left: 15px;
|
|
113
109
|
}</style>
|
|
@@ -55,7 +55,7 @@ export let ariaDescription = null;
|
|
|
55
55
|
import AriaHidden from './AriaHidden.svelte';
|
|
56
56
|
import TextBlock from './TextBlock.svelte';
|
|
57
57
|
import Block from '../Block/Block.svelte';
|
|
58
|
-
import PaddingReset from '../PaddingReset/
|
|
58
|
+
import PaddingReset from '../PaddingReset/PaddingReset.svelte';
|
|
59
59
|
import { marked } from 'marked';
|
|
60
60
|
</script>
|
|
61
61
|
|
|
@@ -69,14 +69,14 @@ import { marked } from 'marked';
|
|
|
69
69
|
>
|
|
70
70
|
<div>
|
|
71
71
|
{#if $$slots.title}
|
|
72
|
-
<PaddingReset
|
|
72
|
+
<PaddingReset containerIsFluid="{width === 'fluid'}">
|
|
73
73
|
<TextBlock width="{textWidth}">
|
|
74
74
|
<!-- Custom title content -->
|
|
75
75
|
<slot name="title" />
|
|
76
76
|
</TextBlock>
|
|
77
77
|
</PaddingReset>
|
|
78
78
|
{:else if title}
|
|
79
|
-
<PaddingReset
|
|
79
|
+
<PaddingReset containerIsFluid="{width === 'fluid'}">
|
|
80
80
|
<TextBlock width="{textWidth}">
|
|
81
81
|
<h3>{title}</h3>
|
|
82
82
|
{#if description}
|
|
@@ -100,14 +100,14 @@ import { marked } from 'marked';
|
|
|
100
100
|
</div>
|
|
101
101
|
{/if}
|
|
102
102
|
{#if $$slots.notes}
|
|
103
|
-
<PaddingReset
|
|
103
|
+
<PaddingReset containerIsFluid="{width === 'fluid'}">
|
|
104
104
|
<TextBlock width="{textWidth}">
|
|
105
105
|
<!-- Custom notes content -->
|
|
106
106
|
<slot name="notes" />
|
|
107
107
|
</TextBlock>
|
|
108
108
|
</PaddingReset>
|
|
109
109
|
{:else if notes}
|
|
110
|
-
<PaddingReset
|
|
110
|
+
<PaddingReset containerIsFluid="{width === 'fluid'}">
|
|
111
111
|
<TextBlock width="{textWidth}">
|
|
112
112
|
<aside>
|
|
113
113
|
{@html marked(notes)}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
/**
|
|
3
|
+
* If parent container is fluid, which resets the padding around contained elements.
|
|
4
|
+
*/
|
|
5
|
+
export let containerIsFluid = true;
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
{#if containerIsFluid}
|
|
9
|
+
<div>
|
|
10
|
+
<!-- Padded content -->
|
|
11
|
+
<slot />
|
|
12
|
+
</div>
|
|
13
|
+
{:else}
|
|
14
|
+
<!-- Padded content -->
|
|
15
|
+
<slot />
|
|
16
|
+
{/if}
|
|
17
|
+
|
|
18
|
+
<style>
|
|
19
|
+
div {
|
|
20
|
+
width: 100%;
|
|
21
|
+
padding: 0 15px;
|
|
22
|
+
}</style>
|
|
@@ -36,7 +36,7 @@ export let width = 'normal';
|
|
|
36
36
|
*/
|
|
37
37
|
export let captionWidth = 'normal';
|
|
38
38
|
import Block from '../Block/Block.svelte';
|
|
39
|
-
import PaddingReset from '../PaddingReset/
|
|
39
|
+
import PaddingReset from '../PaddingReset/PaddingReset.svelte';
|
|
40
40
|
import { marked } from 'marked';
|
|
41
41
|
let containerWidth;
|
|
42
42
|
const groupRows = (images, layout) => {
|
|
@@ -89,7 +89,7 @@ $: rows = groupRows(images, layout);
|
|
|
89
89
|
</div>
|
|
90
90
|
{/each}
|
|
91
91
|
</div>
|
|
92
|
-
<PaddingReset
|
|
92
|
+
<PaddingReset containerIsFluid="{width === 'fluid'}">
|
|
93
93
|
<Block width="{captionWidth}">
|
|
94
94
|
<div class="captions-container">
|
|
95
95
|
{#each rows as row, ri}
|
package/dist/index.js
CHANGED
|
@@ -11,6 +11,8 @@ export { default as GraphicBlock } from './components/GraphicBlock/GraphicBlock.
|
|
|
11
11
|
export { default as Headline } from './components/Headline/Headline.svelte';
|
|
12
12
|
export { default as Hero } from './components/Hero/Hero.svelte';
|
|
13
13
|
export { default as NoteText } from './components/NoteText/NoteText.svelte';
|
|
14
|
+
export { default as PaddingReset } from './components/PaddingReset/PaddingReset.svelte';
|
|
15
|
+
export { default as PhotoPack } from './components/PhotoPack/PhotoPack.svelte';
|
|
14
16
|
export { default as PymChild } from './components/PymChild/PymChild.svelte';
|
|
15
17
|
export { default as ReutersLogo } from './components/ReutersLogo/ReutersLogo.svelte';
|
|
16
18
|
export { default as Scroller } from './components/Scroller/Scroller.svelte';
|
|
@@ -28,4 +30,4 @@ export { default as Video } from './components/Video/Video.svelte';
|
|
|
28
30
|
export { default as Visible } from './components/Visible/Visible.svelte';
|
|
29
31
|
|
|
30
32
|
// Utilities
|
|
31
|
-
export { getPhotoPackPropsFromDoc } from './components/PhotoPack/docProps';
|
|
33
|
+
export { getPhotoPackPropsFromDoc } from './components/PhotoPack/docProps.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reuters-graphics/graphics-components",
|
|
3
|
-
"version": "0.0.1-beta.
|
|
3
|
+
"version": "0.0.1-beta.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"private": false,
|
|
6
6
|
"homepage": "https://reuters-graphics.github.io/graphics-components",
|
|
@@ -11,7 +11,8 @@
|
|
|
11
11
|
"build:package": "node ./bin/buildPackage/index.js",
|
|
12
12
|
"build:docs": "build-storybook -o docs && touch ./docs/.nojekyll",
|
|
13
13
|
"build": "npm-run-all build:package build:docs",
|
|
14
|
-
"prepublishOnly": "npm run build:package"
|
|
14
|
+
"prepublishOnly": "npm run build:package",
|
|
15
|
+
"postversion": "git push origin && git push origin --tags"
|
|
15
16
|
},
|
|
16
17
|
"license": "MIT",
|
|
17
18
|
"types": "dist/@types/index.d.ts",
|
|
@@ -112,7 +113,7 @@
|
|
|
112
113
|
"./components/Headline/Headline.svelte": "./dist/components/Headline/Headline.svelte",
|
|
113
114
|
"./components/Hero/Hero.svelte": "./dist/components/Hero/Hero.svelte",
|
|
114
115
|
"./components/NoteText/NoteText.svelte": "./dist/components/NoteText/NoteText.svelte",
|
|
115
|
-
"./components/PaddingReset/
|
|
116
|
+
"./components/PaddingReset/PaddingReset.svelte": "./dist/components/PaddingReset/PaddingReset.svelte",
|
|
116
117
|
"./components/PhotoPack/PhotoPack.svelte": "./dist/components/PhotoPack/PhotoPack.svelte",
|
|
117
118
|
"./components/PhotoPack/docProps.ts": "./dist/components/PhotoPack/docProps.ts",
|
|
118
119
|
"./components/PymChild/PymChild.svelte": "./dist/components/PymChild/PymChild.svelte",
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/** @typedef {typeof __propDef.props} IndexProps */
|
|
2
|
-
/** @typedef {typeof __propDef.events} IndexEvents */
|
|
3
|
-
/** @typedef {typeof __propDef.slots} IndexSlots */
|
|
4
|
-
export default class Index extends SvelteComponentTyped<{
|
|
5
|
-
width?: string;
|
|
6
|
-
}, {
|
|
7
|
-
[evt: string]: CustomEvent<any>;
|
|
8
|
-
}, {
|
|
9
|
-
default: {};
|
|
10
|
-
}> {
|
|
11
|
-
}
|
|
12
|
-
export type IndexProps = typeof __propDef.props;
|
|
13
|
-
export type IndexEvents = typeof __propDef.events;
|
|
14
|
-
export type IndexSlots = typeof __propDef.slots;
|
|
15
|
-
import { SvelteComponentTyped } from "svelte";
|
|
16
|
-
declare const __propDef: {
|
|
17
|
-
props: {
|
|
18
|
-
width?: string;
|
|
19
|
-
};
|
|
20
|
-
events: {
|
|
21
|
-
[evt: string]: CustomEvent<any>;
|
|
22
|
-
};
|
|
23
|
-
slots: {
|
|
24
|
-
default: {};
|
|
25
|
-
};
|
|
26
|
-
};
|
|
27
|
-
export {};
|