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 certain built-in conditionals to have defaults #188

Closed bob2517 closed 2 years ago

bob2517 commented 3 years ago

Allow things like "if-empty" to work with parentheses and have "self" as a default.

This has proven itself to be an instinctual way to use the conditional, so it should be in the syntax.

There are probably other built-in conditionals that could suffer the same syntax improvement, so check those out.

bob2517 commented 3 years ago

After this, wrap up what's left on the other in-progress issues and push a release up, unless something else comes up of course...

bob2517 commented 3 years ago

A question is, do I add the defaults at config load time or evaluation time. Considering the extension and the fact that it should really work with what the developer typed, this indicates a more runtime approach. That would also not add any overhead to the initial config load.

Actually, there would be probably less overhead doing it at runtime as we can then just do a quick check when needed rather than checking the presence of parentheses on every appropriate conditional. If at runtime, there is an array of conditional names with defaults and just check if the conditional is in there with a default then we know it can be run with the default. Otherwise barf with the "custom conditional not found" error.

bob2517 commented 3 years ago

This is done and on the branch. The following conditionals now default to self and so either now don't need parentheses at all or just one.

if-completely-visible if-display if-exists if-focus-first if-focus-last if-form-changed if-inner-text if-max-height if-max-length if-max-width if-min-height if-min-length if-min-width if-visible

bob2517 commented 2 years ago

Removing if-focus-first and if-focus-last from this, as they don't fit the criteria needed for this.

bob2517 commented 2 years ago

Adding if-inner-html which was done but not documented here.

bob2517 commented 2 years ago

Adding if-empty and if-empty-trimmed. These will be on the branch shortly.

bob2517 commented 2 years ago

Closing in preparation for release.