vrac 2025-04-22

Perhaps, can I write component-local events and component-local subscriptions with signaali? If I can, then I can write re-usable components. A function may accept parameters for si-frame global events and si-frame global subscriptions and return a vrac component. That is my theory for re-usable vrac components.

This is one way of doing it, but I recommend to wait until the DSL is ready.

Are you preparing a DSL for mixing component-local events and component-local subscriptions and the global ones?

Not exactly, but it will help a lot with it.

The DSL is supposed to help with representing the user's intent, and to help reading it in a programmatic way.

Please share some snippets about how you see component-local events and subscriptions.

I don't have snippets. I just have vague ideas at this point. I imagined a UIx defui component where missionary dishes out component subscriptions.

Global subscriptions are not reusable without component function parameters, and some subscriptions should be local to components.

Without a snippet of pseudo-code, it's hard to see what a component-local subscriptions and event should be.

(defui a-component
  []
  (ui-code
    (set-up-missionary (fn [x] (* x 2)))
    (:on-click (fn [e] (push-something-to-missionary)))
    (subscribe-to missionary's-output)))
My UI programming knowledge is not great at this point.

Basically, if you type 3 into an input box, you see 6 in another input box because missionary propagates 6 to it.

Event handler pushes a value to reactive system. The system publishes a transformed value. Widgets subscribe to the transformed value locally inside defui.

Basically, a closure. Everything is contained in defui macro.

I am not sure how missionary works with Signaali

It would be simpler to write it directly using signaali

But yeah, I see what you mean.

That code is not really correct for missionary. It is just a generic pseudo-code.