SCAL-336941 add UpdateTheme host event - #697
Open
harshitbhardwaj-ts wants to merge 1 commit into
Open
harshitbhardwaj-ts wants to merge 1 commit into
harshitbhardwaj-ts wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request introduces the HostEvent.UpdateTheme event, allowing the embed to switch between dark appearance and its default appearance dynamically without reloading. It adds the UpdateThemeRequest interface, updates the HostEventRequestMap, handles the event in TsEmbed to persist the applied theme state in viewConfig.isDarkMode, and exports the new types. Comprehensive unit tests and JSDoc documentation with examples have also been added. There are no review comments, and we have no feedback to provide.
commit: |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
HostEvent.UpdateTheme, which switches an open embed between dark appearance and its default appearance without reloading it. Follows theisDarkModeoption from #672.Changes
HostEvent.UpdateTheme(wire value'UpdateTheme') with payloadUpdateThemeRequest { isDarkMode: boolean }. It is typed inHostEventRequestMap, exported from the package and the React entry, andadded to the contract guardrail lists.
{ isDarkMode: true }. Whendark appearance is not available in the embed, the embed does not change and
the promise rejects with an error message.
trigger()stores the value inviewConfig.isDarkMode. A later render or pre-render show then sends itinstead of the value the embed loaded with.
Testing
ts-embed.spec.ts: the reply, the kept appearance, and the rejection.