Add contribution aggregation and the NavBar widget - #11
Merged
Conversation
aggregateContributions() collects every Contribution targeting a given contribution point, ordered ascending by its explicit order with unordered contributions sorting after every ordered one. This is the runtime half of #2 - resolving *which* contribution point a "contribute to" targets already happens before a Contribution exists in Scene.Model (see its own doc comment), so there is no ambiguity left for the engine to resolve, only ordering.
NavBar renders the aggregated Navigation contributions from across the current element tree. How navigate to <Screen> becomes a concrete route is a caller-supplied renderRoute callback rather than a fixed URL scheme, so the same widget works unmodified across renderers - per #2's own "configurable per renderer" requirement. extractNavigationItem() reads a NavigationItem out of a contribution's ExternalComponent.properties bag, using the same property names as NavigationItem's own fields. This property-bag contract is a Scene#2 design choice made without a real Screenplay-to-Scene translation to confirm it against (Stage#37 hasn't been built yet) - documented as such in the function's own doc comment.
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
aggregateContributions()(@cratis/scene.engine) - collects every contribution targeting a given contribution point, ordered ascending by its explicitorder(unordered contributions sort after every ordered one, in their original relative order). Resolving which contribution point acontribute totargets already happens before aContributionexists inScene.Model(see its own doc comment), so there was no ambiguity left for the engine to resolve here, only ordering - this is narrower than the issue's original proposal, which assumed the engine would still walk a nearest-enclosing resolution; that already happened upstream. (Contribution point resolution at runtime, and the NavBar widget #2)NavBarwidget (@cratis/scene.react) - renders the aggregatedNavigationcontributions. Hownavigate to <Screen>becomes a concrete route is a caller-suppliedrenderRoutecallback rather than a fixed URL scheme, so the same widget works unmodified across renderers, per the issue's own "configurable per renderer" requirement. (Contribution point resolution at runtime, and the NavBar widget #2)extractNavigationItem()- reads aNavigationItemout of aNavigationcontribution'sExternalComponent.propertiesbag.Notes
extractNavigationItem's property-bag key contract (label,targetScreen,routeParameterBindings,order,group- the same names asNavigationItem's own fields) is a Scene#2 design choice made without a real Screenplay-to-Scene translation to confirm it against - Stage#37 (the Screenplay → Scene seam) hasn't been built yet. Documented as an assumption in the function's own doc comment; Stage#37 should either match this contract or this function should move to match whatever it actually emits.