fuzetsu / microh Goto Github PK
View Code? Open in Web Editor NEWa small and simple hyperscript helper
License: MIT License
a small and simple hyperscript helper
License: MIT License
Like mithril's hyperscript.
I left this out intentionally since I mainly use the selectors for classNames
and I don't mind using the attributes object for attributes, but it could be nice.
Hey there, great library! This is exactly what I was looking for in my next project. Coming from Mithril, I got spoiled by its hyperscript helper. Also, clever that the m in m()
stands for microh
, but looks like Mithril. ๐
As you may know, newer versions of Hyperapp post-v2.0.4 introduce the text()
function for text nodes, and is now incompatible with other implementations of hyperscript. As such, writing h('p', {}, 'foo')
is no longer valid. You must now write h('p', {}, text('foo'))
. This also applies to primitive number values, so you must also write h('p', {}, text(5))
if that's your intention.
The author of Hyperapp writes here about using newer versions of Hyperapp with JSX. Although microh has nothing to do with JSX, this comment was helpful in writing a function to pass to microh. Here's an example of this working in Flems.
Less of an issue, but still worth considering: Vnodes generated by Hyperapp's new text()
function are invalid with microh if the value passed to text()
is falsey. This is because writing text(0)
or text('')
for example, will generate these respectively:
{ type: 0, props: {}, children: [], node: undefined, key: null, tag: 3 }
{ type: '', props: {}, children: [], node: undefined, key: null, tag: 3 }
microh will use the type
property as the tagKey
here on this line, and so the children will be shifted. Here's the incompatibility in action
As Hyperapp now strays from normal hyperscript implementations, it might be silly for microh to chase compatibility with it until its API is stable. These breaking changes in Hyperapp occurred between 2.0.4
and 2.0.5
, so it's hard to predict if you instinctively follow semver. It might, however, be worth adding a disclaimer in the README that Hyperapp versions past 2.0.4
require additional code to work with microh.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.