We’re trying to “make Meteor great again”:
I think Meteor is still great! But! It is in need of modernization.
So, let’s build get there one step at a time:
One problem Meteor has is that accounts-ui
is built with Blaze, and therefore is not compatible with template systems of React, Vue, Angular, Svelte, Solid, etc.
Solution: a <blaze-component>
Custom Element
Custom Elements are native HTML elements defined in JavaScript.
I have a custom element I made locally called <blaze-component>
that allow me to use any Blaze component declaratively in any framework’s template system (JSX, Vue SFC, Svelte SFC, or even plain HTML). I’ll publish it soon.
It looks like this currently, in plain HTML:
<blaze-component
tmpl="loginButtons"
data='{"align": "right"}'
></blaze-component>
The data attribute (for example when used in a plain HTML file, or with .setAttribute
) accepts a JSON string. This maps to basically the following equivalent JS inside the Custom Element:
// data is reactive, if the element data value changes, the Blaze component is updated.
Blaze.renderWithData('loginButtons', () => this.data, this)
Because this is “just an HTML element”, and all web frameworks can control HTML elements, this can be used in any framework. For example, in a Solid.js template it looks like this with a dynamic data
prop:
function MySolidComponent() {
const [data, setData] = createSignal({align: 'right'})
return <blaze-component
tmpl="loginButtons"
data={data()}
/>
}
In this Solid.js example, we’re sending an actual object to the .data
property of the <blaze-component>
element, and this updated the underlying Blaze view.
And similar in Vue, Svelte, etc, with reactive bindings in their template systems.
The future?
Up next, we can wrap the <blaze-component>
element to create elements such as <login-buttons>
to replace direct usage of the Blaze {{> loginButtons}}
component
We can later deprecate and remove Blaze from the default setup, and remove <blaze-component>
, leaving only higher level components such as <login-buttons>
that are no longer implemented with Blaze under the hood.
Anyone who is already using new elements such as <login-buttons>
will simply have nothing to do after Blaze is removed, as they will already be using the standard HTML/DOM interface.
And! The best part!:
Type Definitions
The definition of the <blaze-component>
element (and any other elements we build with it such as <login-buttons>
) have type definitions for type checking, autocompletion, and intellisense in all modern frameworks that supports types in their template systems.
Custom Elements that I write are currently type checked in Solid, React, Preact, Vue, Svelte, Ember.js, and partially in Angular (a limitation of Angular they will hopefully fix soon).
Any other JSX framework that uses TSX is easy to add type definitions for too.
This means, write once, use in any framework, with a complete IDE experience. No need to make wrappers for all frameworks.
A full stack meta framework like Meteor, with its own set of official UI elements, can support all frameworks with a single set of element definitions, while people can enjoy bringing their favorite component system. Win win.
Even more future?
Meteor could have new UI elements for things such as user cards, etc. And they’d work no matter what component system the app author prefers.
If Meteor had its own set of general purpose UI elements (buttons, dropdowns, toggle switches, tabs, etc) I think it would be nice.
I believe that people here want an all-in-one solution (with any part of it replaceable by those who want to use other libraries).