Skip to content

v1.1.0#86

Draft
palcarazm wants to merge 21 commits intov1from
develop/1.1.0
Draft

v1.1.0#86
palcarazm wants to merge 21 commits intov1from
develop/1.1.0

Conversation

@palcarazm
Copy link
Copy Markdown
Owner

No description provided.

palcarazm and others added 17 commits April 8, 2026 08:59
Bumps [actions/configure-pages](https://github.com/actions/configure-pages) from 5 to 6.
- [Release notes](https://github.com/actions/configure-pages/releases)
- [Commits](actions/configure-pages@v5...v6)

---
updated-dependencies:
- dependency-name: actions/configure-pages
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 6.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](actions/checkout@v3...v6)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Bumps [actions/deploy-pages](https://github.com/actions/deploy-pages) from 4 to 5.
- [Release notes](https://github.com/actions/deploy-pages/releases)
- [Commits](actions/deploy-pages@v4...v5)

---
updated-dependencies:
- dependency-name: actions/deploy-pages
  dependency-version: '5'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Bumps [actions/setup-node](https://github.com/actions/setup-node) from 3 to 6.
- [Release notes](https://github.com/actions/setup-node/releases)
- [Commits](actions/setup-node@v3...v6)

---
updated-dependencies:
- dependency-name: actions/setup-node
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
- Add theme property to DarkModeState interface
- Calculate theme string in StateReducer using getTheme() method
- Pass lightColorMode and darkColorMode to StateReducer constructor
- Update persistState() to persist state.theme directly
- Update DOM update methods to use state.theme for root elements
- Remove lightColorMode/darkColorMode from AbstractLayout
- Rename update() to syncState() and persistState() to persistTheme() for clarity

This change eliminates duplicate ternary operations across multiple files
(isLight ? lightColorMode : darkColorMode) by deriving the theme string
once within the state reducer. The DOM layer now receives a complete
state object containing both the boolean flag and the resolved theme
string, reducing coupling between components.
…ns/configure-pages-6

ci(deps): bump actions/configure-pages from 5 to 6
…ns/checkout-6

ci(deps): bump actions/checkout from 3 to 6
…ns/deploy-pages-5

ci(deps): bump actions/deploy-pages from 4 to 5
Bumps [actions/upload-pages-artifact](https://github.com/actions/upload-pages-artifact) from 3 to 4.
- [Release notes](https://github.com/actions/upload-pages-artifact/releases)
- [Commits](actions/upload-pages-artifact@v3...v4)

---
updated-dependencies:
- dependency-name: actions/upload-pages-artifact
  dependency-version: '4'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
…ns/setup-node-6

ci(deps): bump actions/setup-node from 3 to 6
…ns/upload-pages-artifact-4

ci(deps): bump actions/upload-pages-artifact from 3 to 4
- Add EventManager class to centralize event dispatching logic
- Dispatch darkmode:change event with detail containing isLight, theme, source, and roots
- Dispatch event on both toggle element and all configured root elements
- Preserve backward compatibility by continuing to dispatch legacy 'change' event
- Respect silent parameter by suppressing all events when true
- Cache root elements on initialization for better performance
- Add comprehensive unit tests for EventManager
- Update E2E tests to verify both change and darkmode:change events
- Add documentation page with interactive example

Implements #63
Changed root element handling from constructor-time static selection to
runtime dynamic querying via getter methods. This ensures newly added
or removed DOM elements are always reflected.

- AbstractLayout: replaced `root` property with `rootSelector` string and
  added `roots` getter that re-queries DOM on each access
- DomManager: added `roots` getter that delegates to layout.roots
- EventManager: changed from storing static root array to accepting a
  roots function, called fresh on each dispatch
- DarkModeToggle: reordered initialization to pass dom.roots function
  instead of static root selector string

The previous implementation only captured elements that existed at
construction time. Dynamic queries allow the toggle to work correctly
when root elements are added or removed after initialization.
- Disabled screenshot capture on test failure in Cypress config to reduce CI artifacts
- Removed unnecessary 500ms wait in TestAppPage reset method

The hardcoded wait was redundant as Cypress automatically retries assertions.
Removing it improves test execution speed without affecting reliability.
)

* feat: implement cross-instance synchronization for multiple toggles

Add event-based coordination so multiple toggle instances on the same page
share a single global state. When one toggle changes the theme, all other
toggles automatically update their visual state.

- Add OVERRIDE action to StateReducer for external state updates
- Each instance listens for darkmode:change events on document
- Sync only when ALL root elements are affected by the event
- Update DOM without retriggering storage or events
- Add unit tests for root sharing, partial overlap, and state matching
- Add manual test case for multi-control verification in test app

Implements #60

* fix: remove this unused import of 'TEST_CONSTANTS'

Unnecessary imports should be removed javascript:S1128
Change to bg-body-secondary color class.
Previous bg-light was unreadable on dark mode.
@coveralls
Copy link
Copy Markdown

coveralls commented Apr 8, 2026

Coverage Status

coverage: 98.859% (+0.7%) from 98.182% — develop/1.1.0 into v1

Add destroy() method that completely removes the plugin instance:
- Remove global document event listener for cross-instance sync
- Destroy DOM layout (button or toggle) and remove control elements
- Delete _bsDarkmodeToggle reference from host element
- Add _destroyed flag and ensureNotDestroyed() guard method
- All public methods throw error when called on destroyed instance

Implementation details:
- ButtonLayout: remove click listener and button element
- ToggleLayout: call bootstrapToggle("destroy") then remove input
- DomManager delegates destroy() to layout implementation
- jQuery and ECMAScript wrappers expose DESTROY method
- E2E tests verify container is emptied but color scheme preserved
- Unit tests cover idempotency, error throwing, and cleanup chain

Implements #64
Add lightAriaLabel and darkAriaLabel options with defaults
"Switch to dark mode" and "Switch to light mode". These labels
dynamically update when theme changes to describe the action that
will be performed.

- Add lightAriaLabel and darkAriaLabel to DarkModeOptions and
  ResolvedOptions
- Update OptionResolver to read from data-light-aria-label and
  data-dark-aria-label attributes
- Implement getAriaLabel() in AbstractLayout for centralized
  label resolution
- Update ButtonLayout to set aria-label on state change
- Update ToggleLayout to set aria-label and call rerender only
  when label changes (performance optimization)
- Add unit tests for ARIA label resolution and dynamic updates
- Add documentation with custom ARIA label feature example

Implements #65
Replaced local BootstrapToggleMethods.RENDERER (uppercase) with
Methods.RERENDER from the external package. The local enum relied on
case-insensitive matching to work with the documented 'rerender'
string, which was undocumented behavior.

Upgraded bootstrap5-toggle to ^5.3.3 and updated rollup.config.js
to properly externalize the dependency with global name
'BootstrapToggle', resolving runtime module resolution issues.

Fixes #89
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud bot commented Apr 9, 2026

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants