@reuters-graphics/graphics-components 3.10.0 → 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.
Files changed (85) hide show
  1. package/dist/components/Analytics/GTM.svelte.d.ts +3 -3
  2. package/dist/components/BlogPost/BlogPost.svelte +6 -5
  3. package/dist/components/BlogPost/BlogPost.svelte.d.ts +3 -2
  4. package/dist/components/BlogPost/CopyLink.svelte +7 -4
  5. package/dist/components/BlogPost/CopyLink.svelte.d.ts +5 -2
  6. package/dist/components/BlogPost/PostHeadline.svelte +7 -4
  7. package/dist/components/BlogPost/PostHeadline.svelte.d.ts +5 -2
  8. package/dist/components/BlogPost/utils.d.ts +2 -1
  9. package/dist/components/BlogPost/utils.js +8 -2
  10. package/dist/components/BlogTOC/BlogTOC.svelte +7 -4
  11. package/dist/components/BlogTOC/BlogTOC.svelte.d.ts +8 -5
  12. package/dist/components/BlogTOC/TOCList.svelte.d.ts +3 -3
  13. package/dist/components/Headpile/Headpile.svelte +2 -2
  14. package/dist/components/Headpile/Headpile.svelte.d.ts +2 -2
  15. package/dist/components/LanguageButton/LanguageButton.svelte +10 -7
  16. package/dist/components/LanguageButton/LanguageButton.svelte.d.ts +5 -2
  17. package/dist/components/SEO/SEO.svelte.d.ts +3 -3
  18. package/dist/components/Video/Video.svelte +2 -2
  19. package/dist/llm-docs/components/AdSlot.md +11 -0
  20. package/dist/llm-docs/components/Analytics.md +89 -0
  21. package/dist/llm-docs/components/Article.md +183 -0
  22. package/dist/llm-docs/components/BeforeAfter.md +170 -0
  23. package/dist/llm-docs/components/BioBox.md +74 -0
  24. package/dist/llm-docs/components/Block.md +211 -0
  25. package/dist/llm-docs/components/BlogPost.md +66 -0
  26. package/dist/llm-docs/components/BlogTOC.md +89 -0
  27. package/dist/llm-docs/components/BodyText.md +143 -0
  28. package/dist/llm-docs/components/Byline.md +242 -0
  29. package/dist/llm-docs/components/ClockWall.md +48 -0
  30. package/dist/llm-docs/components/DatawrapperChart.md +87 -0
  31. package/dist/llm-docs/components/DocumentCloud.md +47 -0
  32. package/dist/llm-docs/components/EmbedPreviewerLink.md +35 -0
  33. package/dist/llm-docs/components/EndNotes.md +79 -0
  34. package/dist/llm-docs/components/FeaturePhoto.md +102 -0
  35. package/dist/llm-docs/components/Framer.md +44 -0
  36. package/dist/llm-docs/components/Geocoder.md +49 -0
  37. package/dist/llm-docs/components/GraphicBlock.md +319 -0
  38. package/dist/llm-docs/components/Headline.md +248 -0
  39. package/dist/llm-docs/components/Headpile.md +55 -0
  40. package/dist/llm-docs/components/HeroHeadline.md +515 -0
  41. package/dist/llm-docs/components/HorizontalScroller.md +523 -0
  42. package/dist/llm-docs/components/InfoBox.md +196 -0
  43. package/dist/llm-docs/components/KinesisLogo.md +34 -0
  44. package/dist/llm-docs/components/LanguageButton.md +170 -0
  45. package/dist/llm-docs/components/Legend.md +251 -0
  46. package/dist/llm-docs/components/Lottie.md +464 -0
  47. package/dist/llm-docs/components/PaddingReset.md +78 -0
  48. package/dist/llm-docs/components/PhotoPack.md +238 -0
  49. package/dist/llm-docs/components/PymChild.md +49 -0
  50. package/dist/llm-docs/components/ReferralBlock.md +119 -0
  51. package/dist/llm-docs/components/ReutersGraphicsLogo.md +37 -0
  52. package/dist/llm-docs/components/ReutersLogo.md +35 -0
  53. package/dist/llm-docs/components/SEO.md +113 -0
  54. package/dist/llm-docs/components/Scroller.md +350 -0
  55. package/dist/llm-docs/components/ScrollerBase.md +104 -0
  56. package/dist/llm-docs/components/ScrollerVideo.md +576 -0
  57. package/dist/llm-docs/components/SearchInput.md +44 -0
  58. package/dist/llm-docs/components/ShareBar.md +78 -0
  59. package/dist/llm-docs/components/SimpleTimeline.md +141 -0
  60. package/dist/llm-docs/components/SiteFooter.md +77 -0
  61. package/dist/llm-docs/components/SiteHeader.md +55 -0
  62. package/dist/llm-docs/components/SiteHeadline.md +111 -0
  63. package/dist/llm-docs/components/Spinner.md +43 -0
  64. package/dist/llm-docs/components/Table.md +298 -0
  65. package/dist/llm-docs/components/Theme.md +266 -0
  66. package/dist/llm-docs/components/TileMap.md +477 -0
  67. package/dist/llm-docs/components/ToolsHeader.md +46 -0
  68. package/dist/llm-docs/components/Video.md +254 -0
  69. package/dist/llm-docs/components/Visible.md +54 -0
  70. package/dist/llm-docs/components/cssVariables.md +40 -0
  71. package/dist/llm-docs/components/index.md +59 -0
  72. package/dist/llm-docs/components/resizeObserver.md +21 -0
  73. package/dist/llm-docs/guides/archieml.md +406 -0
  74. package/dist/llm-docs/guides/colours.md +443 -0
  75. package/dist/llm-docs/guides/customising-with-scss.md +61 -0
  76. package/dist/llm-docs/guides/graphics-kit.md +25 -0
  77. package/dist/llm-docs/guides/index.md +16 -0
  78. package/dist/llm-docs/guides/intro.md +21 -0
  79. package/dist/llm-docs/guides/layout.md +13 -0
  80. package/dist/llm-docs/guides/llm-docs.md +71 -0
  81. package/dist/llm-docs/guides/styles.md +16 -0
  82. package/dist/llm-docs/guides/theming.md +100 -0
  83. package/dist/llm-docs/guides/tokens.md +150 -0
  84. package/dist/llm-docs/index.md +36 -0
  85. package/package.json +18 -24
