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 toclient
exports - Renamed
flipThemeByColor()
togetFlippedThemeColor()
- Renamed
getTheme()
togetThemeByKey()
- Removed
getColorByTheme()
- Removed
color
andcolors
from 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 oftsc
andts-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
colors
andthemes
- Updated
defaultTheme
prop 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
colors
from server-side and client-side package - Removed
getColors()
Other Changes:
- Added
'auto'
theme - Added
themes
for server-side and client-side components - Added
colors.auto
option that automatically determines color scheme based onprefers-color-scheme
andundefined
for server - Added feature to automatically update theme if
prefers-color-scheme
changes - Added feature to automatically switch to the opposite color from whatever color is set by
'auto'
mode - Added
localStorage.mock.js
andmatchMedia.mock.js
- Added
ThemeAutoColor
component for tests - Added tests for functions in
theme.helper.js
- Added tests for the
'auto'
option - Added new tests + updated old ones
- Added
colors
object totheme.helper.js
- Added
flipThemeByColor()
- Added prettier
- Updated inline script in
AntiFlickerScript
- Moved
device.mock.js
to__tests__/mocks
folder - Moved
isServer()
toenv.helper.js
- Renamed
applyPreference()
toapplyTheme()
- Renamed
setPreference()
tosaveTheme()
- Renamed
getPreference()
togetTheme()
v2.0.0
Breaking Changes:
- Use
localStorage
instead of cookies - Added
defaultTheme
prop toThemeProvider
- Added
defaultTheme
andstorageKey
props toAntiFlickerScript
- Added
defaultPref
as function argument togetPreference()
- Removed
theme
prop fromThemeProvider
Other Changes:
- Added new tests
- Updated inline script in
AntiFlickerScript
- Renamed
device.helper.js
todevice.mock.js
in__tests__
- Updated
README
v1.1.1
- Fixed
window is not defined
error caused bygetPreference()
function - Added
Html
component for automatically applying themeclassName
andcolor-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
autoAntiFlicker
prop toThemeProvider
to dis/allow automatic injection of inline script to prevent flicker - Added more tests
- Moved
getColor()
tocolor.helper.js
- Moved
ThemeProvider
andThemeContext
to 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.helper
to a more genericstorage.adapter
v1.0.3
- Added rollup for transpiling scripts
- Moved
index.js
tosrc/
- Updated
package.json
with build directives - Added React
peerDependencies
topackage.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