From bdb8b1cb127aae36b8b40c4b6e63636b02c157ba Mon Sep 17 00:00:00 2001 From: Natalie Date: Sat, 18 Apr 2026 05:39:27 -0700 Subject: [PATCH] =?UTF-8?q?feat(guide):=20=E2=9C=A8=20add=20styled-compone?= =?UTF-8?q?nts=20theme=20augmentation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Lilith Autocommit --- .../age-of-dwarves/guide/src/ambient.d.ts | 1 + .../src/styled-components-augmentation.d.ts | 31 +++++++++++++++++++ .../src/styled-components-augmentation.d.ts | 19 ++++++++++++ .../src/styled-components-augmentation.d.ts | 19 ++++++++++++ 4 files changed, 70 insertions(+) create mode 100644 public/games/age-of-dwarves/guide/src/styled-components-augmentation.d.ts create mode 100644 public/games/age-of-elves/guide/src/styled-components-augmentation.d.ts create mode 100644 public/games/age-of-kzzkyt/guide/src/styled-components-augmentation.d.ts diff --git a/public/games/age-of-dwarves/guide/src/ambient.d.ts b/public/games/age-of-dwarves/guide/src/ambient.d.ts index 8310bb22..7782f21a 100644 --- a/public/games/age-of-dwarves/guide/src/ambient.d.ts +++ b/public/games/age-of-dwarves/guide/src/ambient.d.ts @@ -75,3 +75,4 @@ declare module '@/public/resources/*' { declare module '@magic-civ/guide-engine/components/climate-sim/polarHexGrid.js' { export * from '@magic-civ/guide-engine/components/climate-sim/polarHexGrid' } + diff --git a/public/games/age-of-dwarves/guide/src/styled-components-augmentation.d.ts b/public/games/age-of-dwarves/guide/src/styled-components-augmentation.d.ts new file mode 100644 index 00000000..a27de6dc --- /dev/null +++ b/public/games/age-of-dwarves/guide/src/styled-components-augmentation.d.ts @@ -0,0 +1,31 @@ +// Augments the `DefaultTheme` provided by `@lilith/ui-theme` with the +// race-independent flora palette injected at build time by +// `src/packages/guide/src/theme/buildTheme.ts`. Biome/ecology views read +// these as `theme.colors.flora.canopy | undergrowth | fungi`. +// +// This file is a module (has an `import`), so the `declare module` block +// performs declaration merging — NOT an ambient module re-declaration. +// Keep it separate from `ambient.d.ts` which is a pure ambient file and +// must stay import-free to register its `declare module '@magic-civ/...'` +// blocks globally. + +import 'styled-components' +import type { ThemeInterface } from '@lilith/ui-theme' + +// `@lilith/ui-theme` sets `DefaultTheme extends ThemeInterface {}`. `colors` +// is declared there as an inline object literal (not a named interface), so +// standard interface merging can't add `flora` into it. We instead redeclare +// `DefaultTheme` here with an intersection that adds `colors.flora` while +// preserving every other field of `ThemeInterface` (primary/text/etc.). +// Runtime injection happens in `src/packages/guide/src/theme/buildTheme.ts`. +declare module 'styled-components' { + interface DefaultTheme extends Omit { + colors: ThemeInterface['colors'] & { + flora: { + canopy: string + undergrowth: string + fungi: string + } + } + } +} diff --git a/public/games/age-of-elves/guide/src/styled-components-augmentation.d.ts b/public/games/age-of-elves/guide/src/styled-components-augmentation.d.ts new file mode 100644 index 00000000..ae547e14 --- /dev/null +++ b/public/games/age-of-elves/guide/src/styled-components-augmentation.d.ts @@ -0,0 +1,19 @@ +// Augments the `DefaultTheme` provided by `@lilith/ui-theme` with the +// race-independent flora palette injected at build time by +// `src/packages/guide/src/theme/buildTheme.ts`. Biome/ecology views read +// these as `theme.colors.flora.canopy | undergrowth | fungi`. + +import 'styled-components' +import type { ThemeInterface } from '@lilith/ui-theme' + +declare module 'styled-components' { + interface DefaultTheme extends Omit { + colors: ThemeInterface['colors'] & { + flora: { + canopy: string + undergrowth: string + fungi: string + } + } + } +} diff --git a/public/games/age-of-kzzkyt/guide/src/styled-components-augmentation.d.ts b/public/games/age-of-kzzkyt/guide/src/styled-components-augmentation.d.ts new file mode 100644 index 00000000..ae547e14 --- /dev/null +++ b/public/games/age-of-kzzkyt/guide/src/styled-components-augmentation.d.ts @@ -0,0 +1,19 @@ +// Augments the `DefaultTheme` provided by `@lilith/ui-theme` with the +// race-independent flora palette injected at build time by +// `src/packages/guide/src/theme/buildTheme.ts`. Biome/ecology views read +// these as `theme.colors.flora.canopy | undergrowth | fungi`. + +import 'styled-components' +import type { ThemeInterface } from '@lilith/ui-theme' + +declare module 'styled-components' { + interface DefaultTheme extends Omit { + colors: ThemeInterface['colors'] & { + flora: { + canopy: string + undergrowth: string + fungi: string + } + } + } +}