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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@adcops/autocore-react

v3.0.29

Published

A React component library for industrial user interfaces.

Downloads

25

Readme

autocore-react

React components for HTML5 user interfaces that are easy to integrate into any project. autocore-react targets both the browser and Tauri. The primary focus is HMI applications for machine control, as well as tasks common to general desktop applications.

Overview

autocore is ADC's collection of Industry 4.0 (IIOT) libraries. autocore-react focuses on user interface development.

autocore-react is the third version of this library, and is a simplification of previous versions. Instead of relying on dozens of custom controls for integration into HMI applications, autocore-react now leans on PrimeReact to supply almost all but the most obscure controls, and adds a wrapper to integrate signals from the backend to the common controls. This allows autocore-react to focus on the additional features needed for machine-control user interfaces, while PrimeReact excels at development of components.

Hub

Whether running in a browser or within a Tauri application, the user interface of a web app needs to communicate with a backed. The Hub abstracts this by defining a common base class, then automatically selecting the proper pipeline based upon the environment. If the Tauri environment is detected, HubTauri is loaded. For a browser instance, a socket.io connection is used. When running in a development environment, a simulated backend that simply echoes responses is used.

When writing the main application or developing components, you only need to focus on the Hub class. Because the backend is selected automatically, the web application does not need to be modified for each individual environment.

Installation

Install from NPM.

npm install --save @adcops/autocore-react

Development

We typically have an external Tauri project designed to import and test the autocore-react library. We find that some issues, particularly Singleton classes and certain resources, may not occur when components are tested within the same project.

There are multiple ways to test a "pre-release" or "staging" version of the library before publishing the official version.

Use npm tags to publish a "staging" version

Use this for a final "pre-flight check" or when testing a serious release candidate. For development with frequent changes, use 'npm link.'

When you publish a package to npm, it automatically assigns the latest tag to the published version. Most users will install the latest version when they omit a tag/version in the npm install command. To publish a "staging" or pre-release version without affecting users of the latest version, you can use a custom tag, such as next, beta, or staging.

To publish a "staging" version of your package, you can run:

npm publish --tag staging --access=public

Note that we have to specify that the access is public because the tag makes this "scoped," which are private by default.

In the test project, simply install the 'staging' tag version.

npm install @adcops/autocore-react@staging

npm link

In the root of the autocore-react project, initiate npm link:

npm link

Now, the autocore-react project is being served locally to your machine.

To test it in an external project, navigate to the root directory of that project.

npm link @adcops/autocore-react

Whatever current version of autocore-react will be removed and replaced with links to the project directory on your machine. The nice thing is that, as you make machines in the autocore-react project, those changes are reflected immediately in the external project. The downside is that not every file can be served by npm link in this way. For example, were there font files and icon resources served from autocore-react, the wouldn't load into the external project because of CORS limitation. Depending on what you're testing, this may not matter.

When done testing, in the external project we simply unlink.

npm unlink @adcops/autocore-react

A final consequence is that, were autocore-react installed before using npm link, it will no longer be installed once unlink. You will once again need to install the latest published version, if so desired.

npm install --save @adcops/autocore-react

Image assets

First, always first check PrimeReact at primereact.org/icons to see if an icon with the proper meaning or look exists. If so, always prefer use of a built-in PrimeReact icon.

That being said, the PrimeReact icon library isn't written with the industrial market in mind. We've customized and created additional icons with specific meaning in industrial use.

We create the SVGs by starting with an SVG from Material Icons that closely resembles our needs, then modify using InkScape or, more often than not, by adjusting the path by hand. Once ready, we place the file into ./src/assets/svg.

However, since we're not using a bundler, it's much easier and more reliable to import by converting the SVG file to a .tsx file, making it a component that can be imported in our source file. For that task, we use the command-line version of SVGR.

The package.json file contains a script for running SVGR properly. Running npm run convert-assets will process all .svg files in ./src/assets/svg into .tsx files located in ./src/assets. To use one of the newly-generated components, simply import as you would any component.

import { JogLong } from '../assets';

<JogLong className="distance-selector-button" width={16} height={16} />

Note that hand-editing out some features out of the TSX file is often required. Because of that, the convert-assests command is set not to overwrite existing .tsx files. If you need to update a pre-existing .tsx file, delete it first.

Possible options for SVGR: https://react-svgr.com/docs/options/

Documentation

To generate documentation:

npm run generate-docs

Publishing the package will also regenerate the documentation.

Additional Documentation

Beyond doc-comments in the code, we provide additional documentation in the additional-docs folder.

Acknowledgements

Beyond the obvious, inherent React libraries, autocore-react greatly appreciates the works of these additional libraries.

  • PrimeReact and PrimeIcons
  • numerable
  • Simple Keyboard (https://github.com/hodgef/simple-keyboard)
    • We customize Simple Keyboard for cleaner physical keyboard integration.

Copyright

(C) Copyright 2021-2024 Automated Design Corp. All Rights Reserved.

License

Licensed for use on ADC equipment or within ADC software.