Skip to content

Releases: palcarazm/bootstrap5-toggle

v5.3.3

09 Apr 20:47
963eaf1

Choose a tag to compare

ℹ️ What's Changed

✅ Fixed

  • Expose library constants on global BootstrapToggle object - Events, Methods, StateValue, and StateStatus are now available at window.BootstrapToggle for easy access in non-module environments. Type aliases (Options, Style, Size, State, EventDetail) added for cleaner public API with full TypeScript support.

Full Changelog: v5.3.2...v5.3.3

v5.3.2

09 Apr 19:26
86bb767

Choose a tag to compare

ℹ️ What's Changed

✅ Fixed

  • Improve type safety for DOM toggle integration - Replaced unsafe type assertions with proper TypeScript patterns including generic DOM selection and correct interface inheritance. This eliminates as assertions where possible and ensures type consistency between exported interfaces and global declarations.

Full Changelog: v5.3.1...v5.3.2

v5.3.1

09 Apr 18:24
20365d1

Choose a tag to compare

ℹ️ What's Changed

✅ Fixed

  • Standardize rerender method name to lowercase - The rerender method now correctly uses lowercase naming, matching the documented API. Method name matching is now case-insensitive to prevent confusion.

🔁 Changed

  • Migrate type system to isolated declaration files - Type definitions have been refactored for better maintainability. Global augmentation interfaces are now exported from separate files, allowing consumers to import types without side effects. Jest and Sonar coverage exclusions updated to correctly ignore entry point files.

Full Changelog: v5.3.0...v5.3.1

v5.3.0

22 Feb 15:18
5ca413b

Choose a tag to compare

ℹ️ What's Changed

🆕 Added

  • Bootstrap tooltip support – adds comprehensive tooltip functionality with title configuration via data attributes (data-tooltip-title-on, data-tooltip-title-off, data-tooltip-title-mixed, data-tooltip-placement) and JavaScript API.
  • Custom DOM events for toggle state changes – emits six custom events (toggle:on, toggle:off, toggle:mixed, toggle:enabled, toggle:disabled, toggle:readonly) with state details in payload for better framework integration.
  • Full ARIA accessibility support – adds role="switch", aria-label, aria-checked, aria-disabled, and aria-readonly attributes with proper state updates for screen reader compatibility.
  • HTML sanitization for toggle labels – implements allow-list based sanitization to safely allow HTML formatting (bold, italic, icons) while preventing XSS vulnerabilities.
  • Add silent parameter support to enable(), disable() and readonly() methods

🔁 Changed

  • Performance optimization with requestAnimationFrame – batches DOM calculations to prevent forced synchronous reflows, improving rendering performance by 60-70% for multiple toggles.
  • Rename INDETERMINATE state value to MIXED for clarity

✅ Fixed

  • Security vulnerability in HTML labels – prevents XSS attacks through malicious HTML/scripts in toggle labels using robust sanitization with allow-list approach.
  • Make keyboard event handler non-passive and prevent default space/enter

