I moved a small website from #mithriljs to #vue because I didn't feel like rebuilding a bunch of functionality from scratch. And damn, Vue has grown a lot in the five years since I last used it.

I lost a couple of hours investigating a weird issue with #MithrilJS and TypeScript when using JSX.

The documentation recommends three different approaches for handling custom component attributes:

  • Using hyperscript
  • Using class components
  • Using a translation function to “trick” TypeScript
  • Each option has its own downside. Hyperscript is the more idiomatic approach, but it can get confusing if you’re used to JSX. Class components won’t properly inspect or autocomplete custom attributes. So I naturally chose the third option, because it lets you keep JSX and still get attribute detection in the editor.

    The problem is that the documentation provides the following snippet:

    const ChildComponent = TsClosureComponent<Attributes>(vNode => { return { view: () => <div>{vNode.attrs.greet}</div> }; })

    However, if your component has nested children, it won’t re-render when they get updated. To make it work, the code needs to be written like this:

    const ChildComponent = TsClosureComponent<Attributes>(() => { return { view: (vNode) => <div>{vNode.children}</div> }; })

    It works as expected, but I’m not sure if it'll introduce new issues, so I’ll keep updating.

    Mithril.js seems nice so far. It's a rare example of a framework that's just finished: still in use but not updated. This leads to the impression that it's abandoned, though, which means the ecosystem around it has decayed a bit.

    In particular, I was using Storybook in my Svelte version of this project, and a Storybook adapter for Mithril used to exist... but it was removed after v6. (current Storybook major version is 8).

    Luckily, Storybook's generic Web Components support can be adapted to support Mithril with a few helper functions and types: https://gist.github.com/ar-nelson/e8af65532cf1330f7a03e0ebc6408143

    #Javascript #Frontend #Storybook #MithrilJS

    Mithril support in modern (v8.x) Storybook, using Web Components as a wrapper

    Mithril support in modern (v8.x) Storybook, using Web Components as a wrapper - storybook-mithril.ts

    Gist

    Released a #cssinjs lib for #mithriljs today with support for reactive css vars.

    https://github.com/JAForbes/super-mithril-css

    Nice to package up and release something that's been sitting there in a fork for years.

    Though not sure it gets more niche than announcing a #mithriljs lib on mastodon.

    #programming #js #css

    GitHub - JAForbes/super-mithril-css

    Contribute to JAForbes/super-mithril-css development by creating an account on GitHub.

    GitHub

    oh, and to let all you here on 🎺 .:coffee: know, this #WebExtension was created so that I have a good sample to use when writing an introductory article about #MithrilJS.

    Any #MithrilJS fan here?

    Hey #WebDevelopers,

    Inspired by this post https://blog.paulhalliday.io/2017/10/04/how-to-use-vue-js-with-ionic-4/ by Paul Halliday where he shows how to use #IonicFramework 4 with #VueJS, I made a little proof-of-concept that shows basically the same thing but with #MithrilJS instead of #VueJS.

    Check it out at https://github.com/amora-labs/mithril-ionic-poc ❤ 🦊 🚀

    How to use Vue.js with Ionic 4

    Have you ever wanted to use Ionic with other frameworks than Angular? Now you can! Ionic 4 is in early alpha, so the implementation is likely to change as time goes on, but let's investigate this with Vue.js: If you haven't already, download the Vue CLI and create a

    l'Éthique de Spinoza sur écran en version pur texte récursif (proto version alpha) : http://ethica-spinoza.net/

    #hugo #mithriljs #alpha #spinoza #ethica #workinprogress

    hogo theme sources : https://figureslibres.io/gogs/bachir/ethica-spinoza-hugo-theme