Active-CSS / active-css

The epic event-driven browser language for UI with functionality in one-liner CSS. Over 100 incredible CSS commands for DOM manipulation, ajax, reactive variables, single-page application routing, and lots more. Could CSS be the JavaScript framework of the future?
https://activecss.org
Other
42 stars 7 forks source link

Allow any CSS selector to work as an inner HTML reference variable + re-look at variable syntax #234

Closed bob2517 closed 11 months ago

bob2517 commented 2 years ago

Currently you can only reference the contents of an element if it has an ID, like:

render: "{#myPTag}";

But we to be able to do it on all selectors. Ideally we should be able to get a bunch of elements (like querySelectorAll) and have it return an array of inner HTML content which can be looped.

Doing this issue in an isolated fashion will lead to further weird variable syntax as it stands at the moment, with all the different types that we've already got. It's just going to get worse unless it's addressed. When I started with variables, I had no idea that ACSS was going to have so many different types of them.

Really ideally, we should be able to apply JavaScript functions to elements and have proper element variable references. It's like there shouldn't be any specific character syntax for variables at all now - there should just be different references or something easier to remember. I dunno yet.

Needs a proper un-holistically-challenged syntax for variables. May lead to a breaking change in a few places, but if it does, it's going to be an awesome one.

I quite like the Vue {{ }} syntax for some reason. It's the same as Laravel, and I get on fine with that. That could work as a general variable wrapper, and have individual stuff in there for different variable types, and it could include raw JS. We do use double curlies already a lot for reactive variables, but that could be changed if any proposed syntax was amazing enough to warrant it.

Anything that is easy for the core to read and differentiate will keep the core quick. anything too fancy will slow things up.

This issue will get filled up with proposals until the syntax is nailed down, which needs to happen before starting it.

Not sure what milestone to put this on yet. Will get the spec nailed for it first. It may get a release of its own.

bob2517 commented 11 months ago

Closing - stale