hoplon

The :hoplon: ClojureScript Web Framework - http://hoplon.io/
Rohan Nicholls 2019-10-23T14:17:45.082300Z

@dmarjenburgh That talk by Rich Harris is great. Pretty impressive from his talk that svelte framework. The non-leaky component abstraction looks very nice. i.e. css stays where it is supposed to.

2019-10-23T15:02:49.082800Z

similar in its concept of component to my and (mostly) micha's first framework, golf http://golf.github.io/

Rohan Nicholls 2019-10-24T08:44:39.115100Z

Had a look through the docs. Seems you and Micha spend your time ahead of the curve. 🙂 Just out of interest why did you decide not to tackle the css side of components? I have to say I have been finding it very useful to have css isolation within components.

2019-10-24T15:31:07.116500Z

for hoplon an initial goal was designer-friendliness, and we decided to try to impose as little as possible on their toolset/workflow

2019-10-24T15:33:34.116700Z

in practice though we ended up slicing up CSS the designer gave us into defelems

2019-10-24T15:33:43.116900Z

and took ownership of the CSS

2019-10-23T15:03:41.083300Z

in the sense that a component is a bundle of js/css/markup, we didn't really take on css in hoplon

👍 1
2019-10-23T15:05:36.084800Z

I jumped on the tailwind-css/tachyons bandwagon and I'm very happy with the results for styling. Composable css classes ftw.

danielneal 2019-10-23T15:29:01.085600Z

yes!! I’ve really found with tachyons etc that a lot of the old css / styling pain I used to have just doesn’t exist anymore

2019-10-23T15:59:01.086400Z

looks very interesting, what’s the relationship between tailwind and tachyons?

2019-10-23T19:14:39.089300Z

Two different implementations of the same ideas. I think tachyons is more strict, opnionated and tailwind is more practical (it has more allowed sizes for fonts, spacing in general). We started using tachyons and we migrated everything to tailwind after long talks with the design team.

👍 1
Rohan Nicholls 2019-10-24T08:47:10.115300Z

Isn’t this just bootstrap? Basically, all variations have classes created for them, and you just include classes as you need them for everything? e.g. padding, flex etc.

Rohan Nicholls 2019-10-24T08:47:30.115500Z

I’m not knocking it, just wondering how it is much different?

Rohan Nicholls 2019-10-24T08:47:53.115700Z

(this impression was based on the home page of tailwind)

Rohan Nicholls 2019-10-24T08:53:49.115900Z

Okay, two obvious problems they seem to have a solution for: - extracting patterns into a separate class - overrides for a user’s themes

Rohan Nicholls 2019-10-24T08:53:56.116100Z

Will check it out.

2019-10-24T14:02:33.116300Z

It's very different in practice. You can create your own custom components composing tailwind/tachyons classes. They will not look "bootstraped". But you will not have something that is almost the same with 1px difference because there is no class for that, which makes things more manageable.

Rohan Nicholls 2019-10-25T06:10:31.117100Z

Okay, that sounds really nice. i started looking more deeply into it, and it is very nice. Do you use it with hoplon?

2019-10-27T20:02:21.117300Z

I haven't really used hoplon in a while because of native apps. But it will work with hoplon, no problem with that.

2019-10-23T19:53:11.101Z

@flyboarder I’m trying to follow the flow of whats happening when hoplon is creating an element, but there’s a lot of indirection going on. I don’t really follow why it works this way: - You invoke, say: (input :type "text" :disabled true :placeholder "insert text here") - mm dispatch -> elem! :hoplon/default - mm dispatch -> hl! :hoplon/invoke. This parses the attrs in a map - mm dispatch -> hl! :hoplon/attr. This calls -attribute! on each key in the map, the impl calls elem! with the keyword and the value. - mm dispatch -> elem! :hoplon.core/default. The default handler calls do! with the element, key and value - mm dispatch -> do! :hoplon.core/default. This handler calls (set-attributes! elem kvs). This is actually an error, since kvs is not a map of attributes, but a single value. Maybe it should call (do! elem ::attr {key val}) like in hoplon.jquery? What is the right way to extend or provide alternate implementations in this multi dispatch setup? (You can always have custom attributes right)

flyboarder 2019-10-23T19:55:38.102Z

@dmarjenburgh there is a bit of extra redirection that I will probably remove in the next release, the idea being you can currently completely swap the internal implementation of everything in hoplon, don’t like something change it 🙂

flyboarder 2019-10-23T19:56:44.102200Z

https://github.com/hoplon/hoplon/wiki/Attribute-Providers

2019-10-23T20:02:05.103800Z

This is already possible in 7.2 right? For example I created:

(defmethod h/do! :props/*
  [elem k v]
  (aset elem (name k) v))
because I often want to set properties instead of attributes. What would be a use case for the multi-level multimethods?

flyboarder 2019-10-23T20:02:30.104100Z

@dmarjenburgh namespaced attributes

flyboarder 2019-10-23T20:02:40.104400Z

for example

flyboarder 2019-10-23T20:07:31.106200Z

With your current :props/* multi-method you cannot create a handler for a specific property, since anything with the :props namespace will always be handled by :props/* what if you want :props/example to be handled completely differently?

flyboarder 2019-10-23T20:09:31.108200Z

this is where the multi-layered multi-methods come in handy, we have a generic way to handle namespaced attributes :<ns>/*, which can each implement their own more specific multi-methods

2019-10-23T20:14:35.109100Z

Yeah, I could always dispatch it down further inside :props/* handler to my own multimethod if I wanted to.

2019-10-23T20:15:50.110200Z

I was more talking about the change from 7.2.0 to 7.3.0-SNAPSHOT, which introduced the hl! multimethod.

flyboarder 2019-10-23T20:16:19.110600Z

ah that was a trial in opening up the internals for replacement

flyboarder 2019-10-23T20:16:28.110800Z

but nobody uses it 😛

flyboarder 2019-10-23T20:16:48.111200Z

it’s something I need to revert before 7.3 lands

2019-10-23T20:19:06.112600Z

Ok. I noticed there was a bug https://github.com/hoplon/hoplon/blob/master/src/hoplon/core.cljs#L432. This should probably call (do! elem ::attr {key val}), but if the changes are reverted I guess that will be fixed as well 🙂

2019-10-23T20:21:05.114300Z

I really want the keyed loop-tpl support and some support for component cleanup, so I was looking at what I can do to get there 🙂

flyboarder 2019-10-23T20:22:33.114600Z

https://github.com/hoplon/hoplon/milestone/4

flyboarder 2019-10-23T20:22:49.114900Z

Anything on that list could be revisited