feat(guide): ✨ add styled-components theme augmentation
Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
This commit is contained in:
parent
bdce983786
commit
bdb8b1cb12
4 changed files with 70 additions and 0 deletions
|
|
@ -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'
|
||||
}
|
||||
|
||||
|
|
|
|||
31
public/games/age-of-dwarves/guide/src/styled-components-augmentation.d.ts
vendored
Normal file
31
public/games/age-of-dwarves/guide/src/styled-components-augmentation.d.ts
vendored
Normal file
|
|
@ -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<ThemeInterface, 'colors'> {
|
||||
colors: ThemeInterface['colors'] & {
|
||||
flora: {
|
||||
canopy: string
|
||||
undergrowth: string
|
||||
fungi: string
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
19
public/games/age-of-elves/guide/src/styled-components-augmentation.d.ts
vendored
Normal file
19
public/games/age-of-elves/guide/src/styled-components-augmentation.d.ts
vendored
Normal file
|
|
@ -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<ThemeInterface, 'colors'> {
|
||||
colors: ThemeInterface['colors'] & {
|
||||
flora: {
|
||||
canopy: string
|
||||
undergrowth: string
|
||||
fungi: string
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
19
public/games/age-of-kzzkyt/guide/src/styled-components-augmentation.d.ts
vendored
Normal file
19
public/games/age-of-kzzkyt/guide/src/styled-components-augmentation.d.ts
vendored
Normal file
|
|
@ -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<ThemeInterface, 'colors'> {
|
||||
colors: ThemeInterface['colors'] & {
|
||||
flora: {
|
||||
canopy: string
|
||||
undergrowth: string
|
||||
fungi: string
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue