Phase 3: Data Binding and Signal Mapping - #7
Merged
Merged
Conversation
Implement runtime evaluation of bindings against Ash resource data: - AshUI.Runtime.BindingEvaluator.evaluate/3 resolves bindings to actual values - Source path resolution for Domain.Resource.Attribute format - Relationship traversal for nested paths (e.g., user.profile.name) - Transformation application: format, compute, default, validate, uppercase/lowercase/trim - Batch evaluation with evaluate_batch/2 - Context-based evaluation with user_id, params, assigns Relates to Phase 3.1: https://specs.planning/phase-03-data-binding-and-signal-mapping.md
Implement two-way data binding for :value type bindings: - read_binding/2 reads from Ash resource to UI elements - write_binding/4 writes user input back to Ash resources - subscribe_binding/3 subscribes to Ash resource changes - reevaluate_binding/4 re-evaluates on resource change notification - Input validation: required, min_length, max_length rules - Input sanitization: trim, strip_tags rules - Socket assigns management for binding values and errors Relates to Phase 3.2: https://specs.planning/phase-03-data-binding-and-signal-mapping.md
Implement collection binding for :list type bindings: - load_collection/3 loads collections from Ash resources with pagination - subscribe_collection/3 subscribes to collection changes for reactivity - handle_collection_change/5 handles insert/update/delete operations - format_collection/3 formats items with transformations (format, compute) - Pagination support: page, page_size, has_next, has_prev - Filtering support via opts - Scroll position tracking for reactive updates Relates to Phase 3.3: https://specs.planning/phase-03-data-binding-and-signal-mapping.md
Implement event-driven binding for :action type bindings: - execute_action/4 executes Ash actions in response to UI events - event_handler/2 generates LiveView event handler from binding - wire_handlers/2 wires action bindings to LiveView handle_event/3 - Authorization check before action execution - Parameter mapping: event, context, static sources - Success/error handling with flash messages and result storage - Event data passed to action parameters Relates to Phase 3.4: https://specs.planning/phase-03-data-binding-and-signal-mapping.md
Convert Ash bindings to unified-ui signal format: - AshUI.Signal.Struct with id, source, target, type, transform, metadata - Signal creation helpers: bidirectional/2, collection/2, event/2 - Signal validation with validate/1 - CloudEvents-compatible format via AshUI.Signal.CloudEvents - to_cloud_event/1 converts signal to CloudEvents spec - from_cloud_event/1 converts CloudEvents back to signal - Batch support with batch/1 for multiple signals - Serialization to JSON, binary, or text formats Relates to Phase 3.5: https://specs.planning/phase-03-data-binding-and-signal-mapping.md
Added comprehensive integration tests for all Phase 3 modules: - Signal.Struct tests for signal structure creation and validation - Signal.CloudEvents tests for CloudEvents format conversion - Runtime.ActionBinding tests for action execution and wiring - Runtime.ListBinding tests for collection loading and changes - Runtime.BidirectionalBinding tests for read/write operations - Runtime.BindingEvaluator tests for binding evaluation All tests cover success and error scenarios.
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
Implements reactive data binding from Ash resources to UI elements through unified-ui signal format (Phase 3).
Section 3.1 - Binding Evaluation
AshUI.Runtime.BindingEvaluatorfor runtime binding resolutionSection 3.2 - Bidirectional Value Bindings
:valuetype bindingsSection 3.3 - List Bindings
:listtype bindingsSection 3.4 - Action Bindings
:actiontype bindingsSection 3.5 - Signal Format Conversion
AshUI.Signal.Structfor signal structureSection 3.6 - Integration Tests
Test plan