matrix

kennytilton 2023-03-09T14:09:45.465089Z

ChatG stopped training in 2021, when I started calling Cells "Matrix". May have to change back.

One of Tilton's most notable contributions to the Lisp community was his work on the Cells library, which he developed in the early 2000s. The Cells library is a framework for reactive programming that allows for complex and dynamic user interfaces to be created with ease.
Past tense because it has me sadly dead as of 2020. Hey, I may have lost a step, but....

😁 1
kennytilton 2023-03-09T14:12:43.895049Z

ps. Independent scrolling is as good as I can get it, after enough random CSS typing to produce the works of Shakespeare. Now I am carving out a new NS: tiltontec.matrix.api. tbh, I will benefit for than anyone! 🤣

chromalchemy 2023-03-09T16:27:13.112039Z

Would this work usefull for parallax scroll effects? I always wanted to get into that in a controllable way, but haven’t used any libraries yet. It seems like the fine-grained state management would be key for simplifying approaches to those techniques.

kennytilton 2023-03-09T17:24:20.802249Z

googles parallax scroll effects Found this: https://blog.logrocket.com/create-parallax-scrolling-css/#how-to-implement-the-parallax-effect-in-css Hmm, isn't that just CSS? Web/MX begins with the Hippocratic oath: do no harm (to how HTML works). That said, yes, we have a lot of control with Web/MX. Here I implemented a rough "loading" indicator that honestly updates as it goes, but it is quick so don't blink: https://kennytilton.github.io/whoishiring/ So if we need to help the parallax we should be OK.

chromalchemy 2023-03-09T17:53:10.106779Z

some context from article: > https://www.sketch.com/ wrote about https://www.sketch.com/blog/2022/07/22/what-is-a-parallax-effect/ and spoke about how they implemented a subtle parallax scrolling effect on the homepage of their website. They chose to use a JS framework called https://stimulus.hotwired.dev/: > And it was simple from a development standpoint, too — as Richárd explains. “We use a super tiny JS framework called https://stimulus.hotwired.dev/. It lets us create small JavaScript components that are controlled by HTML data attributes,” he continues. With just a few extra HTML data parameters, the team could control horizontal and vertical velocity based on the speed of scrolling. “So larger objects and elements can move slower and the smaller ones can move faster in the virtual space,” Richárd concludes. > I think it is important to understand that no framework or JavaScript is required! If this blog post was my first introduction to the parallax effect, I could be led to believe that I should implement it with a JavaScript framework too. > Development teams may opt for JavaScript because they are already using a framework and can achieve the same outcome with just a little extra JavaScript. I don’t want to admonish anyone for doing that, it may be justifiable. However, it can be easy to make a habit of shipping more and more JavaScript as you add independent features over time. > Also, remember that it is not a mutually exclusive choice, you can use mostly CSS with some JavaScript. The https://twitter.com/keyframers did an interesting example of this in https://youtu.be/vatBdNK-OiQ.

kennytilton 2023-03-09T19:07:56.669939Z

Ah, I see. The example here seems simple: https://stimulus.hotwired.dev/ I see two wins for Web/MX, both the fine-grained state maintenance, and the fine DOM maintenance. Where VDOMers try to get by with smart diffing, Web/MX simply knows exactly which DOM to modify. Funny this came up now. I was just testing out this morning what I call "family values" 🙂 . Unlike the React "always have a key", in Web/MX we worry about that when it matters, then spell out the handling, which crucially does not involve generating anything unnecessarily:

(div {:style   {:display        :flex
                                :flex-direction :row 
                                :flex-wrap      :wrap
                                :max-width      "200px"}
                      :onclick (cF (fn []
                                     (mswap! me :kid-values conj (+ 10 (rand-int 500)))))}
                  {
                   :kid-values  (cI (range 10))
                   :kid-factory (fn [parent fake-id]
                                  (span {:style {:padding "4px"}}
                                    {:fake-id fake-id}
                                    (str fake-id)))
                   :kid-key     (fn [k]
                                  (:fake-id @k))}
                  (md/kid-values-kids me _cache))
The kid-values-kids formula returns the same kid model if it already exists, and the Web/MX DOM maintenance does some clever DOM fragment manipulation to reconstitute the children of the DIV, so the kid-factory only runs once per number added to kid-values. Hmmm, maybe I should have used CLJ meta. The idea of kid-key is flexibility, so the "same" kid could be recognized without assuming where was the key. 🤔

chromalchemy 2023-03-10T01:24:19.085239Z

Cool! I figured the fine-grained-ness would be nice when essentially you are basing ui state of other ui state, not necessarily some higher-level semantic schema model. Kind of like a constraint rules system. It always seemed weird to me though you could not easily code layout dynamically based on actual element width state in html.

kennytilton 2023-03-10T16:07:01.562879Z

"essentially you are basing ui state of other ui state" My favorite trick is having a dynamic background color, then having the color switch from black to white when the background RGB luminance gets too low. Two separate formulas if we use make-css-style to create an entire model for the style attribute. Just showin' off! 🙂

chromalchemy 2023-03-11T03:17:45.466839Z

Nice!

kennytilton 2023-03-11T04:43:11.973739Z

But, hubris aside, I think we make better U/X when niceties such as auto-selecting color based on bkg color is no harder than a fun lookup of how to calculate RGB luminance, and then we can see it working with 15 minutes of work.

kennytilton 2023-03-09T23:28:29.100619Z

Spent a hellish day carving out a new tiltontec.matrix.api, frustrated by weird .cljc syntax for declaring macros so library clients can see them. Seems to be under control, so I might soldier on a bit and see about slimming down the web-mx requires. This might be more important than I thought -- I just realized how much the chaos annoys me! Been cleaning up other things as well. Shooting for an announcement on the Ides of March, or the Vernal equinox at the latest.