Feature idea: modifier/node interpolator#441
Feature idea: modifier/node interpolator#441ansh7432 wants to merge 31 commits intoarmanbilge:mainfrom
Conversation
|
Hii @kubukoz @armanbilge please review the PR i had made the changes |
|
Thanks for the PR! To test it works, can you update the TodoMvc demo app to use this new feature? |
Yeah sure making these changes.. :) |
|
Hii @armanbilge @kubukoz getting some error while implementing the test for nodeinterpolator please go through the code and review it |
|
Can you push the code with the broken test? The last CI run is green |
|
Hi @kubukoz try to add test in todomvc file adding nodesinterpolator please check and review when you have time I've made these changes: Added the import: import calico.html.nodes When compiling, I'm seeing errors related to the nodes string interpolator. Initially, I tried using it with type parameters like nodes[IO]"...", but that caused syntax errors. When removing the type parameters, it still fails to compile. |
|
@ansh7432 I think your implementation is quite complex. I recommend to start from the initial proposal in #401 (comment) and support additional features one-by-one, instead of all at the same time. That will make it easier to debug. |
|
Hii @armanbilge @kubukoz implemented nodesinterpolator test in todoMvc and its working fine please check if needs more changes :) |
Hmm, are you sure? I just gave it a try, and the TodoMVC app seems to be broken, I am unable to add any todos 😕 For reference, here is the working example: https://armanbilge.github.io/calico/todomvc/ |
|
|
|
Hi @armanbilge @kubukoz gentle reminder to review this 😊 |
|
Thanks for the review fixing all the things and again raising pr soon 😊 |
Co-authored-by: Arman Bilge <armanbilge@gmail.com>
|
Nice work, this is much improved! I think like Jakub suggested in #441 (comment), the next step is move more of the interpolation into compile-time.
|
Yeah so looking for this now after working on this would this be able to merge ? |
|
Now that we've prototyped the idea, let's keep improving it in this PR until it's production-ready 💪 |
|
Yeah sure will working on this @armanbilge 😃 |
|
hii @armanbilge I had updated the PR please look into this.. 😊 please suggest more improvements on this 😀 |
|
Hii @kubukoz @armanbilge please review this :) |

Add nodes string interpolator for mixing text and dynamic content
Summary
This PR implements the nodes string interpolator feature requested in #401. It enables mixing static text with dynamic content (such as signals and modifiers) in a clean, intuitive way.
Implementation Details
The implementation adds a StringContext extension method called nodes that allows for string interpolation with various types:
Signal[F, String] and Signal[F, ?] for reactive values
Modifier[F, El, ?] for existing modifiers
Product types (tuples and case classes)
Effect types like F[String]
Standard values (using toString)
Each interpolated string becomes a series of text nodes and dynamic content, preserving the reactivity of signals while providing a more ergonomic API.
Example Usage
##Benefits
Improved readability: Code is more concise and follows natural expression patterns
Maintained reactivity: Only the signal parts update when their values change
Type flexibility: Works with various types beyond just Signals
Intuitive syntax: Familiar string interpolation pattern from standard Scala