Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

merge new setup into v1 branch #208

Merged
merged 18 commits into from
Aug 28, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix: add explicit undefined type to support exactOptionalPropertyType…
…s option (Port #177) (#201)

add explicit undefined
pacocoursey authored Aug 18, 2023
commit bf074a28a713386ad86e4df56e1731239d8343b5
28 changes: 14 additions & 14 deletions packages/next-themes/src/types.ts
Original file line number Diff line number Diff line change
@@ -6,38 +6,38 @@ export interface UseThemeProps {
/** List of all available theme names */
themes: string[]
/** Forced theme name for the current page */
forcedTheme?: string
forcedTheme?: string | undefined
/** Update the theme */
setTheme: React.Dispatch<React.SetStateAction<string>>
/** Active theme name */
theme?: string
theme?: string | undefined
/** If `enableSystem` is true and the active theme is "system", this returns whether the system preference resolved to "dark" or "light". Otherwise, identical to `theme` */
resolvedTheme?: string
resolvedTheme?: string | undefined
/** If enableSystem is true, returns the System theme preference ("dark" or "light"), regardless what the active theme is */
systemTheme?: 'dark' | 'light'
systemTheme?: 'dark' | 'light' | undefined
}

export interface ThemeProviderProps {
/** List of all available theme names */
themes?: string[]
themes?: string[] | undefined
/** Forced theme name for the current page */
forcedTheme?: string
forcedTheme?: string | undefined
/** Whether to switch between dark and light themes based on prefers-color-scheme */
enableSystem?: boolean
enableSystem?: boolean | undefined
/** Disable all CSS transitions when switching themes */
disableTransitionOnChange?: boolean
disableTransitionOnChange?: boolean | undefined
/** Whether to indicate to browsers which color scheme is used (dark or light) for built-in UI like inputs and buttons */
enableColorScheme?: boolean
enableColorScheme?: boolean | undefined
/** Key used to store theme setting in localStorage */
storageKey?: string
storageKey?: string | undefined
/** Default theme name (for v0.0.12 and lower the default was light). If `enableSystem` is false, the default theme is light */
defaultTheme?: string
defaultTheme?: string | undefined
/** HTML attribute modified based on the active theme. Accepts `class` and `data-*` (meaning any data attribute, `data-mode`, `data-color`, etc.) */
attribute?: string | 'class'
attribute?: string | 'class' | undefined
/** Mapping of theme name to HTML attribute value. Object where key is the theme name and value is the attribute value */
value?: ValueObject
value?: ValueObject | undefined
/** Nonce string to pass to the inline script for CSP headers */
nonce?: string
nonce?: string | undefined

children?: React.ReactNode
}