Add theme/package compatibility engine - #12
Merged
Conversation
IncompatiblePackages/incompatiblePackages and IsCompatible/ isThemeCompatible reuse the exact rule Screenplay's compiler already applies (ValidateThemes): every package a profile declares must be in the theme's compatibleWith list, no implicit exemption for core. Sharing this rule here means Stage's build-time warning and Studio's design-time theme-picker filtering (#5) don't each reimplement it. ApplicablePackages/applicableThemePackages is the renderer-facing half: the packages a profile activates that the theme also declares compatible, which Scene.React scopes token application to rather than applying a theme's tokens globally. Computing it fresh from the current theme/profile pair, rather than caching a resolved result, is what makes theme switching a live re-resolution with no reload.
theme-compatibility-fixtures.json is asserted independently by both Cratis.Scene.Engine.Specs (C#) and @cratis/scene.engine's own Vitest suite - the same pattern used for the package resolver in #3 and the layout evaluator in #4. Explicitly covers the "core has no implicit exemption" case, mirroring Screenplay's own theme compatibility specs.
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.
Added
ThemeCompatibility.IncompatiblePackages()/incompatiblePackages()andIsCompatible()/isThemeCompatible()- reuse the exact rule Screenplay's compiler already applies (ValidateThemes): every package aui profiledeclares must be in the theme'scompatibleWithlist, with no implicit exemption forcore. Sharing this rule here means Stage's build-time warning and Studio's design-time theme-picker filtering don't each reimplement it. (Theme engine: applying and validating theme/package compatibility #5)ThemeCompatibility.ApplicablePackages()/applicableThemePackages()- the renderer-facing half: the packages a profile activates that a theme also declares compatible, whichScene.Reactscopes token application to (rather than applying a theme's tokens globally). Computing it fresh from the current theme/profile pair, rather than caching a resolved result, is what makes theme switching a live re-resolution with no reload. (Theme engine: applying and validating theme/package compatibility #5)theme-compatibility-fixtures.json) asserted independently by both the C# and TypeScript specs, following the pattern established inui profilepackage resolution engine #3/Layout engine:flowandfreeformarrangement rendering #4.Notes
The theme token model's own shape (colors, spacing, typography) is explicitly out of scope for this issue, confirmed by its own text - this PR only builds the compatibility check and the package-scoping helper a future token-application layer in
Scene.Reactwill consume; it does not attempt to design or apply actual tokens.