phronmophobic / membrane

A Simple UI Library That Runs Anywhere
Apache License 2.0
556 stars 19 forks source link

Improve support for wrapping intents for child elements #78

Open phronmophobic opened 2 months ago

phronmophobic commented 2 months ago

In some cases, a parent component wants to be able to wrap intents that bubble up from child elements. For simple cases, bubbling works just fine. However, there are a few cases where bubbling doesn't work.

For example, if a child component returns a "complex" intent, that gets implemented by dispatch!ing to simpler effects, then those simpler events don't get wrapped.

Using algebraic effects might solve these and other similar problems.

phronmophobic commented 2 months ago

Another potential use case is higher order intents.

For example, a ::drag-start intent might have some pending intents that are used if the drag and drop cancels or it might have some intents that should be returns when the drag and drop drags far enough to trigger. However, including pending intents as part of the ::drag-start event means those pending intents won't get processed by normal bubbling.