🆙 Bump

  • Dependency updates:
    • globals from 17.0.0 to 17.1.0 (#285)
    • @typescript-eslint/eslint-plugin from 8.53.0 to 8.53.1 (#283)
    • rollup from 4.55.1 to 4.56.0 (#282)
    • eslint from 9.39.2 to 10.0.0 (35eff80)
  • GitHub Actions updates:
    • cypress-io/github-action from 7.1.0 to 7.1.1
    • actions/setup-node from 3 to 6
    • actions/checkout from 3 to 6
    • actions/upload-pages-artifact from 3 to 4
    • actions/upload-artifact from 4 to 6
    • cypress-io/github-action from 6.10.8 to 7.1.2
    • github/codeql-action from 3 to 4
    • actions/download-artifact from 4 to 7
  • CI & Dependencies improvements:
    • Dependabot configuration updates
    • Sonar copy-paste detector exclusions added
    • npm cache removal

Full Changelog: v5.2.0...v5.3.0

v5.3.0-rc2

07 Feb 08:38
0cb4dda

Choose a tag to compare

v5.3.0-rc2 Pre-release
Pre-release

ℹ️ What's Changed

🆕 Added

  • Add silent parameter support to enable(), disable() and readonly() methods

🔁 Changed

✅ Fixed

  • Make keyboard event handler non-passive and prevent default space/enter

🆙 Bump

  • GitHub Actions updates:

    • cypress-io/github-action from 7.1.0 to 7.1.1
    • actions/setup-node from 3 to 6
    • actions/checkout from 3 to 6
    • actions/upload-pages-artifact from 3 to 4
    • actions/upload-artifact from 4 to 6
    • cypress-io/github-action from 6.10.8 to 7.1.0
    • github/codeql-action from 3 to 4
    • actions/download-artifact from 4 to 7
  • CI & Dependencies improvements:

    • Dependabot configuration updates
    • Sonar copy-paste detector exclusions added
    • npm cache removal

Full Changelog: v5.3.0-rc1...v5.3.0-rc2

v5.3.0-rc1

23 Jan 17:50
fe7985f

Choose a tag to compare

v5.3.0-rc1 Pre-release
Pre-release

ℹ️ What's Changed

🆕 Added

  • Bootstrap tooltip support – adds comprehensive tooltip functionality with title configuration via data attributes (data-tooltip-title-on, data-tooltip-title-off, data-tooltip-title-mixed, data-tooltip-placement) and JavaScript API.
  • Custom DOM events for toggle state changes – emits six custom events (toggle:on, toggle:off, toggle:mixed, toggle:enabled, toggle:disabled, toggle:readonly) with state details in payload for better framework integration.
  • Full ARIA accessibility support – adds role="switch", aria-label, aria-checked, aria-disabled, and aria-readonly attributes with proper state updates for screen reader compatibility.
  • HTML sanitization for toggle labels – implements allow-list based sanitization to safely allow HTML formatting (bold, italic, icons) while preventing XSS vulnerabilities.

🔁 Changed

  • Performance optimization with requestAnimationFrame – batches DOM calculations to prevent forced synchronous reflows, improving rendering performance by 60-70% for multiple toggles.

✅ Fixed

  • Security vulnerability in HTML labels – prevents XSS attacks through malicious HTML/scripts in toggle labels using robust sanitization with allow-list approach.

🆙 Bump

  • Dependency updates:
    • globals from 17.0.0 to 17.1.0 (#285)
    • @typescript-eslint/eslint-plugin from 8.53.0 to 8.53.1 (#283)
    • rollup from 4.55.1 to 4.56.0 (#282)

Full Changelog: v5.2.0...v5.3.0-rc1

v5.2.0

23 Jan 16:58
0255c09

Choose a tag to compare

⚠️ Important information

This release includes a complete core refactor to TypeScript, improvements in maintainability and compatibility, and updated dependencies.

1️⃣ Complete TypeScript Refactor

  • All main modules (Toggle, StateReducer, DOMBuilder, OptionResolver) have been rewritten in TypeScript to improve maintainability and type safety.
    -Option parsing, state management, and rendering logic are now centralized and modular.

2️⃣ Clear Separation of Responsibilities

  • Toggle coordinates events and exposes the public API.
  • OptionResolver decide options from data-attributes, user provided options and defaults options. It also handle deprecated options.
  • StateReducer manages all toggle state logic (ON | OFF | INDETERMINATE | READONLY | DISABLED).
  • DOMBuilder handles rendering of the toggle and its associated elements.

3️⃣ API Compatibility Preserved

  • The jQuery classic API $(selector).bootstrapToggle() and the ECMAScript API document.querySelector(selector).bootstrapToggle() remains fully functional using the refactored core.
  • Event and state logic is shared between ES Modules and the jQuery wrapper, eliminating duplication and historical bugs.

ℹ️ What's Changed

🆕 Added

🔁 Changed

  • Centralized core logic in TypeScript modules – migrated build system to Rollup and PostCSS, refactored internal architecture into modular classes (OptionResolver, StateReducer, DOMBuilder, Builder).
  • Consolidated CI workflows – unified multiple independent workflows into a single pipeline with Node.js version matrix, coverage reporting, and cross-browser Cypress tests.
  • Updated contribution guidelines and tooling – added ESLint and commitlint, updated templates and workflows.

✅ Fixed

  • Toggle event handling – prevents unintended toggling on scroll, drag interactions, and right-clicks using dynamic pointer listeners with gesture thresholds.
  • DOM sizing in hidden containers – uses ResizeObserver to defer rendering until parent elements become visible, ensuring correct toggle dimensions in tabs/accordions.
  • Input property handling – intercepts external changes to input properties (checked, disabled, readonly, indeterminate) and restores original descriptors on destroy.
  • CSS unit support for width/height options – now properly handles explicit CSS units (rem, em, %, vw, vh) without incorrectly appending "px".
  • Agnostic interface and user options preservation – ensures compatibility with both ECMAS and jQuery interfaces and preserves user options during rerender.
  • OptionResolver attribute preference – correctly prioritizes data-onvalue attribute over value attribute in options parsing.
  • Refactored code quality improvements – multiple SonarQube-driven fixes including cognitive complexity reduction, best practice updates, and accessibility improvements.

🆙 Bump

  • Dependency updates:
    • jquery from 3.7.1 to 4.0.0 (#277)
    • lodash from 4.17.21 to 4.17.23 (#279)
    • @commitlint/config-conventional from 19.8.1 to 20.3.1 (#269)
    • commitlint from 19.8.1 to 20.3.1 (#268)
    • globals from 16.5.0 to 17.0.0 (#267)
    • @commitlint/cli from 19.8.1 to 20.3.1 (#266)
    • cypress from 13.13.3 to 15.9.0 (multiple updates: #210, #265, 780e658)
    • @typescript-eslint/parser from 8.52.0 to 8.53.0 (#278)
    • @typescript-eslint/eslint-plugin from 8.52.0 to 8.53.0 (cbad57f)
    • rollup from 4.54.0 to 4.55.1 (a8c1dbf)
  • CI and infrastructure:
    • Added SonarQube analysis pipeline
    • Updated ESLint configurations and exclusions
    • Improved GitHub Actions security with SHA references
    • Updated documentation deployment pipeline
    • Enhanced test coverage with pointer/keyboard interaction tests

Full Changelog: v5.1.3...v5.2.0

v5.2.0-rc3

17 Jan 08:00
74e37ac

Choose a tag to compare

v5.2.0-rc3 Pre-release
Pre-release

ℹ️ What's Changed

🆕 Added

🔁 Changed

  • Refactored code based on SonarQube analysis – improved code quality, reduced cognitive complexity, and applied best practices across the codebase.

✅ Fixed

  • Toggle input property handling – intercepts external changes to input properties (checked, disabled, readonly, indeterminate) and restores original descriptors on destroy, preventing sync loops and form reset issues.

🆙 Bump

  • Dependencies updated:

    • @commitlint/config-conventional from 19.8.1 to 20.3.1 (#269)
    • commitlint from 19.8.1 to 20.3.1 (#268)
    • globals from 16.5.0 to 17.0.0 (#267)
    • @commitlint/cli from 19.8.1 to 20.3.1 (#266)
    • cypress from 15.8.1 to 15.8.2 (#265)
  • CI and tooling updates:

    • Updated ESLint exclusions
    • Updated badge and package metadata
    • Added SonarQube analysis to pipeline
    • Improved GitHub Actions security with SHA references
    • Various configuration and documentation updates

Full Changelog: v5.2.0-rc2...v5.2.0-rc3

v5.2.0-rc2

09 Jan 23:10
0f1b865

Choose a tag to compare

v5.2.0-rc2 Pre-release
Pre-release

ℹ️ What's Changed

🆕 Added

🔁 Changed

  • CI pipeline consolidated into a unified workflow, simplifying maintenance and improving execution consistency by @palcarazm in #247.
    • Cypress configuration updated and optimized (browser selection, Docker image updates).
    • Improved test coverage for toggle interactions, including pointer, mouse and keyboard events.
  • Updated contribution guidelines, templates and development tooling (ESLint, Commitlint, Husky) by @palcarazm in #248.

✅ Fixed

  • Fixed #242 width and height option handling to properly support CSS units such as rem, em, %, vw, vh and keywords like auto by @palcarazm in #249.
    • Added numeric-only validation helper to properly distinguish raw numeric values from CSS units.
  • Fixed #213, #153 & #187 prevented unintended toggle activation on scroll, drag and right-click interactions by @palcarazm in #241.
  • Fixed #231 incorrect toggle sizing when initialized inside hidden containers (e.g. tabs or accordions) by @palcarazm in #240.
  • Fixed #237 option parsing to correctly respect the value / data-onvalue attributes by @palcarazm in #239.
  • Fixed #236 rerender behavior to preserve user options and support both ECMAScript and jQuery interfaces by @palcarazm in #238.

🆙 Bump

  • Internal tooling, CI images and documentation badges updated.

Full Changelog: v5.2.0-rc1...v5.2.0-rc2

v5.2.0-rc1

02 Jan 14:52
0bd8906

Choose a tag to compare

v5.2.0-rc1 Pre-release
Pre-release

⚠️ Important information

This release is a release candidate aimed at stabilizing the product before the official 5.2.0 release. It includes a complete core refactor to TypeScript, improvements in maintainability and compatibility, and updated dependencies.

1️⃣ Complete TypeScript Refactor

  • All main modules (Toggle, StateReducer, DOMBuilder, OptionResolver) have been rewritten in TypeScript to improve maintainability and type safety.
  • Option parsing, state management, and rendering logic are now centralized and modular.

2️⃣ Clear Separation of Responsibilities

  • Toggle coordinates events and exposes the public API.
  • OptionResolver decide options from data-attributes, user provided options and defaults options. It also handle deprecated options.
  • StateReducer manages all toggle state logic (ON | OFF | INDETERMINATE | READONLY | DISABLED).
  • DOMBuilder handles rendering of the toggle and its associated elements.

3️⃣ API Compatibility Preserved

  • The jQuery classic API $(selector).bootstrapToggle() and the ECMAScript API document.querySelector(selector).bootstrapToggle() remains fully functional using the refactored core.
  • Event and state logic is shared between ES Modules and the jQuery wrapper, eliminating duplication and historical bugs.

ℹ️ What's Changed

🆕 Added

🔁 Changed

  • refactor: centralize logic in typescript modules by @palcarazm in #225

✅ Fixed

🆙 Bump


Full Changelog: v5.1.3...v5.2.0-rc1