@@ -0,0 +1,100 @@
1
+ # CSS variables
2
+
3
+ The [`Theme`](?path=/docs/components-theme--default) component uses **[CSS variables](https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_custom_properties)** to control major parts of your page's theme.
4
+
5
+ All other components in this library use those variables for styling basic colours and typography, helping keep our pages uniform and making it easier to customise the theme. CSS variables also allow our clients to easily change elements of our theme to match their brand.
6
+
7
+ This doc explains which variables are set and how you can use them in custom components you create.
8
+
9
+ > **Note:** CSS variables do not currently affect [ai2svelte](https://github.com/reuters-graphics/ai2svelte/) graphics, so you should continue to make sure your colours match the theme of your page directly in Adobe Illustrator for those graphics.
10
+
11
+ ## Using CSS variables directly
12
+
13
+ If you're new to how CSS variables work, [here's a video](https://www.youtube.com/watch?v=PHO6TBq_auI) that does a decent job explaining what they are, how they work and why they're useful.
14
+
15
+ You can use any of the CSS variables the `Theme` component sets in your own code with the [`var()`](https://www.w3schools.com/css/css3_variables.asp) function.
16
+
17
+ ```svelte
18
+ <p>My custom text</p>
19
+
20
+ <style lang="scss">
21
+ p {
22
+ color: var(--theme-colour-text-primary);
23
+ font-family: var(--theme-font-family-sans-serif);
24
+ }
25
+ </style>
26
+ ```
27
+
28
+ ## Customising variables
29
+
30
+ You can redefine any of the above CSS variables in the `<Theme>` component. Read more in [the docs](/docs/theming-theme--custom-theme) and **use the [Theme builder](/docs/theming-theme-builder--docs)**.
31
+
32
+ ```svelte
33
+ <Theme
34
+ base="light"
35
+ theme={{
36
+ colour: {
37
+ // This replaces the default text-secondary colour '#666666' for light theme
38
+ 'text-secondary': '#213310',
39
+ },
40
+ }}
41
+ >
42
+ <!-- page stuff -->
43
+ </Theme>
44
+ ```
45
+
46
+ ## Adding extra variables
47
+
48
+ You can even add custom variables through the `Theme` component.
49
+
50
+ For example, let's say you want to define a border radius for some card elements on your page. You can add a custom property to the `theme` prop like this:
51
+
52
+ ```svelte
53
+ <Theme
54
+ base="light"
55
+ theme={{
56
+ style: {
57
+ 'border-radius': '22px',
58
+ },
59
+ }}
60
+ >
61
+ <!-- page stuff -->
62
+ </Theme>
63
+ ```
64
+
65
+ ... and then access the CSS variable in your code like this:
66
+
67
+ ```svelte
68
+ <div class="card"></div>
69
+
70
+ <style lang="scss">
71
+ .card {
72
+ border-radius: var(--theme-style-border-radius);
73
+ }
74
+ </style>
75
+ ```
76
+
77
+ Using the `Theme` component for your own CSS variables helps unify important style values across a project. It also lets clients more easily customise those values for whatever matches their brand.
78
+
79
+ You can also change a variable's value based on some condition. For example, to set a smaller border radius on mobile screens, you might:
80
+
81
+ ```svelte
82
+ <script>
83
+ // other code
84
+
85
+ let windowWidth;
86
+ </script>
87
+
88
+ <svelte:window bind:innerWidth={windowWidth} />
89
+
90
+ <Theme
91
+ base="light"
92
+ theme={{
93
+ style: {
94
+ 'border-radius': windowWidth > 475 ? '22px' : '11px',
95
+ },
96
+ }}
97
+ >
98
+ <!-- page stuff -->
99
+ </Theme>
100
+ ```
@@ -0,0 +1,150 @@
1
+ # Style Tokens
2
+
3
+ Import the main SCSS to access all token classes:
4
+
5
+ ```scss
6
+ @use '@reuters-graphics/graphics-components/scss/main';
7
+ ```
8
+
9
+ ## Spacing
10
+
11
+ Static spacing uses the Tailwind scale: 1 unit = 0.25rem. So `.m-4` = 1rem, `.m-8` = 2rem, `.my-6` = 1.5rem block margin.
12
+
13
+ ### Static margin
14
+
15
+ | Prefix | Property |
16
+ |--------|---------|
17
+ | `m-{n}` | margin (all sides) |
18
+ | `mt-{n}` | margin-block-start (top) |
19
+ | `mb-{n}` | margin-block-end (bottom) |
20
+ | `ml-{n}` | margin-inline-start (left) |
21
+ | `mr-{n}` | margin-inline-end (right) |
22
+ | `mx-{n}` | margin-inline (left + right) |
23
+ | `my-{n}` | margin-block (top + bottom) |
24
+
25
+ Available levels and their values:
26
+
27
+ | Level | Value |
28
+ |-------|-------|
29
+ | `0` | `0` |
30
+ | `0\.5` | `0.125rem` |
31
+ | `1` | `0.25rem` |
32
+ | `1\.5` | `0.375rem` |
33
+ | `2` | `0.5rem` |
34
+ | `2\.5` | `0.625rem` |
35
+ | `3` | `0.75rem` |
36
+ | `3\.5` | `0.875rem` |
37
+ | `4` | `1rem` |
38
+ | `5` | `1.25rem` |
39
+ | `6` | `1.5rem` |
40
+ | `7` | `1.75rem` |
41
+ | `8` | `2rem` |
42
+ | `9` | `2.25rem` |
43
+ | `10` | `2.5rem` |
44
+ | `11` | `2.75rem` |
45
+ | `12` | `3rem` |
46
+ | `14` | `3.5rem` |
47
+ | `16` | `4rem` |
48
+ | `20` | `5rem` |
49
+ | `24` | `6rem` |
50
+ | `28` | `7rem` |
51
+ | `32` | `8rem` |
52
+ | `36` | `9rem` |
53
+ | `40` | `10rem` |
54
+ | `44` | `11rem` |
55
+ | `48` | `12rem` |
56
+ | `52` | `13rem` |
57
+ | `56` | `14rem` |
58
+ | `60` | `15rem` |
59
+ | `64` | `16rem` |
60
+ | `72` | `18rem` |
61
+ | `80` | `20rem` |
62
+ | `96` | `24rem` |
63
+
64
+ ### Static padding
65
+
66
+ Same scale as margin. Prefixes:
67
+
68
+ | Prefix | Property |
69
+ |--------|---------|
70
+ | `p-{n}` | padding (all sides) |
71
+ | `pt-{n}` | padding-block-start (top) |
72
+ | `pb-{n}` | padding-block-end (bottom) |
73
+ | `pl-{n}` | padding-inline-start (left) |
74
+ | `pr-{n}` | padding-inline-end (right) |
75
+ | `px-{n}` | padding-inline (left + right) |
76
+ | `py-{n}` | padding-block (top + bottom) |
77
+
78
+ ### Fluid margin
79
+
80
+ Fluid values scale with viewport width. Use SCSS `@extend` to apply: `@extend %fmy-4;`. Direct utility classes are also available for levels 0–9.
81
+
82
+ | Class | Properties |
83
+ |-------|------------|
84
+ | `.fm-1` | `margin: clamp(0.31rem, 0.31rem + 0vw, 0.31rem);` |
85
+ | `.fm-2` | `margin: clamp(0.56rem, 0.52rem + 0.21vw, 0.69rem);` |
86
+ | `.fm-3` | `margin: clamp(0.88rem, 0.83rem + 0.21vw, 1rem);` |
87
+ | `.fm-4` | `margin: clamp(1.13rem, 1.06rem + 0.31vw, 1.31rem);` |
88
+ | `.fm-5` | `margin: clamp(1.69rem, 1.58rem + 0.52vw, 2rem);` |
89
+ | `.fm-6` | `margin: clamp(2.25rem, 2.13rem + 0.63vw, 2.63rem);` |
90
+ | `.fm-7` | `margin: clamp(3.38rem, 3.19rem + 0.94vw, 3.94rem);` |
91
+ | `.fm-8` | `margin: clamp(4.5rem, 4.25rem + 1.25vw, 5.25rem);` |
92
+ | `.fm-9` | `margin: clamp(6.75rem, 6.38rem + 1.88vw, 7.88rem);` |
93
+
94
+ ### Fluid padding
95
+
96
+ Same scale as fluid margin. Prefix `fp` instead of `fm`.
97
+
98
+ | Class | Properties |
99
+ |-------|------------|
100
+ | `.fp-1` | `padding: clamp(0.31rem, 0.31rem + 0vw, 0.31rem);` |
101
+ | `.fp-2` | `padding: clamp(0.56rem, 0.52rem + 0.21vw, 0.69rem);` |
102
+ | `.fp-3` | `padding: clamp(0.88rem, 0.83rem + 0.21vw, 1rem);` |
103
+ | `.fp-4` | `padding: clamp(1.13rem, 1.06rem + 0.31vw, 1.31rem);` |
104
+ | `.fp-5` | `padding: clamp(1.69rem, 1.58rem + 0.52vw, 2rem);` |
105
+ | `.fp-6` | `padding: clamp(2.25rem, 2.13rem + 0.63vw, 2.63rem);` |
106
+ | `.fp-7` | `padding: clamp(3.38rem, 3.19rem + 0.94vw, 3.94rem);` |
107
+ | `.fp-8` | `padding: clamp(4.5rem, 4.25rem + 1.25vw, 5.25rem);` |
108
+ | `.fp-9` | `padding: clamp(6.75rem, 6.38rem + 1.88vw, 7.88rem);` |
109
+
110
+ ## Typography
111
+
112
+ ### Font size
113
+
114
+ | Class | Properties |
115
+ |-------|------------|
116
+ | `.text-xxs` | `font-size: var(--theme-font-size-xxs);` |
117
+ | `.text-xs` | `font-size: var(--theme-font-size-xs);` |
118
+ | `.text-sm` | `font-size: var(--theme-font-size-sm);` |
119
+ | `.text-base` | `font-size: var(--theme-font-size-base);` |
120
+ | `.text-lg` | `font-size: var(--theme-font-size-lg);` |
121
+ | `.text-xl` | `font-size: var(--theme-font-size-xl);` |
122
+ | `.text-2xl` | `font-size: var(--theme-font-size-2xl);` |
123
+ | `.text-3xl` | `font-size: var(--theme-font-size-3xl);` |
124
+ | `.text-4xl` | `font-size: var(--theme-font-size-4xl);` |
125
+ | `.text-5xl` | `font-size: var(--theme-font-size-5xl);` |
126
+ | `.text-6xl` | `font-size: var(--theme-font-size-6xl);` |
127
+
128
+ ### Font weight
129
+
130
+ | Class | Properties |
131
+ |-------|------------|
132
+ | `.font-thin` | `font-weight: 100;` |
133
+ | `.font-extralight` | `font-weight: 200;` |
134
+ | `.font-light` | `font-weight: 300;` |
135
+ | `.font-regular` | `font-weight: 400;` |
136
+ | `.font-medium` | `font-weight: 500;` |
137
+ | `.font-semibold` | `font-weight: 600;` |
138
+ | `.font-bold` | `font-weight: 700;` |
139
+ | `.font-extrabold` | `font-weight: 800;` |
140
+ | `.font-black` | `font-weight: 900;` |
141
+
142
+ ### Line height
143
+
144
+ | Class | Properties |
145
+ |-------|------------|
146
+ | `.leading-tighter` | `line-height: 1.15;` |
147
+ | `.leading-tight` | `line-height: 1.3;` |
148
+ | `.leading-normal` | `line-height: 1.5;` |
149
+ | `.leading-loose` | `line-height: 1.7;` |
150
+ | `.leading-looser` | `line-height: 1.9;` |
@@ -0,0 +1,36 @@
1
+ # @reuters-graphics/graphics-components
2
+
3
+ A Svelte 5 component library built by the Graphics team at Reuters for producing data journalism and interactive graphics. Components cover page layout, text elements, multimedia, maps, data visualisation, and site infrastructure — all designed to match the visual and structural conventions of enterprise stories published on reuters.com.
4
+
5
+ The library ships with a full SCSS design system: spacing tokens, typography utilities, a colour palette, and CSS custom properties for theming via the `Theme` component.
6
+
7
+ **Install:** `pnpm add @reuters-graphics/graphics-components`
8
+
9
+ **Import components:**
10
+
11
+ ```svelte
12
+ <script>
13
+ import {
14
+ BodyText,
15
+ Legend,
16
+ ShareBar,
17
+ } from '@reuters-graphics/graphics-components';
18
+ </script>
19
+ ```
20
+
21
+ **Import SCSS:**
22
+
23
+ ```scss
24
+ @use '@reuters-graphics/graphics-components/scss/main';
25
+ ```
26
+
27
+ ---
28
+
29
+ ## This reference
30
+
31
+ - **[Components](./components/index.md)** — Per-component docs with props tables, TypeScript type definitions, and usage examples extracted from Storybook stories.
32
+ - **[Guides](./guides/index.md)** — Integration guides, design system reference, theming, SCSS tokens, and colour palettes.
33
+
34
+ To find a specific component, start with `./components/index.md` for the full list, then open the individual component file. To understand the design system (spacing, colours, typography), start with `./guides/index.md`.
35
+
36
+ These docs are automatically generated from components' code structure, SCSS files and also from human-friendly documentation written using Storybook's MDX and Component Story Format syntax.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reuters-graphics/graphics-components",
3
- "version": "3.10.0",
3
+ "version": "4.0.0",
4
4
  "type": "module",
5
5
  "private": false,
6
6
  "homepage": "https://reuters-graphics.github.io/graphics-components",
@@ -26,29 +26,23 @@
26
26
  "!dist/**/images"
27
27
  ],
28
28
  "engines": {
29
- "node": ">=20.18"
29
+ "node": "^20.19.0 || >=22.12.0"
30
30
  },
31
31
  "peerDependencies": {
32
32
  "svelte": "^5.0.0"
33
33
  },
34
34
  "devDependencies": {
35
35
  "@changesets/cli": "^2.29.2",
36
- "@chromatic-com/storybook": "^3.2.6",
36
+ "@chromatic-com/storybook": "^5.2.1",
37
37
  "@reuters-graphics/yaks-eslint": "^0.1.1",
38
38
  "@reuters-graphics/yaks-prettier": "^0.1.1",
39
- "@storybook/addon-a11y": "^8.6.12",
40
- "@storybook/addon-essentials": "^8.6.12",
41
- "@storybook/addon-interactions": "^8.6.12",
42
- "@storybook/addon-svelte-csf": "5.0.0-next.28",
43
- "@storybook/blocks": "^8.6.12",
44
- "@storybook/components": "^8.6.12",
45
- "@storybook/manager-api": "^8.6.12",
46
- "@storybook/svelte": "^8.6.12",
47
- "@storybook/sveltekit": "^8.6.12",
48
- "@storybook/test": "^8.6.12",
49
- "@storybook/theming": "^8.6.12",
50
- "@sveltejs/package": "^2.3.11",
51
- "@sveltejs/vite-plugin-svelte": "^5.0.3",
39
+ "@storybook/addon-a11y": "^10.4.6",
40
+ "@storybook/addon-docs": "^10.4.6",
41
+ "@storybook/addon-svelte-csf": "5.1.2",
42
+ "@storybook/svelte": "^10.4.6",
43
+ "@storybook/sveltekit": "^10.4.6",
44
+ "@sveltejs/package": "^2.5.8",
45
+ "@sveltejs/vite-plugin-svelte": "^7.1.3",
52
46
  "@types/css": "^0.0.37",
53
47
  "@types/eslint": "^9.6.1",
54
48
  "@types/fs-extra": "^11.0.4",
@@ -69,7 +63,7 @@
69
63
  "eslint": "^9.25.0",
70
64
  "eslint-plugin-mdx": "^3.4.0",
71
65
  "eslint-plugin-react": "^7.37.5",
72
- "eslint-plugin-storybook": "^0.12.0",
66
+ "eslint-plugin-storybook": "^10.4.6",
73
67
  "knip": "^5.50.5",
74
68
  "mermaid": "^10.9.3",
75
69
  "postcss": "^8.5.3",
@@ -87,22 +81,22 @@
87
81
  "remark-stringify": "^11.0.0",
88
82
  "rimraf": "^6.0.1",
89
83
  "sass": "^1.86.3",
90
- "storybook": "^8.6.12",
91
- "svelte": "^5.28.1",
92
- "svelte-check": "^4.1.6",
84
+ "storybook": "^10.4.6",
85
+ "svelte": "^5.56.4",
86
+ "svelte-check": "^4.7.1",
93
87
  "ts-morph": "^28.0.0",
94
88
  "tsx": "^4.22.4",
95
89
  "typescript": "^5.8.3",
96
90
  "unified": "^11.0.5",
97
91
  "unist-util-visit": "^5.1.0",
98
- "vite": "^6.3.2"
92
+ "vite": "^8.1.3"
99
93
  },
100
94
  "dependencies": {
101
95
  "@fortawesome/free-regular-svg-icons": "^6.7.2",
102
96
  "@fortawesome/free-solid-svg-icons": "^6.7.2",
103
97
  "@lottiefiles/dotlottie-web": "^0.52.2",
104
98
  "@reuters-graphics/svelte-markdown": "^0.0.3",
105
- "@sveltejs/kit": "^2.0.0",
99
+ "@sveltejs/kit": "^2.69.1",
106
100
  "@types/geojson": "^7946.0.16",
107
101
  "dayjs": "^1.11.13",
108
102
  "es-toolkit": "^1.35.0",
@@ -113,11 +107,11 @@
113
107
  "proper-url-join": "^2.1.2",
114
108
  "pym.js": "^1.3.2",
115
109
  "slugify": "^1.6.6",
116
- "storybook-addon-rtl": "^1.1.0",
110
+ "storybook-addon-rtl": "^3.0.2",
117
111
  "svelte-fa": "^4.0.4",
118
112
  "svelte-intersection-observer": "^1.0.0",
119
113
  "ua-parser-js": "^2.0.3",
120
- "vitest": "^3.2.4"
114
+ "vitest": "^4.1.10"
121
115
  },
122
116
  "exports": {
123
117
  ".": {