npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

ui5-jsx

v0.1.0

Published

Babel plugin for converting JSX to UI5 render manager calls.

Readme

ui5-jsx

This is a forked project form ui5-jsx-rm.

The original version does not support the new RenderManager API. This project extends the original one to add the new features.

The original behaviour is kept. The new syntax is activated with oRm.renderV2(...) instead of oRm.render(...).

JSX:

oRm.renderV2(
    <button id="myButton" type="button">Click me!</button>
);

(New) Output:

(function () {
    oRm.openStart("button");
    oRm.attr("id", "myButton");
    oRm.attr("type", "button");
    oRm.openEnd();
    oRm.text("Click me!");
    oRm.close("button");
})();

JSX to UI5 Render Manager

Babel plugin for converting JSX to UI5 render manager calls.

Usage

You can install the plugin through npm: npm install ui5-jsx --save-dev and then use it as any other babel plugin. It should be used together with a babel preset that can support arrow functions (as the transpilation produces arrow functions).

Example

Assuming that you have a webapp folder with our js files and you want to transpile them into the dist folder, you should first make a .babelrc file with the following content:

{
    "presets": ["env"],
    "plugins": ["ui5-jsx"]
}

Then you can run the following command in your terminal of choice: babel webapp --out-dir dist.

Tips

When using babel to transpile code which cannot natively run in the browser (like JSX), you should use a tool for watching your files for changes and recompiling them automatically. Babel has a --watch flag for this. Alternatively, you can use a task runner like Grunt to do more advanced stuff (like serving the files on a simple web server and doing live reload).

Features

Basic HTML tags

You can use all the regular HTML tags directly inside your .js files (wrapped into a render manager .render method call).

Input:

function (oRm) {
    oRm.render(<div></div>);
}

Output:

function (oRm) {
    oRm.write("<div ");
    oRm.writeClasses();
    oRm.write(">");
    oRm.write("</div>");
}

Dynamic RenderManager detection

The plugin expects you to wrap your JSX inside a render call. The identifier on which you do this call will be used throughout the transpilation process (for that particular JSX tree).

Input:

function render(oRm) {
    oRm.render(<div></div>);
    
    var oRenderManager = oRm;
    oRenderManager.render(<div></div>)
}

Output:

function render(oRm) {
    oRm.write("<div ");
    oRm.writeClasses();
    oRm.write(">");
    oRm.write("</div>");
    
    var oRenderManager = oRm;
    oRenderManager.write("<div ");
    oRenderManager.writeClasses();
    oRenderManager.write(">");
    oRenderManager.write("</div>");
}

Embedded JavaScript expressions

Expressions (e.g. conditionals, forEach iterations) can be used for specifying attribute values, child nodes, etc.

Input:

function render(oRenderManager, bInclude) {
    oRenderManager.render(
        <div> { bInclude && <span>I am here!</span> } </div>
    );
}

Output:

function render(oRenderManager, bInclude) {
    oRenderManager.write("<div ");
    oRenderManager.writeClasses();
    oRenderManager.write(">");
    oRenderManager.writeEscaped((bInclude && (function () {
        oRenderManager.write("<span ");
        oRenderManager.writeClasses();
        oRenderManager.write(">");
        oRenderManager.writeEscaped("I am here!");
        oRenderManager.write("</span>");
    })()) || "");
    oRenderManager.write("</div>");
}

Dynamic class and style specification

The styles and clases for a given html node can either be specified directly as a string or they can be build dynamically.

Classes

When building the classes of a html node dynamically, you can use a JavaScript expression which either returns:

  • an array of strings (each string is interpreted as a class).
  • a map between string-keys (which indicate the class names) and boolean-values (true means that the class should be applied to the DOM, false otherwise).

Example:

function render(oRenderManager) {
    oRenderManager.render(<div class="bold red">Plain</div>);
    oRenderManager.render(<div class={ ["bold", "red"] }>With Array</div>);
    oRenderManager.render(<div class={ { bold: true, red: true } }>With Object</div>);
}

Styles

When building the style of a html node dynamically, you can use a JavaScript expression which either returns:

  • an array of objects. Each object should have a name property and a value property. If the value is null, then the style is not applied.
  • a map betwen string-keys (which indicate the style names) and any-values (which give the style value; if a value is null, then the corresponding style is not applied).

Example:

function render(oRenderManager) {
    oRenderManager.render(<div style="color: red">Plain</div>);
    oRenderManager.render(<div style={ [{name: "color", value: "red"}] }>With Array</div>);
    oRenderManager.render(<div style={ { color: "red" } }>With Object</div>);
}

UI5-specific constructs

UI5-specific constructs (child controls, control data, accessibility state) can be used through "special" attributes or tags.

Control / element data

To write control or element data to the DOM, a set of special element attributes can be used: ui5ControlData and ui5ElementData. They expect a JSX expression which will result in a control or an element.

Input:

function render(oRenderManager, oControl) {
    oRenderManager.render(
        <div ui5ControlData={ oControl }></div>
    );
}

Output:

function (oRenderManager, oControl) {
    oRenderManager.write("<div ");
    oRenderManager.writeControlData(oControl);
    oRenderManager.writeClasses();
    oRenderManager.write(">");
    oRenderManager.write("</div>");
}

Child controls

Child controls may also be rendered using a special tag: ui5Control.

Input:

function render(oRm, oC) {
    oRm.render(
        <ui5Control>{ oC }</ui5Control>
    );
}

Output:

function render(oRm, oC) {
    oRm.renderControl(oC);
}

Accessibility state

Calls to the writeAccessibilityState method of the render manager can be achived using a special attribute ui5AccessibilityData. It should be assigned a JavaScript expression which returns an object with two properties: element and props (which are then passed to the corresponding parameters of the render manager method).

Spread attributes

To enable the usage of dynamic attributes, the spread attributes syntax may be used.

Samples

You can check out the sample folder for a working library of controls based on JSX renderers. The transpiled code is running on GitHub Pages here. Smaller snippets of code can be found in the test folder. In the snapshot subfolder, you can find JSX renderers together with the corresponding transpiled code and in the exec subfolder you can find JSX renderers together with the resulting HTML code.