Changelog
3.1.6 (October 23, 2023)
Updated types for the <meta>
tag to allow for the view-transition
as name attribute value.
It is now possible to return other things from function components than elements created via createElement
or JSX syntax. Anything that is not an object, string or number will be treated as if <></>
was returned, returned strings and numbers will be treated as <>{value}</>
, objects are expected to be elements created via createElement
or JSX syntax (no change here).
This means that the following components are now possible:
function MyComponent() {
return !!condition && <div>...</div>;
}
function MyComponent() {
return "Hello";
}
function MyComponent() {
return 2023;
}
// ok
renderToHtml(
<div>
<MyComponent />
</div>,
);
Changelog
3.1.5 (October 10, 2023)
Types for many elements were missing, this was because types for them were defined as a namespace interfaces in standalone files that were never imported and therefore TypeScript would never load them.
Changelog
3.1.3 (September 5, 2023)
Exports of all tags prop types were removed, instead those are available via the JSXTE
global namespace.
Added missing property from the <link>
tag's prop type, the as
attribute.
Changelog
3.1.1 (August 24, 2023)
number
as a possible type for input attributes step
and value
(#187)Added number
as a possible type for input attributes step
and value
.
Typing for the JSX html elements were missing some of the event handlers attributes (onpointer
events, onfocusin
etc.). This is fixed now.
Changelog
3.1.0 (August 22, 2023)
Added a new renderer that can generate a JSON structure instead of html. Api for it looks similar to renderToHtml
with the only difference being it does not accept any indentation option.
Added code optimizations:
for..of
loops that rely on iterators used the good ol' for..let i = 0;
loops which are much fasterString.join()
with a much faster custom implementationObject.freeze
renderToStringTemplateTag
(#183)Multiple improvements to the render function for string template tags:
<Interpolate>
and <InterpolateTag>
components. Contents of those will be interpolated into the string template as is for Interpolate, and as a rendered tag for InterpolateTag (see JSDoc comments on those for more details.Changelog
3.0.0 (July 9, 2023)
Added two helper methods to the Context object. A Provider
and a Consumer
are JSXTE Components that provide similar functionality to the React's Context.
const myCtx = defineContext<{ foo: string }>;
const App = () => {
return (
<myCtx.Provider value={{ foo: "hello" }}>
<myCtx.Consumer render={(cv) => <span>{cv.foo}</span>} />
</myCtx.Provider>
);
};
Replaced the ContextMap
argument that was available to to all components with a new ComponentApi
. Contexts can still be accessed via the new API, via the ComponentApi.ctx
property. Additionally the new api provides a render
method, which can be used similarly to the renderToHtml
, but the context's data will get forwarded to the rendered components.