Repository navigation
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces a change notification mechanism to the TemplateRegistry (feature F-CRAFT-REG-10), allowing hosts to listen to registry updates and automatically refresh the CraftRuntime and CraftView when libraries are re-registered. It also implements a custom SpaceBuilder widget in the Flutter adapter to replace LayoutBuilder for the MediaSource.layout mode, enabling template components to correctly answer intrinsic size queries (e.g., inside IntrinsicWidth or IntrinsicHeight). Additionally, the public API of a2ui_craft has been restructured to export library model nodes via a separate model.dart file to prevent naming clashes with Flutter's Switch widget. Comprehensive unit, widget, and conformance tests have been added to validate these new features. I have no review comments or feedback to provide on the changes.
d1b6037 to
364dc33
Compare
364dc33 to
aa3c93a
Compare
aa3c93a to
70ece8e
Compare
70ece8e to
3659e93
Compare
3659e93 to
1493161
Compare
Fixes dogfood bugs B01, B02 and B09, and adds an error placeholder option. - B01: templateCatalog takes `media:` (a MediaSource) and passes it to CraftView. The default `layout` source no longer uses a LayoutBuilder: SpaceBuilder builds like one but also in the build phase (for the space of its last layout, at first the window's), so template components answer intrinsic size queries inside IntrinsicWidth, IntrinsicHeight, dialogs and tables. Errors of an expansion replaced in the same frame are not reported; a new view keeps a runtime's media context. - B02: the registry notifies listeners after each accepted change (craft_template_registry requirement 10, with conformance cases); a listener removed during a notification is not called, and one that throws goes to the registry's onListenerError (by default the zone) without failing the registration or stopping the other listeners; CraftView refreshes its runtime when its registry changes, and CraftRuntime.refresh drops the state of a library registered again at once (craft_runtime requirement 10), so components on screen render the new version in the next frame and the next tap is not swallowed (craft_a2ui_integration requirement 7). - B09: package:a2ui_craft/a2ui_craft.dart exports only the library model types hosts need; the nodes of a parsed library (Switch, Loop, ...) move to package:a2ui_craft/model.dart, so the main library imports next to package:material_ui/material_ui.dart. The main library still exports every model type its API names (Import, WidgetDeclaration, BlobNode, SymbolReference, ...); checkCallArguments is no longer exported. Tests that build libraries import model.dart. - templateCatalog takes `errorBuilder:` for the placeholder of a failed widget, as CraftView does.
The A2UI integration fix in this stack added a test that builds a library with ConstructorCall and ArgsReference, which this change moves from the main library to package:a2ui_craft/model.dart.
1493161 to
d3b7f01
Compare
Description
Fixes to the Flutter adapter and renderer, found by dogfooding. Stacked on #38.
IntrinsicWidth/IntrinsicHeightand dry layout (for example in chat bubbles and dialogs) with every media source.templateCataloggets amedia:option.onListenerError.Switch,Loop, …); they're inpackage:a2ui_craft/model.dart.errorBuilder: the error placeholder can be replaced.Each fix comes with a test that fails without it. An independent review checked the blueprints, tests and code.
Pre-launch Checklist
One time:
For this PR:
python3 ./scripts/fix_licenses.py --check)../scripts/fix_format.sh --check).