As recently promised, here is the new release of UIBUILDER for your New Year enjoyment! ![]()
Highlights
-
Any Node-RED custom node can now send a message to a uibuilder client! In your runtime code, add
RED.events.emit('UIBUILDER/send/<url-name>', {payload: 'Hi from my custom node!'})where<url-name>is the URL set in a deployed uibuilder node. The data will be sent to all browser tabs connected to that uibuilder endpoint. Note though that this bypasses any uib-cache node. -
You can now send a message from Node-RED to a connected client from a Function Node! Simply add
RED.util.uib.send('uibname', {....})to your function code. This will send a message to all connected clients for that uibuilder instance. -
For front-end coders, you now have access to a number of table manipulation functions. Making it very easy to create and manipulate tables in your web pages from simple input data. You can add and remove tables, table rows and add event handlers (e.g. click) to rows or cells.
General changes
-
Added ability to send messages from Node-RED to a connected client from a Function Node. Simply add
RED.util.uib.send('uibname', {....})to your function code. This will send a message to all connected clients for that uibuilder instance. -
References to
fs-extra3rd-party library removed from all nodes & libraries exceptlibs/fs.js. -
Socket security check tool added to all TotallyInformation GitHub repositories including UIBUILDER. Provides significant supply-chain security and privacy checks.
-
All references to node.js's
fslibrary now restricted tolibs/fs.js. -
To help further improve the development of the brand css, LightningCSS is now used to compile the source CSS. This ensures that the CSS is not using too new CSS options and improves the performance of the CSS. Additionally, stylelint is now used to check the CSS for errors and warnings.
-
Now using LightningCSS to compile source CSS and ensure not using too new CSS options.
-
Some unused NodeJS files have been removed.
-
@totallyinformation/ti-common-event-handlerdependency package now removed completely.RED.eventsis used throughout, all uibuilder events start withUIBUILDER/. -
To make it easier to create new elements in the future. Moved no-code element runtime processing to a common folder,
nodes/elements. Added Editor API's and moved processing out of theuib-elementruntime to separate module. Also moved element description and advanced options HTML tonodes/elements/en-US. -
The common code and css files in the
resourcesfolder (ti-common.jsandti-common.css) have been renamed toeditor-common.jsandeditor-common.cssrespectively. This is to make it clearer that these are used in the Node-RED editor only. -
The
uib-pluginlibrary now renamed touib-editor-pluginfor clarity. -
New
uib-runtime-pluginlibrary added. Now manages most of the additions toRED.util.uibwhich contains functions made available to Node-RED function nodes.
uib-brand.css styles & variables
-
NEW Utility classes
-
square- Make something square or rectangular. -
round- Make something circular, oval or pill-shapedEach of these are controlled by simple CSS variable overrides. See the live file for details on use.
-
-
Core font now changed to match the uib-brand.css. No more Google fonts! This should make the UI more consistent and faster to load.
-
Now using LightningCSS to compile source CSS and ensure not using too new CSS options.
-
Added
text-wrap: balancetoh1,h2,h3,h4,h5,h6,headingand addedtext-wrap: prettytop,li,figcaption- these make the elements look a little nicer when text is wrapping. -
Added
container-type: inline-sizetoheader,footer,main,section,article. This is in preparation for the future use of Container Queries which are a much more flexible alternative to Media Queries for controlling responsive layout breakpoints. Container Queries are still very new and not yet supported widely enough to use. -
Added some additional "reset" tweaks for improved visual style.
Node: uibuilder
- Node-RED Editor:
- FIXED When a URL is changed, the IDE editor url is now updated automatically. This is particularly important when copying/pasting a uibuilder node.
Front-end code templates
- Removed optional link to legacy CSS style library.
Front-end library: uibuilder.js
-
NEW FUNCTIONS
buildHtmlTable- Returns HTML of a table created from the input data.createTable- UsesbuildTableto create a new table and attaches to a parent element in the DOM.tblAddRow- adds a new row to an existing table.tblRemoveRow- removes a row from an existing table.tblAddListener- adds row/cell listeners to the 1st tbody of a table. Will send a msg back to Node-RED when used with uibuilder.
-
Updated the front-end
index.htmltemplates to highlight that the uibuilder client library MUST be included. After seeing several people take it out. -
Added
uibuilder:propertyChanged:${prop}custom event when a managed variable changed. Has the same event.details as the 'uibuilder:propertyChanged' event. This event can be used instead of theuibuilder.onChange('prop', ....)function if preferred. -
Updated
uibuilder:propertyChangedanduibuilder:propertyChanged:${prop}custom events to includeoldValueas one of the event details. Will beundefinedif the property is new. -
Updated
uibuilder.eventSendfunction to includemsg._ui.datasetwhich contains anydata-*attributes from the element that triggered the event.
Front-end library: ui.js
- NEW METHODS
buildHtmlTable- Returns HTML of a table created from the input data.createTable- UsesbuildTableto create a new table and attaches to a parent element in the DOM.tblAddDataRow- adds a new row to an existing table.tblAddListener- adds row/cell listeners to the 1st tbody of a table. Will send a msg back to Node-RED when used with uibuilder. Defaults to adding aclicklistener.tblGetCellName- Returns a standardised table cell name. Either from adata-col-nameattribute or a numeric reference likeC003.
- Added
data-col-referenceattribute to created tables - on thetheadrow that actually defines the columns. Making it easier to get a reliable column reference later.
Front-end components: uib-var
- Re-engineered to match the latest standards in the TotallyInformation web-components library.
- Added
readyevent - Removed shadow dom
- Error messages improved
- Add
sourceprop when reporting change back to Node-RED
Documentation changes
- Improved documentation for uibuilder's event handling and better linked that to how to create custom nodes that work with uibuilder.
- Improved documentation of the uibuilder extensions for the
RED.util.uibobject for use in Function nodes. - Documentation for the new table handing functions in the client library.
Example flow updates
- All examples showing the use of the old
uibuilderfeclient library have been removed. - Several of the example flows have been updated to show the latest features.
Runtime library changes
web.js
- Improved error checking and reporting in
serveVendorPackageswhen mounting installed libraries. Issue #428.