Thanks for this Bill,
I am very interested in your project. I've had this same thought before, but had no idea about babel-plugin-transform-jsx which is half the puzzle solved!
I can think of two use cases for simplifying D3 code w JSX:
.append(...).attr(...).append(...)
and
.select(...).attr(...).select(...)
Currently, you're transforming JSX into JSON at compile time, then using that JSON at runtime. What about getting closer to what React does, like so: Transform JSX into JSON, transform that JSON into D3 calls (still at compile time), and finally, end up using only normal D3 calls at runtime. Additionally, use a DSL to differentiate between the use cases.
E.g. (using xml namespace as a jsx directive DSL)
d3.select("body")
<D3_APPEND:svg className="chart" width={width} height={height}></svg>
is transformed at compile-time into
d3.select("body")
.append("svg")
.classed("chart", true)
.attr("width", width)
.attr("height", height);
Because most D3 user code is so idiomatic, this would be really useful!
What do you think?