untangled

NEW CHANNEL: #fulcro
stephen 2016-09-14T15:25:23.000204Z

@anmonteiro Your project reminds me of the lisp based DSSSL https://eager.io/blog/the-languages-which-almost-were-css/#the-turing-complete-stylesheet

anmonteiro 2016-09-14T15:25:50.000205Z

@stephenway wasn’t aware of that

stephen 2016-09-14T15:26:31.000207Z

It never became a standard language, but has some awesome ideas around it!

stephen 2016-09-14T15:26:49.000208Z

like inherited values

anmonteiro 2016-09-14T15:27:02.000209Z

that project uses garden to generate the styles

anmonteiro 2016-09-14T15:27:40.000211Z

the rationale behind it is that if we’re colocating queries, why not styles too 🙂

stephen 2016-09-14T15:28:06.000212Z

yea, makes sense

stephen 2016-09-14T15:28:50.000213Z

are media queries handled in an external stylesheet?

anmonteiro 2016-09-14T15:29:42.000214Z

didn’t think about that (yet)

anmonteiro 2016-09-14T15:29:50.000216Z

can’t we do it in garden?

stephen 2016-09-14T15:30:11.000217Z

I’ve never tried garden

anmonteiro 2016-09-14T15:30:22.000218Z

https://github.com/noprompt/garden/wiki/Media-Queries

shaun-mahood 2016-09-14T15:35:19.000220Z

I believe there is going to be a new alpha release of Garden with a bunch of changes in the next few weeks - might be some useful ideas to look at there as well

stephen 2016-09-14T15:36:54.000221Z

@shaun-mahood Do you know where I can find that? Can’t find a branch or tag on github.

shaun-mahood 2016-09-14T15:38:00.000222Z

Not out yet, you could check with @noprompt when he is planning a release

stephen 2016-09-14T15:38:54.000223Z

ahh ok, I was just curious if that release would have collocated styles

tony.kay 2016-09-14T15:47:33.000225Z

@anmonteiro I'm noticing a trend of people overriding defui. It occurs to me that this approach does not compose. The next challenge, perhaps?

anmonteiro 2016-09-14T15:47:50.000226Z

@tony.kay yes! That’s one thing I regret

tony.kay 2016-09-14T15:48:31.000227Z

we're wanting to instrument it to add in debugging capabilities in the browser during dev, and lots of libs seem to want to do things like your css lib

anmonteiro 2016-09-14T15:48:46.000228Z

one of the hard requirements of that project though is that we generate a CSS file in the end

anmonteiro 2016-09-14T15:48:54.000229Z

this has to be done on the JVM side, of course

tony.kay 2016-09-14T15:49:26.000230Z

I understand. Same problem for the debugging tools. The hack has to take place at the react level

anmonteiro 2016-09-14T15:51:57.000231Z

well the thing is it needs to be a macro

tony.kay 2016-09-14T15:52:26.000232Z

Do you leverage the real defui inside of your macro?

anmonteiro 2016-09-14T15:52:30.000234Z

it probably doesn’t need to be colocated in the sense that it’s a protocol to implement in defui

anmonteiro 2016-09-14T15:53:10.000235Z

maybe some other macro like defcss that can be colocated above the defui macro, like core.typed annotations are

anmonteiro 2016-09-14T15:53:25.000236Z

I have to think about that. feel free to open issues if you wanna discuss that

tony.kay 2016-09-14T15:53:45.000237Z

sure, ok

tony.kay 2016-09-14T15:53:59.000238Z

in the meantime I'm going to play with it for sure

anmonteiro 2016-09-14T15:54:57.000239Z

👍

noprompt 2016-09-14T16:00:36.000241Z

@anmonteiro my expectation is to have an alpha available in the next couple of weeks. the next version of garden is addressing specific pain points of issues that are difficult to close with the current implementation. the most significant improvements will be support for parsing/manipulating "raw" CSS and a dramatically cleaner, clearer, and more extensible compiler.

tony.kay 2016-09-14T16:04:39.000242Z

