Releases: palcarazm/bs-darkmode-toggle
Release list
v1.1.0
ℹ️ What's Changed
🆕 Added
-
Dark Mode Debug Monitoring - Introduces a global debug monitor singleton (
DarkModeMonitor) that logsdarkmode:changeevents at DEBUG level for easier troubleshooting.- Exposes
window.Darkmode.MONITORin both jQuery and ECMAScript builds. - implements #66 by @palcarazm in
60ffc03
- Exposes
-
Configurable ARIA Labels for Accessibility - Adds
lightAriaLabelanddarkAriaLabeloptions to set descriptive text for the toggle's state, improving screen reader support. Labels update dynamically when the theme changes.- Defaults: "Switch to dark mode" and "Switch to light mode".
- implements #65 by @palcarazm in
6f99280
-
Complete Instance Cleanup (
destroyAPI) - Adds adestroy()method to completely remove a plugin instance, its DOM elements, and event listeners.- Prevents memory leaks and allows for safe re-initialization.
- implements #64 by @palcarazm in
7a0d54e
-
Cross-Instance Synchronization - Multiple toggle instances on the same page now automatically synchronize their visual state when the theme changes. A single global state is shared via
darkmode:changeevents.- implements #60 by @palcarazm in
c43c584
- implements #60 by @palcarazm in
-
Custom
darkmode:changeEvent - Dispatches a rich custom event on both the toggle element and all root elements. The event detail containsisLight,theme,source, androots.- implements #63 by @palcarazm in
6ab39f6
- implements #63 by @palcarazm in
🔁 Changed
-
Refactored to Extend
component-lifecycleLibrary - TheDarkModeToggleclass now extendsComponent<"darkmode">, delegating lifecycle management (initialization, attachment, disposal, destruction) to the library's deterministic state machine. Replaces manual_destroyedflag.- Public API surface remains unchanged.
- implements #92 by @palcarazm in
25a41fd
-
Refactored Event System - Replaced manual event managers with the
Component's nativeemit()andEventFactory. Events now use proper typing viaExtendableEventMapand include runtime validation for external events.- by @palcarazm in
a4bc275
- by @palcarazm in
-
Refactored Root Element Handling - Changed root element selection from a static, constructor-time choice to a dynamic runtime query. This ensures that elements added or removed from the DOM after initialization are always accurately reflected.
- by @palcarazm in
5dd5beb
- by @palcarazm in
-
Centralized Theme String Derivation - The theme string (e.g., "light" or "dark") is now calculated once within the
StateReducer, rather than being derived via duplicate ternary operations across multiple files. This reduces coupling and improves consistency.- by @palcarazm in
25c9321
- by @palcarazm in
-
Migrated Build Toolchain from Grunt to Rollup - Removed all Grunt dependencies and implemented a modern build system with npm scripts and Rollup. This provides better performance, modern distribution outputs (CJS, ESM, TypeScript types), and improved maintainability.
- by @palcarazm in
ebb048c
- by @palcarazm in
-
Refactored
StateReducerAction Handling - TheOVERRIDEaction now includes runtime validation to ensure it receives a correctly-formatted payload, preventing crashes from malformed external events.- by @palcarazm in
8831855
- by @palcarazm in
-
Refactored Bootstrap Toggle Integration - Switched from a custom local
RENDERERmethod to the officialMethods.RERENDERfrom thebootstrap5-togglepackage for better compatibility.- fixes #89 by @palcarazm in
ec5cec2
- fixes #89 by @palcarazm in
-
Renamed Cypress Config File - Renamed
cypress.config.jstocypress.config.cjsto resolve a module type mismatch that was causing pipeline failures.- by @palcarazm in
5b955fc
- by @palcarazm in
-
Updated ARIA Label Handling -
ToggleLayoutnow only callsrerenderwhen the ARIA label changes, improving performance.- by @palcarazm in
6f99280
- by @palcarazm in
✅ Fixed
-
Cancel Initialization on Storage Error - Prevents the plugin from initializing if a storage error occurs (e.g., when localStorage is unavailable or full). The initialization is cancelled with a clear, explicit reason instead of falling back to system preferences.
- fixes #97 by @palcarazm in
dfa64d3
- fixes #97 by @palcarazm in
-
Add Guard Clause for Malformed Payload in
StateReducer.OVERRIDE- Adds a runtime check to prevent crashes when theOVERRIDEaction receives an undefined, null, or malformed payload. The action now safely returns false.- fixes #96 by @palcarazm in
8831855
- fixes #96 by @palcarazm in
-
Fixed Unreadable Footer in Dark Mode - The documentation site's footer background color has been updated to ensure it is readable in dark mode.
- by @palcarazm in
c43c584
- by @palcarazm in
-
Removed Unused Imports - Cleaned up an unused import to satisfy code quality checks.
- by @palcarazm in
c43c584
- by @palcarazm in
🆙 Dependencies, CI/CD, and Others
- Dependency updates:
@commitlint/clifrom20.5.3to21.0.2@commitlint/config-conventionalfrom20.5.3to21.0.2commitlintfrom20.5.3to21.0.2bootstrap5-toggle(for docs) from5.3.0to5.3.3
- GitHub Actions updates:
actions/upload-pages-artifactfrom3to4(and then4to5)actions/setup-nodefrom3to6actions/deploy-pagesfrom4to5actions/checkoutfrom3to6actions/configure-pagesfrom5to6cypress-io/github-actionfrom7.1.9to7.1.10(and then to7.3.0)SonarSource/sonarqube-scan-actionfrom7.1.0to8.0.0
- CI/CD improvements:
- Added Dependabot configuration for version updates in the docs directory.
Full Changelog: v1.0.0...v1.1.0
v1.0.0
ℹ️ What's Changed
🆕 Added
- Native Button Layout - Added a new layout option that creates a native Bootstrap 5 button instead of the bootstrap-toggle slider component, reducing external dependencies and bundle size.
- implements #61 by @palcarazm in 8239220.
- SVG Icons for Toggle - Replaced default text labels with SVG icons (sun/moon) using CSS mask-image technique, including built-in variants for light/dark mode.
- implements #67 by @palcarazm in 5bedb20.
- Local Storage Support - Replaced cookie-only persistence with a flexible storage system supporting multiple providers (cookie, localStorage, none).
- implements #62 by @palcarazm in 73d81aa.
- System Color Scheme Preference - Implemented automatic detection of the user's operating system color scheme preference as a fallback when no saved state exists.
- implements #59 by @palcarazm in ca96ec8.
- Extended Bootstrap 5 Button Styles - Extended the
styleoption to support all Bootstrap 5 button variants (solid and outline).- implements #58 by @palcarazm in 3229c8d.
🔁 Changed
- Complete TypeScript Rewrite - Rewrote the entire library in TypeScript with a modular architecture for better maintainability and type safety.
- implements #46 by @palcarazm in 5bc9ca5.
- Refactored Test Architecture - Restructured the test app and Cypress E2E tests into a modular, maintainable architecture using Page Object pattern.
- Related to #61 by @palcarazm in e9057bd.
- Updated Build Target - Changed TypeScript target from ES5 to ES2016 for modern browser support.
- Related to #52 by @palcarazm in 52b8f76.
✅ Fixed
- SonarQube Issues - Fixed multiple code quality issues including unsafe type checks, incorrect DOM access patterns, and accessibility concerns.
- jQuery Initialization Error - Fixed an error where the jQuery plugin failed to load correctly in some environments.
- by @palcarazm in 6efbfa5.
- Double Change Event - Fixed an issue where the change event was fired twice on action performed.
- by @palcarazm in 293718f.
- CWE-79 and CWE-116 - Fixed Cross-Site Scripting (XSS) vulnerabilities by refactoring sanitization of data-attributes and options.
- by @palcarazm in 48255a9.
🆙 Dependencies management, CI/CD and Others
- Dependency updates:
typescriptfrom5.9.3to6.0.2@rollup/plugin-terserfrom0.4.4to1.0.0cypress-plugin-tabfrom1.0.5to2.0.0@types/jqueryfrom3.5.34to4.0.0jqueryfrom3.6.3to3.7.0dompurifyfrom2.4.1to3.0.3bootstrapfrom5.3.0-alpha1to5.3.0-alpha3bootstrap5-togglefrom5.0.4to5.0.6cypressfrom12.2.0to12.12.0gruntfrom1.5.3to1.6.1
- GitHub Actions updates:
actions/upload-artifactfrom6to7actions/download-artifactfrom7to8cypress-io/github-actionfrom7.1.2to7.1.9SonarSource/sonarqube-scan-actionfrom7.0.0to7.1.0
- CI/CD improvements:
- Updated docs deployment to trigger on version tags or manually.
- Added Sonar coverage exclusion patterns for config files.
- Refactored Gruntfile and Rollup configurations for better build process.
- Added PostCSS build pipeline to process and minify CSS.
- Updated GitHub workflows, issue templates, and PR templates.
Full Changelog: v1.0.0-rc1...v1.0.0
v1.0.0-rc1
ℹ️ What's Changed
🆕 Added
- New CI/CD pipeline with parallel build, unit tests, e2e tests, and coverage reporting (Coveralls, SonarCloud, CodeQL).
- by @palcarazm
- in commits across
.github/workflows/ci.yml
- New issue templates for bug reports and feature requests.
- by @palcarazm
- in
.github/ISSUE_TEMPLATE/01-BUG_REPORT.ymland02-FEATURE_REQUEST.yml
- New pull request template.
- by @palcarazm
- in
.github/PULL_REQUEST_TEMPLATE.md
- Integrated Dependabot for NPM and GitHub Actions with grouped updates.
- by @palcarazm
- in
.github/dependabot.yml
- Added Git hooks with Husky for linting, building, and testing on commit/push.
- by @palcarazm
- in
.husky/
- Full TypeScript rewrite of the core plugin logic.
- by @palcarazm
- in
src/main/ts/
- Unit tests with Jest for all core modules (StateReducer, OptionResolver, DOMBuilder, CookieManager, Tools).
- by @palcarazm
- in
src/test/ts/
- End-to-end tests with Cypress using a custom test application.
- by @palcarazm
- in
cypress/andtest/
- Official documentation site with GitHub Pages deployment.
- by @palcarazm
- in
docs/
- New build system using Rollup and Grunt tasks for TypeScript compilation and bundling.
- by @palcarazm
- in
rollup.config.jsandGruntfile.cjs
- Added ESLint and Commitlint for code and commit message consistency.
- by @palcarazm
- in
eslint.config.jsandcommitlint.config.js
- SonarCloud project configuration for static analysis.
- by @palcarazm
- in
sonar-project.properties
🔁 Changed
- Migrated from JavaScript to TypeScript for better maintainability and type safety.
- by @palcarazm
- in
src/main/ts/
- Replaced UglifyJS with Rollup & Terser for minification.
- by @palcarazm
- in
rollup.config.jsandGruntfile.cjs
- Default labels changed from sun/moon SVGs to plain text ("Light"/"Dark").
- by @palcarazm
- in
src/main/ts/core/OptionResolver.tsandREADME.md
- Improved sanitization logic for labels and attributes to prevent XSS.
- by @palcarazm
- in
src/main/ts/core/Tools.ts
- Updated Bootstrap peer dependency to
>=5.3.0 <6.- by @palcarazm
- in
package.json
- Updated jQuery optional dependency to
^4.0.0.- by @palcarazm
- in
package.json
- Refactored state management into a dedicated
StateReducerclass.- by @palcarazm
- in
src/main/ts/core/StateReducer.ts
- Refactored cookie handling into a
CookieManagerclass.- by @palcarazm
- in
src/main/ts/core/CookieManager.ts
- Refactored DOM manipulation into a
DOMBuilderclass.- by @palcarazm
- in
src/main/ts/core/DOMBuilder.ts
- Updated test application to use new test structure and remove DOMPurify dependency.
- by @palcarazm
- in
test/
✅ Fixed
- Fixed issue where cookie was not being properly deleted when denied.
- by @palcarazm
- in
src/main/ts/DarkModeToggle.tsandsrc/main/ts/core/CookieManager.ts
- Fixed event propagation so change event fires correctly from the toggle element.
- by @palcarazm
- in
src/main/ts/DarkModeToggle.ts
- Fixed silent mode for
light,dark, andtogglemethods to prevent event triggering.- by @palcarazm
- in
src/main/ts/DarkModeToggle.ts
- Fixed XSS vulnerability in label rendering by implementing HTML sanitization.
- by @palcarazm
- in
src/main/ts/core/Tools.ts
- Fixed data attribute naming to use kebab-case (e.g.,
data-light-labelinstead ofdata-lightLabel).- by @palcarazm
- in
src/main/ts/core/OptionResolver.tsandtest/
- Fixed root element not updating correctly when custom root is specified.
- by @palcarazm
- in
src/main/ts/core/DOMBuilder.ts
🆙 Bump
- Updated Node.js versions in CI to 22.x and 24.x.
- Updated GitHub Actions to latest versions (
checkout@v6,setup-node@v6,upload-artifact@v7, etc.). - Updated Cypress to
^15.8.1. - Updated Jest to
^30.2.0. - Updated TypeScript to
^5.9.3. - Updated various dev dependencies including ESLint, Rollup, and Grunt plugins.
- Updated Bootstrap to
5.3.8in documentation. - Updated FontAwesome to
7.2.0in documentation.
Full Changelog: v1.0.0-alpha2...v1.0.0-rc1
v1.0.0-alpha2
What's Changed
Initial release
Full Changelog: https://github.com/palcarazm/bs-darkmode-toggle/commits/v1.0.0-alpha2