Fork me on GitHub
#membrane
<
2023-04-19
>
zimablue10:04:12

noticed an implicit invariant that's violated: (~= (make-node (children x)) x) is true except for Bordered.

phronmophobic18:04:01

Ok, that's a bug. I created an issue to track it, https://github.com/phronmophobic/membrane/issues/70. The make-node protocol is a little half-baked at the moment. The idea is to be able to programmatically traverse and edit an element tree without having to know about all of the different element types. However, I'm not sure how well that works in practice and I haven't used since I added it. I would love to hear more about your use case. Still trying to figure out what make-node should look like and how it should be used.

zimablue18:04:39

I'm using it, it seems to be working ok for now

zimablue18:04:33

It basically patches over not knowing whether you have a drawable or drawables right, but one thought I had was that it might be unnecessary to ever expect drawables, since vectors are valid components maybe it could just always accept a single drawable, I dunno if that messes up the data model in a different way

zimablue18:04:08

I used it in combination with children to implement a walk function that added logging decorations to debug the event flow

phronmophobic18:04:54

oh, interesting.

phronmophobic18:04:09

That's pretty neat.

zimablue18:04:42

I've also removed all the component stuff and I'm using atoms and subscriptions to do a more primitive form of data passing

zimablue18:04:59

I just spent too much time struggling to understand precisely what was happening with all the refs

phronmophobic18:04:39

> but one thought I had was that it might be unnecessary to ever expect drawables, since vectors are valid components maybe it could just always accept a single drawable, I dunno if that messes up the data model in a different way Yea, that could be true. I've also been considering whether sequences should be treated as valid elements similar to vectors.

zimablue18:04:00

I considered extending to maps

zimablue18:04:25

Just with the vals, but the keys would be useful for manipulating/reading the tree

phronmophobic18:04:35

> I just spent too much time struggling to understand precisely what was happening with all the refs Yea, you're not the only one. I definitely think membrane.component could have better explanations and be simpler to use, but I haven't quite figured it out.

phronmophobic18:04:56

I'm also happy to support other state management solutions.

zimablue18:04:32

I mean component isn't enforced, I still use the top level one. The hard part is if you want to use existing defui components, so the actual work was taking apart textarea and reimplementing it

zimablue19:04:03

I know that I could have found the right paths and refs to pass, then written my own thing to handle the intents and push them into my own stare

zimablue19:04:17

But I figured I might as well just write my own and understand it

phronmophobic19:04:34

Yea, hopefully the component stuff is completely optional. If you run into any problems ignoring component stuff, it would be good to know.

zimablue19:04:35

The top-level-ui thing I haven't tried to remove but I think that might be some work, I wonder if the logic in it could be outside component

zimablue19:04:17

Actually I had to clone it and patch it to be able to do focus, maybe there was a cleaner way but I just updated an atom to clear focus when no intents from a click

phronmophobic19:04:34

There's some stuff that probably makes sense to keep in component, but I do think top-level-ui does too many things and could be broken into simpler pieces.

phronmophobic19:04:13

There's also some logic in some of the backends that should probably be a simple piece that's composed with top-level-ui (eg. copy/cut/paste).

zimablue10:04:35

sorry that should be (make-node x (children x))