@anmonteiro how about, instead of a defui override, a function that can be called in the body of render? E.g. (render [this] (apply-css (dom/div #js {:class :root} ...)))

tony.kay 2016-09-14T16:05:26.000243Z

I guess that adds some runtime overhead

anmonteiro 2016-09-14T16:07:00.000244Z

@tony.kay where would you define the actual styles?

tony.kay 2016-09-14T16:07:20.000245Z

same way you were...oh, I missed passing this as a parameter

tony.kay 2016-09-14T16:07:56.000246Z

Actually, if you passed the class name as a parameter, it could probably be a macro

tony.kay 2016-09-14T16:08:18.000247Z

ultimately, for render you just need to know the name munging, right?

tony.kay 2016-09-14T16:09:13.000249Z

Also, does :class accept a seq as well? Might want multiple classes on an element

anmonteiro 2016-09-14T16:10:05.000250Z

yep

tony.kay 2016-09-14T16:10:18.000251Z

yep 2x?

anmonteiro 2016-09-14T16:10:24.000252Z

https://github.com/ladderlife/om-css#defui

anmonteiro 2016-09-14T16:10:35.000254Z

"<= use a vector [:one :two] to add multiple classes to an element"

tony.kay 2016-09-14T16:10:38.000255Z

ah, missed that

anmonteiro 2016-09-14T16:10:51.000257Z

and yeah, for render I just need to know the munging

tony.kay 2016-09-14T16:11:07.000258Z

so that would eliminate the need for an override of defui

anmonteiro 2016-09-14T16:11:19.000259Z

what I meant earlier by the defcss was that it could take the class

anmonteiro 2016-09-14T16:11:25.000260Z

somewhat akin to clojure.spec/fdef

tony.kay 2016-09-14T16:11:31.000262Z

Yeah, and then that would be reusable

anmonteiro 2016-09-14T16:11:45.000263Z

but we’d lose colocation actually inside defui

anmonteiro 2016-09-14T16:11:59.000264Z

which might actually not be that important

tony.kay 2016-09-14T16:12:15.000265Z

you could still just use a static protocol, but yeah, probably less important

anmonteiro 2016-09-14T16:12:37.000266Z

couldn’t use a static protocol without overriding the defui macro

tony.kay 2016-09-14T16:12:46.000267Z

why?

anmonteiro 2016-09-14T16:12:58.000268Z

because I do static analysis on the defined styles

anmonteiro 2016-09-14T16:13:03.000269Z

and evaluate them on the Clojure side

anmonteiro 2016-09-14T16:13:09.000270Z

to generate the CSS file

anmonteiro 2016-09-14T16:13:36.000271Z

which is also the reason why variables must be defined in a .cljc file https://github.com/ladderlife/om-css#user-defined-variables-in-colocated-styles

tony.kay 2016-09-14T16:13:38.000273Z

oh right, you'd have to be running cljs to do it otherwise

tony.kay 2016-09-14T16:14:02.000274Z

node integration? 😄

anmonteiro 2016-09-14T16:14:04.000275Z

btw, the current CSS spitting works great with e.g. Figwheel development

anmonteiro 2016-09-14T16:14:11.000276Z

we’d lose that if Node

anmonteiro 2016-09-14T16:14:12.000277Z

🙂

tony.kay 2016-09-14T16:14:14.000278Z

ah yes

tony.kay 2016-09-14T16:14:22.000279Z

that is a really nice feature

tony.kay 2016-09-14T16:16:17.000280Z

Yeah, I'm liking the defcss idea. avoids the defui composition problem, but gets all of the good results.

anmonteiro 2016-09-14T16:16:31.000281Z

yep

tony.kay 2016-09-14T16:16:39.000282Z

Is this being used at LFin?

anmonteiro 2016-09-14T16:17:09.000284Z

not currently I think

tony.kay 2016-09-14T16:17:19.000285Z

I just saw the ©️

tony.kay 2016-09-14T16:17:38.000286Z

hard to change a lib that much once adopted

anmonteiro 2016-09-14T16:17:41.000287Z

it was but they’ve replaced it with something very similar

anmonteiro 2016-09-14T16:18:03.000288Z

so definitely up for the churn

anmonteiro 2016-09-14T16:18:04.000289Z

😛

anmonteiro 2016-09-14T16:18:26.000290Z

problem with defcss is then we’d need to wrap the render function too

tony.kay 2016-09-14T16:18:55.000291Z

that can be a pro as well, though, because it opens the door to further composition and reuse

anmonteiro 2016-09-14T16:19:00.000292Z

which you mentioned above with apply-css

tony.kay 2016-09-14T16:19:09.000293Z

(apply-css [Style1 Style2] ...)

anmonteiro 2016-09-14T16:19:16.000294Z

hrm

anmonteiro 2016-09-14T16:19:23.000296Z

Oh we’re thinking different things

anmonteiro 2016-09-14T16:19:35.000297Z

and your idea is probably better

anmonteiro 2016-09-14T16:19:56.000298Z

I was thinking:

(defcss Foo ..)
(defui Foo ..)

tony.kay 2016-09-14T16:20:09.000299Z

I see, yeah I was thinking more general

anmonteiro 2016-09-14T16:20:11.000300Z

and the Foo styles would only be applied to Foo

anmonteiro 2016-09-14T16:20:29.000301Z

probably harder to do your idea because of prefixing

anmonteiro 2016-09-14T16:20:43.000302Z

actually maybe not

tony.kay 2016-09-14T16:20:46.000303Z

not really, only conflict resolution

tony.kay 2016-09-14T16:20:58.000304Z

if you use the same name twice, it would be ambiguous in the component

anmonteiro 2016-09-14T16:21:05.000305Z

yeah

tony.kay 2016-09-14T16:21:26.000306Z

but that's easy enough to throw a warning on and resolve by hand