closes #18
This commit is contained in:
parent
5e2cae2200
commit
c2def97c78
21 changed files with 51 additions and 40 deletions
|
|
@ -1,8 +1,4 @@
|
||||||
<!--
|
<!-- @component `YourComponent` [Read the docs.](https://reuters-graphics.github.io/graphics-components/?path=/docs/components-YourComponent--default) -->
|
||||||
@component The `YourComponent` component
|
|
||||||
|
|
||||||
[Docs](https://reuters-graphics.github.io/graphics-components/?path=/docs/components-YourComponent--default)
|
|
||||||
-->
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
/** ✏️ DOCUMENT your chart's props using TypeScript and JSDoc comments like below! */
|
/** ✏️ DOCUMENT your chart's props using TypeScript and JSDoc comments like below! */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,4 @@
|
||||||
<!--
|
<!-- @component `Article` [Read the docs.](https://reuters-graphics.github.io/graphics-components/?path=/docs/layout-article--default) -->
|
||||||
@component The `Article` component contains all the content of our story and also establishes the dimensions of our article well, the default central trunk of our page layout.
|
|
||||||
|
|
||||||
[Docs](https://reuters-graphics.github.io/graphics-components/?path=/docs/layout-article--default)
|
|
||||||
-->
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
/** Set to true for embeddables. */
|
/** Set to true for embeddables. */
|
||||||
export let embedded: boolean = false;
|
export let embedded: boolean = false;
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
<!-- @component `BeforeAfter` [Read the docs.](https://reuters-graphics.github.io/graphics-components/?path=/docs/components-beforeafter--default) -->
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { throttle } from 'lodash-es';
|
import { throttle } from 'lodash-es';
|
||||||
import { onMount } from 'svelte';
|
import { onMount } from 'svelte';
|
||||||
|
|
@ -101,16 +102,16 @@
|
||||||
const move = (e) => {
|
const move = (e) => {
|
||||||
if (sliding && imgOffset) {
|
if (sliding && imgOffset) {
|
||||||
const el = e.touches ? e.touches[0] : e;
|
const el = e.touches ? e.touches[0] : e;
|
||||||
const figureOffset = figure
|
const figureOffset = figure ?
|
||||||
? parseInt(window.getComputedStyle(figure).marginLeft.slice(0, -2))
|
parseInt(window.getComputedStyle(figure).marginLeft.slice(0, -2)) :
|
||||||
: 0;
|
0;
|
||||||
let x = el.pageX - figureOffset - imgOffset.left;
|
let x = el.pageX - figureOffset - imgOffset.left;
|
||||||
x =
|
x =
|
||||||
x < handleMargin
|
x < handleMargin ?
|
||||||
? handleMargin
|
handleMargin :
|
||||||
: x > w - handleMargin
|
x > w - handleMargin ?
|
||||||
? w - handleMargin
|
w - handleMargin :
|
||||||
: x;
|
x;
|
||||||
offset = x / w;
|
offset = x / w;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
<!-- @component `Block` [Read the docs.](https://reuters-graphics.github.io/graphics-components/?path=/docs/layout-block--default) -->
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import type { ContainerWidth } from '../@types/global';
|
import type { ContainerWidth } from '../@types/global';
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
<!-- @component `BodyText` [Read the docs.](https://reuters-graphics.github.io/graphics-components/?path=/docs/components-bodytext--default) -->
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
/**
|
/**
|
||||||
* A markdown text string.
|
* A markdown text string.
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
<!-- @component `DatawrapperChart` [Read the docs.](https://reuters-graphics.github.io/graphics-components/?path=/docs/components-DatawrapperChart--default) -->
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { onMount, onDestroy } from 'svelte';
|
import { onMount, onDestroy } from 'svelte';
|
||||||
import GraphicBlock from '../GraphicBlock/GraphicBlock.svelte';
|
import GraphicBlock from '../GraphicBlock/GraphicBlock.svelte';
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
<!-- @component `FeaturePhoto` [Read the docs.](https://reuters-graphics.github.io/graphics-components/?path=/docs/components-FeaturePhoto--default) -->
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { onMount } from 'svelte';
|
import { onMount } from 'svelte';
|
||||||
import Block from '../Block/Block.svelte';
|
import Block from '../Block/Block.svelte';
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
<!-- @component `GraphicBlock` [Read the docs.](https://reuters-graphics.github.io/graphics-components/?path=/docs/components-GraphicBlock--default) -->
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import type { ContainerWidth } from '../@types/global';
|
import type { ContainerWidth } from '../@types/global';
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
<!-- @component `Headline` [Read the docs.](https://reuters-graphics.github.io/graphics-components/?path=/docs/components-Headline--default) -->
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
/**
|
/**
|
||||||
* Headline
|
* Headline
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
<!-- @component `NoteText` [Read the docs.](https://reuters-graphics.github.io/graphics-components/?path=/docs/components-NoteText--default) -->
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
/**
|
/**
|
||||||
* A markdown text string.
|
* A markdown text string.
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
<!-- @component `PhotoPack` [Read the docs.](https://reuters-graphics.github.io/graphics-components/?path=/docs/components-PhotoPack--default) -->
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
interface Image {
|
interface Image {
|
||||||
src: string;
|
src: string;
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
<!-- @component `PymChild` [Read the docs.](https://reuters-graphics.github.io/graphics-components/?path=/docs/utilities-PymChild--default) -->
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
/** Pym.js polling interval */
|
/** Pym.js polling interval */
|
||||||
export let polling: number = 500;
|
export let polling: number = 500;
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
<!-- @component `ReutersLogo` [Read the docs.](https://reuters-graphics.github.io/graphics-components/?path=/docs/components-ReutersLogo--default) -->
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
/** "Kinesis" colour */
|
/** "Kinesis" colour */
|
||||||
export let logoColour: string = '#FA6400';
|
export let logoColour: string = '#FA6400';
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
<!-- @component `SEO` [Read the docs.](https://reuters-graphics.github.io/graphics-components/?path=/docs/components-SEO--default) -->
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import analytics from './analytics';
|
import analytics from './analytics';
|
||||||
import publisherTags from './publisherTags';
|
import publisherTags from './publisherTags';
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
|
<!-- @component `Scroller` [Read the docs.](https://reuters-graphics.github.io/graphics-components/?path=/docs/components-Scroller--default) -->
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import type { ContainerWidth, ScrollerStep } from '../@types/global';
|
import type { ContainerWidth, ScrollerStep } from '../@types/global';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ID of the scroller container
|
* ID of the scroller container
|
||||||
|
|
@ -8,9 +9,9 @@
|
||||||
export let id: string = '';
|
export let id: string = '';
|
||||||
/**
|
/**
|
||||||
* An array of step objects that define the steps in your scroller.
|
* An array of step objects that define the steps in your scroller.
|
||||||
*
|
*
|
||||||
* Each step object in the array can have:
|
* Each step object in the array can have:
|
||||||
*
|
*
|
||||||
* - `background` A background component **REQUIRED**
|
* - `background` A background component **REQUIRED**
|
||||||
* - `backgroundProps` An object of props given to the background component
|
* - `backgroundProps` An object of props given to the background component
|
||||||
* - `foreground` Either a markdown-formatted string or a foreground component **REQUIRED**
|
* - `foreground` Either a markdown-formatted string or a foreground component **REQUIRED**
|
||||||
|
|
@ -25,25 +26,25 @@
|
||||||
export let backgroundWidth: ContainerWidth = 'fluid';
|
export let backgroundWidth: ContainerWidth = 'fluid';
|
||||||
|
|
||||||
type ForegroundPosition = 'middle' | 'left' | 'right' | 'left opposite' | 'right opposite';
|
type ForegroundPosition = 'middle' | 'left' | 'right' | 'left opposite' | 'right opposite';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Position of the foreground. One of: middle, left, right, left opposite or right opposite.
|
* Position of the foreground. One of: middle, left, right, left opposite or right opposite.
|
||||||
*
|
*
|
||||||
* "opposite" options push the background to the other side on larger viewports.
|
* "opposite" options push the background to the other side on larger viewports.
|
||||||
*
|
*
|
||||||
* @type {string}
|
* @type {string}
|
||||||
*/
|
*/
|
||||||
export let foregroundPosition: ForegroundPosition = 'middle';
|
export let foregroundPosition: ForegroundPosition = 'middle';
|
||||||
/**
|
/**
|
||||||
* Whether previous background steps should stack below the current one.
|
* Whether previous background steps should stack below the current one.
|
||||||
*
|
*
|
||||||
* - `true` _default_ Background graphics from previous steps will remain visible below the active one, allowing you to stack graphics with transparent backgrounds.
|
* - `true` _default_ Background graphics from previous steps will remain visible below the active one, allowing you to stack graphics with transparent backgrounds.
|
||||||
* - `false` Only the background graphic from the current step will show and backgrounds from previous steps are hidden.
|
* - `false` Only the background graphic from the current step will show and backgrounds from previous steps are hidden.
|
||||||
*/
|
*/
|
||||||
export let stackBackground: boolean = true;
|
export let stackBackground: boolean = true;
|
||||||
/**
|
/**
|
||||||
* How many background steps to load before and after the currently active one, effectively lazy-loading them.
|
* How many background steps to load before and after the currently active one, effectively lazy-loading them.
|
||||||
*
|
*
|
||||||
* Setting to `0` disables lazy-loading and loads all backgrounds at once.
|
* Setting to `0` disables lazy-loading and loads all backgrounds at once.
|
||||||
*/
|
*/
|
||||||
export let preload: number = 1;
|
export let preload: number = 1;
|
||||||
|
|
@ -55,11 +56,11 @@
|
||||||
type EmbeddedLayout = 'fb' | 'bf';
|
type EmbeddedLayout = 'fb' | 'bf';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Layout order when `embedded` is `true`.
|
* Layout order when `embedded` is `true`.
|
||||||
*
|
*
|
||||||
* - `fb` _default_ Foreground then background
|
* - `fb` _default_ Foreground then background
|
||||||
* - `bf` Background then foreground
|
* - `bf` Background then foreground
|
||||||
*
|
*
|
||||||
* @type {string}
|
* @type {string}
|
||||||
*/
|
*/
|
||||||
export let embeddedLayout: EmbeddedLayout = 'fb';
|
export let embeddedLayout: EmbeddedLayout = 'fb';
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
<!-- @component `SiteFooter` [Read the docs.](https://reuters-graphics.github.io/graphics-components/?path=/docs/components-SiteFooter--default) -->
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import QuickLinks from './QuickLinks.svelte';
|
import QuickLinks from './QuickLinks.svelte';
|
||||||
import CompanyLinks from './CompanyLinks.svelte';
|
import CompanyLinks from './CompanyLinks.svelte';
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
<!-- @component `SiteHeader` [Read the docs.](https://reuters-graphics.github.io/graphics-components/?path=/docs/components-SiteHeader--default) -->
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import ReutersLogo from '../ReutersLogo/ReutersLogo.svelte';
|
import ReutersLogo from '../ReutersLogo/ReutersLogo.svelte';
|
||||||
import NavBar from './NavBar/index.svelte';
|
import NavBar from './NavBar/index.svelte';
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
<!-- @component `Spinner` [Read the docs.](https://reuters-graphics.github.io/graphics-components/?path=/docs/components-Spinner--default) -->
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
/** Primary colour of the spinner. */
|
/** Primary colour of the spinner. */
|
||||||
export let colour: string = '#666';
|
export let colour: string = '#666';
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
<!-- @component `Theme` [Read the docs.](https://reuters-graphics.github.io/graphics-components/?path=/docs/theming-Theme--default) -->
|
||||||
<script context="module" lang="ts">
|
<script context="module" lang="ts">
|
||||||
import light from './themes/light.js';
|
import light from './themes/light.js';
|
||||||
import dark from './themes/dark.js';
|
import dark from './themes/dark.js';
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
<!-- @component `Video` [Read the docs.](https://reuters-graphics.github.io/graphics-components/?path=/docs/components-Video--default) -->
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import IntersectionObserver from 'svelte-intersection-observer';
|
import IntersectionObserver from 'svelte-intersection-observer';
|
||||||
import Controls from './Controls.svelte';
|
import Controls from './Controls.svelte';
|
||||||
|
|
@ -163,9 +164,9 @@
|
||||||
on:pausePlayEvent="{pausePlayEvent}"
|
on:pausePlayEvent="{pausePlayEvent}"
|
||||||
paused="{paused}"
|
paused="{paused}"
|
||||||
clickedOnPauseBtn="{clickedOnPauseBtn}"
|
clickedOnPauseBtn="{clickedOnPauseBtn}"
|
||||||
controlsOpacity="{hoverToSeeControls
|
controlsOpacity="{hoverToSeeControls ?
|
||||||
? interactiveControlsOpacity
|
interactiveControlsOpacity :
|
||||||
: controlsOpacity}"
|
controlsOpacity}"
|
||||||
controlsPosition="{controlsPosition}"
|
controlsPosition="{controlsPosition}"
|
||||||
widthVideoContainer="{widthVideoContainer}"
|
widthVideoContainer="{widthVideoContainer}"
|
||||||
heightVideoContainer="{heightVideoContainer}"
|
heightVideoContainer="{heightVideoContainer}"
|
||||||
|
|
@ -196,9 +197,9 @@
|
||||||
bind:paused
|
bind:paused
|
||||||
bind:clientWidth="{widthVideo}"
|
bind:clientWidth="{widthVideo}"
|
||||||
bind:clientHeight="{heightVideo}"
|
bind:clientHeight="{heightVideo}"
|
||||||
style="{showControls
|
style="{showControls ?
|
||||||
? 'position: relative'
|
'position: relative' :
|
||||||
: 'position: relative'}"
|
'position: relative'}"
|
||||||
>
|
>
|
||||||
<track kind="captions" />
|
<track kind="captions" />
|
||||||
</video>
|
</video>
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,9 @@
|
||||||
|
<!-- @component `Visible` [Read the docs.](https://reuters-graphics.github.io/graphics-components/?path=/docs/components-Visible--default) -->
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { onMount } from 'svelte';
|
import { onMount } from 'svelte';
|
||||||
/**
|
/**
|
||||||
* Whether to change visibility just once.
|
* Whether to change visibility just once.
|
||||||
*
|
*
|
||||||
* Useful for loading expensive images or other media and then keeping them around once they're first loaded.
|
* Useful for loading expensive images or other media and then keeping them around once they're first loaded.
|
||||||
*/
|
*/
|
||||||
export let once: boolean = false;
|
export let once: boolean = false;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue