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 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 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: { 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();