Skip to content

Releases: designcise/next-theme-toggle

v4.0.0

30 Jan 20:42
8431d01
Compare
Choose a tag to compare

Breaking Changes:

  • Added getColorByThemeType()
  • Added getThemeByColor()
  • Added a default storage key to ThemeProvider
  • Added 'use client' directive to client exports
  • Renamed flipThemeByColor() to getFlippedThemeColor()
  • Renamed getTheme() to getThemeByKey()
  • Removed getColorByTheme()
  • Removed color and colors 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 of tsc and ts-jest

v3.0.1

10 Dec 01:07
dcec742
Compare
Choose a tag to compare

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 on prefers-color-scheme

v3.0.0

10 Dec 00:39
Compare
Choose a tag to compare

Breaking Changes:

  • Added a distinction between colors and themes
  • Updated defaultTheme prop to default to themes.auto
  • Updated context with theme (as active theme), color (as active color), themes (as object with supported themes), and color (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 on prefers-color-scheme and undefined 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 and matchMedia.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 to theme.helper.js
  • Added flipThemeByColor()
  • Added prettier
  • Updated inline script in AntiFlickerScript
  • Moved device.mock.js to __tests__/mocks folder
  • Moved isServer() to env.helper.js
  • Renamed applyPreference() to applyTheme()
  • Renamed setPreference() to saveTheme()
  • Renamed getPreference() to getTheme()

v2.0.0

09 Dec 09:46
9124809
Compare
Choose a tag to compare

Breaking Changes:

  • Use localStorage instead of cookies
  • Added defaultTheme prop to ThemeProvider
  • Added defaultTheme and storageKey props to AntiFlickerScript
  • Added defaultPref as function argument to getPreference()
  • Removed theme prop from ThemeProvider

Other Changes:

  • Added new tests
  • Updated inline script in AntiFlickerScript
  • Renamed device.helper.js to device.mock.js in __tests__
  • Updated README

v1.1.1

30 Nov 21:44
Compare
Choose a tag to compare
  • Fixed window is not defined error caused by getPreference() function
  • Added Html component for automatically applying theme className and color-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 to ThemeProvider to dis/allow automatic injection of inline script to prevent flicker
  • Added more tests
  • Moved getColor() to color.helper.js
  • Moved ThemeProvider and ThemeContext 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 generic storage.adapter

v1.0.3

26 Nov 22:53
Compare
Choose a tag to compare
  • Added rollup for transpiling scripts
  • Moved index.js to src/
  • Updated package.json with build directives
  • Added React peerDependencies to package.json

v1.0.2

26 Nov 18:45
Compare
Choose a tag to compare
  • 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

26 Nov 17:58
Compare
Choose a tag to compare
chore: bump up version to 1.0.1