From 8d3e4b50eadb70a1c021615332ebff3b8630860c Mon Sep 17 00:00:00 2001 From: MinamiFunakoshiTR Date: Mon, 14 Jul 2025 10:20:05 -0400 Subject: [PATCH 1/4] renames Theme and CustomTheme types #326 --- src/components/Theme/@types/component.ts | 4 ++-- src/components/Theme/Theme.svelte | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/components/Theme/@types/component.ts b/src/components/Theme/@types/component.ts index 325faed0..74de2bdf 100644 --- a/src/components/Theme/@types/component.ts +++ b/src/components/Theme/@types/component.ts @@ -42,12 +42,12 @@ export interface CustomFont { size?: Partial; } -export interface Theme { +export interface ThemeConfig { colour: Colour; font: Font; } -export interface CustomTheme { +export interface CustomThemeConfig { colour?: Partial; font?: Partial; [customProperty: string]: unknown; diff --git a/src/components/Theme/Theme.svelte b/src/components/Theme/Theme.svelte index 002dfcb7..dbea6cb5 100644 --- a/src/components/Theme/Theme.svelte +++ b/src/components/Theme/Theme.svelte @@ -14,7 +14,7 @@ import mergeThemes from './utils/merge.js'; // Types - import type { CustomTheme, Theme } from './@types/component'; + import type { CustomThemeConfig, ThemeConfig } from './@types/component'; import type { Snippet } from 'svelte'; type Base = 'light' | 'dark'; @@ -22,7 +22,7 @@ /** Custom theme object. Can be a partial theme with just * what you want to change. */ - theme?: CustomTheme | Theme; + theme?: CustomThemeConfig | ThemeConfig; /** * Base theme is one of `light` or `dark` and will be merged * with your custom theme to fill in any values you don't From 18e49eb99cc0401a0b5a157b22353d3e0d892e81 Mon Sep 17 00:00:00 2001 From: MinamiFunakoshiTR Date: Mon, 14 Jul 2025 10:20:17 -0400 Subject: [PATCH 2/4] docs(changeset): renames Theme and CustomTheme types --- .changeset/hungry-tigers-mix.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/hungry-tigers-mix.md diff --git a/.changeset/hungry-tigers-mix.md b/.changeset/hungry-tigers-mix.md new file mode 100644 index 00000000..7cf57661 --- /dev/null +++ b/.changeset/hungry-tigers-mix.md @@ -0,0 +1,5 @@ +--- +'@reuters-graphics/graphics-components': patch +--- + +renames Theme and CustomTheme types From b04435ebaa4cc58e2a96aa4540efa5f7990e13ad Mon Sep 17 00:00:00 2001 From: MinamiFunakoshiTR Date: Mon, 14 Jul 2025 10:25:04 -0400 Subject: [PATCH 3/4] fixes exports to ThemeConfig, CustomThemeConfig in merge.ts --- src/components/Theme/utils/merge.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/Theme/utils/merge.ts b/src/components/Theme/utils/merge.ts index 8e0ebc48..7a90c237 100644 --- a/src/components/Theme/utils/merge.ts +++ b/src/components/Theme/utils/merge.ts @@ -1,4 +1,4 @@ -import type { Theme, CustomTheme } from '../@types/component'; +import type { ThemeConfig, CustomThemeConfig } from '../@types/component'; function isObject(item: unknown): item is Record { return item !== null && typeof item === 'object' && !Array.isArray(item); @@ -9,7 +9,7 @@ function isObject(item: unknown): item is Record { */ export default function merge>( target: T, - ...sources: (Theme | CustomTheme)[] + ...sources: (ThemeConfig | CustomThemeConfig)[] ): T { if (!sources.length) return target; const source = sources.shift(); From 52cbd12ee0460b9ede21c531754997ffb5bffa15 Mon Sep 17 00:00:00 2001 From: MinamiFunakoshiTR Date: Mon, 14 Jul 2025 10:29:47 -0400 Subject: [PATCH 4/4] renames to ThemeConfig in the themes/.js files --- src/components/Theme/themes/common.js | 2 +- src/components/Theme/themes/dark.js | 2 +- src/components/Theme/themes/light.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/Theme/themes/common.js b/src/components/Theme/themes/common.js index ee23e6d0..77bfb736 100644 --- a/src/components/Theme/themes/common.js +++ b/src/components/Theme/themes/common.js @@ -1,4 +1,4 @@ -/** @type {Omit} */ +/** @type {Omit} */ /* Generated from https://www.fluid-type-scale.com/calculate?minFontSize=18&minWidth=320&minRatio=1.125&maxFontSize=21&maxWidth=1280&maxRatio=1.25&steps=xxs%2Cxs%2Csm%2Cbase%2Clg%2Cxl%2C2xl%2C3xl%2C4xl%2C5xl%2C6xl&baseStep=base&prefix=&decimals=2&useRems=on&remValue=16&previewFont=Noto+Sans&previewText=Almost+before+we+knew+it%2C+we+had+left+the+ground&previewWidth=0 */ diff --git a/src/components/Theme/themes/dark.js b/src/components/Theme/themes/dark.js index 96ce7be8..f5d6a334 100644 --- a/src/components/Theme/themes/dark.js +++ b/src/components/Theme/themes/dark.js @@ -1,6 +1,6 @@ import common from './common.js'; -/** @type {import('../@types/component').Theme} */ +/** @type {import('../@types/component').ThemeConfig} */ export default { ...common, colour: { diff --git a/src/components/Theme/themes/light.js b/src/components/Theme/themes/light.js index f7328d24..5749c7b3 100644 --- a/src/components/Theme/themes/light.js +++ b/src/components/Theme/themes/light.js @@ -1,6 +1,6 @@ import common from './common.js'; -/** @type {import('../@types/component').Theme} */ +/** @type {import('../@types/component').ThemeConfig} */ export default { ...common, colour: {