membrane

zimablue 2023-04-19T10:07:12.567949Z

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

phronmophobic 2023-04-19T18:41:01.312969Z

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.

zimablue 2023-04-19T18:41:39.653659Z

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

zimablue 2023-04-19T18:43:33.637369Z

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

zimablue 2023-04-19T18:44:08.330509Z

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

phronmophobic 2023-04-19T18:44:54.824149Z

oh, interesting.

phronmophobic 2023-04-19T18:48:09.603509Z

That's pretty neat.

zimablue 2023-04-19T18:49:42.259949Z

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

zimablue 2023-04-19T18:49:59.225899Z

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

phronmophobic 2023-04-19T18:50:39.540679Z

> 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.

zimablue 2023-04-19T18:51:00.088729Z

I considered extending to maps

zimablue 2023-04-19T18:51:25.412749Z

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

phronmophobic 2023-04-19T18:57:35.371329Z

> 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.

phronmophobic 2023-04-19T18:57:56.467029Z

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

zimablue 2023-04-19T18:59:32.766639Z

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

zimablue 2023-04-19T19:00:03.993789Z

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

zimablue 2023-04-19T19:00:05.941849Z

State

zimablue 2023-04-19T19:00:17.216859Z

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

phronmophobic 2023-04-19T19:00:34.808839Z

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

zimablue 2023-04-19T19:07:35.051129Z

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

zimablue 2023-04-19T19:08:17.994939Z

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

phronmophobic 2023-04-19T19:09:34.252169Z

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.

phronmophobic 2023-04-19T19:10:13.044239Z

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).

zimablue 2023-04-19T10:07:35.257839Z

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