Releases: designcise/next-theme-toggle
Releases · designcise/next-theme-toggle
v4.0.0
Breaking Changes:
- Added
getColorByThemeType() - Added
getThemeByColor() - Added a default storage key to
ThemeProvider - Added
'use client'directive toclientexports - Renamed
flipThemeByColor()togetFlippedThemeColor() - Renamed
getTheme()togetThemeByKey() - Removed
getColorByTheme() - Removed
colorandcolorsfrom context and provider
Other Changes:
- Added TypeScript support
- Added more tests and updated old ones
- Updated
AntiFlickerScript - Updated
tsconfig - Updated docs
- Removed rollup and
babel*packages in favor oftscandts-jest
v3.0.1
Fixed default theme logic in the AntiFlickerScript inline script as follows:
- Default theme is only considered when no preferred theme is stored in
localStorage - If theme (one of preferred theme or default theme) is empty or
auto, then theme color is determined based onprefers-color-scheme
v3.0.0
Breaking Changes:
- Added a distinction between
colorsandthemes - Updated
defaultThemeprop to default tothemes.auto - Updated context with
theme(as active theme),color(as active color),themes(as object with supported themes), andcolor(as object with supported colors) - Removed
colorsfrom server-side and client-side package - Removed
getColors()
Other Changes:
- Added
'auto'theme - Added
themesfor server-side and client-side components - Added
colors.autooption that automatically determines color scheme based onprefers-color-schemeandundefinedfor server - Added feature to automatically update theme if
prefers-color-schemechanges - Added feature to automatically switch to the opposite color from whatever color is set by
'auto'mode - Added
localStorage.mock.jsandmatchMedia.mock.js - Added
ThemeAutoColorcomponent for tests - Added tests for functions in
theme.helper.js - Added tests for the
'auto'option - Added new tests + updated old ones
- Added
colorsobject totheme.helper.js - Added
flipThemeByColor() - Added prettier
- Updated inline script in
AntiFlickerScript - Moved
device.mock.jsto__tests__/mocksfolder - Moved
isServer()toenv.helper.js - Renamed
applyPreference()toapplyTheme() - Renamed
setPreference()tosaveTheme() - Renamed
getPreference()togetTheme()
v2.0.0
Breaking Changes:
- Use
localStorageinstead of cookies - Added
defaultThemeprop toThemeProvider - Added
defaultThemeandstorageKeyprops toAntiFlickerScript - Added
defaultPrefas function argument togetPreference() - Removed
themeprop fromThemeProvider
Other Changes:
- Added new tests
- Updated inline script in
AntiFlickerScript - Renamed
device.helper.jstodevice.mock.jsin__tests__ - Updated
README
v1.1.1
- Fixed
window is not definederror caused bygetPreference()function - Added
Htmlcomponent for automatically applying themeclassNameandcolor-scheme - Added three different ways to avoid flicker on load in the quick start section of the docs
- Added
isServer()function in local scope of theme helper file - Added
autoAntiFlickerprop toThemeProviderto dis/allow automatic injection of inline script to prevent flicker - Added more tests
- Moved
getColor()tocolor.helper.js - Moved
ThemeProviderandThemeContextto context folder - Created client/server config for two different exports
getColor()is accessible on server side with an import from@designcise/next-theme-toggle/server- Exported code is now in ES modules format instead of CommonJS
- Refactored
cookie.helperto a more genericstorage.adapter
v1.0.3
- Added rollup for transpiling scripts
- Moved
index.jstosrc/ - Updated
package.jsonwith build directives - Added React
peerDependenciestopackage.json
v1.0.2
- Fixed
Module parse failed: Unexpected token (11:11) You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file.issue caused by wrapping script code in an anonymous function in the anti-flicker script. - Moved anit-flicker script to its own file,
AntiFlickerScript.jsx.
v1.0.1
chore: bump up version to 1.0.1